abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cnfCore.c File Reference
#include "cnf.h"

Go to the source code of this file.

Functions

void Cnf_ManPrepare ()
 FUNCTION DEFINITIONS ///. More...
 
Cnf_Man_tCnf_ManRead ()
 
void Cnf_ManFree ()
 
Vec_Int_tCnf_DeriveMappingArray (Aig_Man_t *pAig)
 FUNCTION DECLARATIONS ///. More...
 
Cnf_Dat_tCnf_DeriveWithMan (Cnf_Man_t *p, Aig_Man_t *pAig, int nOutputs)
 
Cnf_Dat_tCnf_Derive (Aig_Man_t *pAig, int nOutputs)
 
Cnf_Dat_tCnf_DeriveOtherWithMan (Cnf_Man_t *p, Aig_Man_t *pAig, int fSkipTtMin)
 
Cnf_Dat_tCnf_DeriveOther (Aig_Man_t *pAig, int fSkipTtMin)
 

Variables

static
ABC_NAMESPACE_IMPL_START
Cnf_Man_t
s_pManCnf = NULL
 DECLARATIONS ///. More...
 

Function Documentation

Cnf_Dat_t* Cnf_Derive ( Aig_Man_t pAig,
int  nOutputs 
)

Definition at line 165 of file cnfCore.c.

166 {
167  Cnf_ManPrepare();
168  return Cnf_DeriveWithMan( s_pManCnf, pAig, nOutputs );
169 }
Cnf_Dat_t * Cnf_DeriveWithMan(Cnf_Man_t *p, Aig_Man_t *pAig, int nOutputs)
Definition: cnfCore.c:129
void Cnf_ManPrepare()
FUNCTION DEFINITIONS ///.
Definition: cnfCore.c:46
static ABC_NAMESPACE_IMPL_START Cnf_Man_t * s_pManCnf
DECLARATIONS ///.
Definition: cnfCore.c:30
Vec_Int_t* Cnf_DeriveMappingArray ( Aig_Man_t pAig)

FUNCTION DECLARATIONS ///.

Function*************************************************************

Synopsis [Converts AIG into the SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 78 of file cnfCore.c.

79 {
80  Vec_Int_t * vResult;
81  Cnf_Man_t * p;
82  Vec_Ptr_t * vMapped;
83  Aig_MmFixed_t * pMemCuts;
84  abctime clk;
85  // allocate the CNF manager
86  p = Cnf_ManStart();
87  p->pManAig = pAig;
88 
89  // generate cuts for all nodes, assign cost, and find best cuts
90 clk = Abc_Clock();
91  pMemCuts = Dar_ManComputeCuts( pAig, 10, 0, 0 );
92 p->timeCuts = Abc_Clock() - clk;
93 
94  // find the mapping
95 clk = Abc_Clock();
96  Cnf_DeriveMapping( p );
97 p->timeMap = Abc_Clock() - clk;
98 // Aig_ManScanMapping( p, 1 );
99 
100  // convert it into CNF
101 clk = Abc_Clock();
102  Cnf_ManTransferCuts( p );
103  vMapped = Cnf_ManScanMapping( p, 1, 0 );
104  vResult = Cnf_ManWriteCnfMapping( p, vMapped );
105  Vec_PtrFree( vMapped );
106  Aig_MmFixedStop( pMemCuts, 0 );
107 p->timeSave = Abc_Clock() - clk;
108 
109  // reset reference counters
110  Aig_ManResetRefs( pAig );
111 //ABC_PRT( "Cuts ", p->timeCuts );
112 //ABC_PRT( "Map ", p->timeMap );
113 //ABC_PRT( "Saving ", p->timeSave );
114  Cnf_ManStop( p );
115  return vResult;
116 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Ptr_t * Cnf_ManScanMapping(Cnf_Man_t *p, int fCollect, int fPreorder)
Definition: cnfUtil.c:170
void Cnf_ManStop(Cnf_Man_t *p)
Definition: cnfMan.c:82
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
Definition: aigMem.c:132
static abctime Abc_Clock()
Definition: abc_global.h:279
DECLARATIONS ///.
Definition: aigMem.c:30
Aig_MmFixed_t * Dar_ManComputeCuts(Aig_Man_t *pAig, int nCutsMax, int fSkipTtMin, int fVerbose)
Definition: darCore.c:287
void Cnf_DeriveMapping(Cnf_Man_t *p)
Definition: cnfMap.c:100
void Cnf_ManTransferCuts(Cnf_Man_t *p)
Definition: cnfPost.c:117
Vec_Int_t * Cnf_ManWriteCnfMapping(Cnf_Man_t *p, Vec_Ptr_t *vMapped)
DECLARATIONS ///.
Definition: cnfWrite.c:45
Cnf_Man_t * Cnf_ManStart()
FUNCTION DEFINITIONS ///.
Definition: cnfMan.c:51
typedefABC_NAMESPACE_HEADER_START struct Cnf_Man_t_ Cnf_Man_t
INCLUDES ///.
Definition: cnf.h:51
ABC_INT64_T abctime
Definition: abc_global.h:278
void Aig_ManResetRefs(Aig_Man_t *p)
Definition: aigUtil.c:122
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Cnf_Dat_t* Cnf_DeriveOther ( Aig_Man_t pAig,
int  fSkipTtMin 
)

Definition at line 219 of file cnfCore.c.

220 {
221  Cnf_ManPrepare();
222  return Cnf_DeriveOtherWithMan( s_pManCnf, pAig, fSkipTtMin );
223 }
void Cnf_ManPrepare()
FUNCTION DEFINITIONS ///.
Definition: cnfCore.c:46
Cnf_Dat_t * Cnf_DeriveOtherWithMan(Cnf_Man_t *p, Aig_Man_t *pAig, int fSkipTtMin)
Definition: cnfCore.c:182
static ABC_NAMESPACE_IMPL_START Cnf_Man_t * s_pManCnf
DECLARATIONS ///.
Definition: cnfCore.c:30
Cnf_Dat_t* Cnf_DeriveOtherWithMan ( Cnf_Man_t p,
Aig_Man_t pAig,
int  fSkipTtMin 
)

Function*************************************************************

Synopsis [Converts AIG into the SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 182 of file cnfCore.c.

183 {
184  Cnf_Dat_t * pCnf;
185  Vec_Ptr_t * vMapped;
186  Aig_MmFixed_t * pMemCuts;
187  abctime clk;
188  // connect the managers
189  p->pManAig = pAig;
190 
191  // generate cuts for all nodes, assign cost, and find best cuts
192 clk = Abc_Clock();
193  pMemCuts = Dar_ManComputeCuts( pAig, 10, fSkipTtMin, 0 );
194 p->timeCuts = Abc_Clock() - clk;
195 
196  // find the mapping
197 clk = Abc_Clock();
198  Cnf_DeriveMapping( p );
199 p->timeMap = Abc_Clock() - clk;
200 // Aig_ManScanMapping( p, 1 );
201 
202  // convert it into CNF
203 clk = Abc_Clock();
205  vMapped = Cnf_ManScanMapping( p, 1, 1 );
206  pCnf = Cnf_ManWriteCnfOther( p, vMapped );
207  pCnf->vMapping = Cnf_ManWriteCnfMapping( p, vMapped );
208  Vec_PtrFree( vMapped );
209  Aig_MmFixedStop( pMemCuts, 0 );
210 p->timeSave = Abc_Clock() - clk;
211 
212  // reset reference counters
213  Aig_ManResetRefs( pAig );
214 //ABC_PRT( "Cuts ", p->timeCuts );
215 //ABC_PRT( "Map ", p->timeMap );
216 //ABC_PRT( "Saving ", p->timeSave );
217  return pCnf;
218 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Vec_Ptr_t * Cnf_ManScanMapping(Cnf_Man_t *p, int fCollect, int fPreorder)
Definition: cnfUtil.c:170
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
Definition: aigMem.c:132
Vec_Int_t * vMapping
Definition: cnf.h:67
Cnf_Dat_t * Cnf_ManWriteCnfOther(Cnf_Man_t *p, Vec_Ptr_t *vMapped)
Definition: cnfWrite.c:419
static abctime Abc_Clock()
Definition: abc_global.h:279
Definition: cnf.h:56
DECLARATIONS ///.
Definition: aigMem.c:30
Aig_MmFixed_t * Dar_ManComputeCuts(Aig_Man_t *pAig, int nCutsMax, int fSkipTtMin, int fVerbose)
Definition: darCore.c:287
void Cnf_DeriveMapping(Cnf_Man_t *p)
Definition: cnfMap.c:100
void Cnf_ManTransferCuts(Cnf_Man_t *p)
Definition: cnfPost.c:117
Vec_Int_t * Cnf_ManWriteCnfMapping(Cnf_Man_t *p, Vec_Ptr_t *vMapped)
DECLARATIONS ///.
Definition: cnfWrite.c:45
ABC_INT64_T abctime
Definition: abc_global.h:278
void Aig_ManResetRefs(Aig_Man_t *p)
Definition: aigUtil.c:122
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Cnf_Dat_t* Cnf_DeriveWithMan ( Cnf_Man_t p,
Aig_Man_t pAig,
int  nOutputs 
)

Function*************************************************************

Synopsis [Converts AIG into the SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 129 of file cnfCore.c.

130 {
131  Cnf_Dat_t * pCnf;
132  Vec_Ptr_t * vMapped;
133  Aig_MmFixed_t * pMemCuts;
134  abctime clk;
135  // connect the managers
136  p->pManAig = pAig;
137 
138  // generate cuts for all nodes, assign cost, and find best cuts
139 clk = Abc_Clock();
140  pMemCuts = Dar_ManComputeCuts( pAig, 10, 0, 0 );
141 p->timeCuts = Abc_Clock() - clk;
142 
143  // find the mapping
144 clk = Abc_Clock();
145  Cnf_DeriveMapping( p );
146 p->timeMap = Abc_Clock() - clk;
147 // Aig_ManScanMapping( p, 1 );
148 
149  // convert it into CNF
150 clk = Abc_Clock();
152  vMapped = Cnf_ManScanMapping( p, 1, 1 );
153  pCnf = Cnf_ManWriteCnf( p, vMapped, nOutputs );
154  Vec_PtrFree( vMapped );
155  Aig_MmFixedStop( pMemCuts, 0 );
156 p->timeSave = Abc_Clock() - clk;
157 
158  // reset reference counters
159  Aig_ManResetRefs( pAig );
160 //ABC_PRT( "Cuts ", p->timeCuts );
161 //ABC_PRT( "Map ", p->timeMap );
162 //ABC_PRT( "Saving ", p->timeSave );
163  return pCnf;
164 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Vec_Ptr_t * Cnf_ManScanMapping(Cnf_Man_t *p, int fCollect, int fPreorder)
Definition: cnfUtil.c:170
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
Definition: aigMem.c:132
static abctime Abc_Clock()
Definition: abc_global.h:279
Definition: cnf.h:56
DECLARATIONS ///.
Definition: aigMem.c:30
Cnf_Dat_t * Cnf_ManWriteCnf(Cnf_Man_t *p, Vec_Ptr_t *vMapped, int nOutputs)
Definition: cnfWrite.c:199
Aig_MmFixed_t * Dar_ManComputeCuts(Aig_Man_t *pAig, int nCutsMax, int fSkipTtMin, int fVerbose)
Definition: darCore.c:287
void Cnf_DeriveMapping(Cnf_Man_t *p)
Definition: cnfMap.c:100
void Cnf_ManTransferCuts(Cnf_Man_t *p)
Definition: cnfPost.c:117
ABC_INT64_T abctime
Definition: abc_global.h:278
void Aig_ManResetRefs(Aig_Man_t *p)
Definition: aigUtil.c:122
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Cnf_ManFree ( )

Definition at line 58 of file cnfCore.c.

59 {
60  if ( s_pManCnf == NULL )
61  return;
63  s_pManCnf = NULL;
64 }
void Cnf_ManStop(Cnf_Man_t *p)
Definition: cnfMan.c:82
static ABC_NAMESPACE_IMPL_START Cnf_Man_t * s_pManCnf
DECLARATIONS ///.
Definition: cnfCore.c:30
void Cnf_ManPrepare ( )

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file cnfCore.c.

47 {
48  if ( s_pManCnf == NULL )
49  {
50 // printf( "\n\nCreating CNF manager!!!!!\n\n" );
52  }
53 }
Cnf_Man_t * Cnf_ManStart()
FUNCTION DEFINITIONS ///.
Definition: cnfMan.c:51
static ABC_NAMESPACE_IMPL_START Cnf_Man_t * s_pManCnf
DECLARATIONS ///.
Definition: cnfCore.c:30
Cnf_Man_t* Cnf_ManRead ( )

Definition at line 54 of file cnfCore.c.

55 {
56  return s_pManCnf;
57 }
static ABC_NAMESPACE_IMPL_START Cnf_Man_t * s_pManCnf
DECLARATIONS ///.
Definition: cnfCore.c:30

Variable Documentation

ABC_NAMESPACE_IMPL_START Cnf_Man_t* s_pManCnf = NULL
static

DECLARATIONS ///.

CFile****************************************************************

FileName [cnfCore.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG-to-CNF conversion.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
cnfCore.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

]

Definition at line 30 of file cnfCore.c.