ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcDress2.c File Reference
#include "base/abc/abc.h"
#include "aig/aig/aig.h"
#include "proof/dch/dch.h"
#include "aig/gia/giaAig.h"
Include dependency graph for abcDress2.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START int Abc_ObjEquivId2ObjId (int EquivId)
 
int Abc_ObjEquivId2Polar (int EquivId)
 
int Abc_ObjEquivId2NtkId (int EquivId)
 
Aig_Man_tAbc_NtkToDar (Abc_Ntk_t *pNtk, int fExors, int fRegisters)
 DECLARATIONS ///.
 
void Dch_ComputeEquivalences (Aig_Man_t *pAig, Dch_Pars_t *pPars)
 
Aig_Man_tAig_ManCreateDualOutputMiter (Aig_Man_t *p1, Aig_Man_t *p2)
 FUNCTION DEFINITIONS ///.
 
void Abc_NtkDressMapSetPolarity (Abc_Ntk_t *pNtk)
 
Vec_Int_tAbc_NtkDressMapClasses (Aig_Man_t *pMiter, Abc_Ntk_t *pNtk)
 
Vec_Int_tAbc_ObjDressClass (Vec_Ptr_t *vRes, Vec_Int_t *vClass2Num, int Class)
 
int Abc_ObjDressMakeId (Abc_Ntk_t *pNtk, int ObjId, int iNtk)
 
Vec_Ptr_tAbc_NtkDressMapIds (Aig_Man_t *pMiter, Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2)
 
void Dch_ComputeEquivalences2 (Aig_Man_t *pMiter, Dch_Pars_t *pPars)
 
Vec_Ptr_tAbc_NtkDressComputeEquivs (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nConflictLimit, int fVerbose)
 
void Abc_NtkDressPrintEquivs (Vec_Ptr_t *vRes)
 
void Abc_NtkDressPrintStats (Vec_Ptr_t *vRes, int nNodes0, int nNodes1, abctime Time)
 
void Abc_NtkDress2Transfer (Abc_Ntk_t *pNtk0, Abc_Ntk_t *pNtk1, Vec_Ptr_t *vRes, int fVerbose)
 
void Abc_NtkDress2 (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nConflictLimit, int fVerbose)
 

Function Documentation

◆ Abc_NtkDress2()

void Abc_NtkDress2 ( Abc_Ntk_t * pNtk1,
Abc_Ntk_t * pNtk2,
int nConflictLimit,
int fVerbose )

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

Synopsis [Transfers names from pNtk1 to pNtk2.]

Description [Internally calls new procedure for mapping node IDs of both networks into the shared equivalence classes.]

SideEffects []

SeeAlso []

Definition at line 510 of file abcDress2.c.

511{
512 Vec_Ptr_t * vRes;
513 abctime clk = Abc_Clock();
514 vRes = Abc_NtkDressComputeEquivs( pNtk1, pNtk2, nConflictLimit, fVerbose );
515// Abc_NtkDressPrintEquivs( vRes );
516 Abc_NtkDressPrintStats( vRes, Abc_NtkNodeNum(pNtk1), Abc_NtkNodeNum(pNtk1), Abc_Clock() - clk );
517 Abc_NtkDress2Transfer( pNtk1, pNtk2, vRes, fVerbose );
518 Vec_VecFree( (Vec_Vec_t *)vRes );
519}
Vec_Ptr_t * Abc_NtkDressComputeEquivs(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nConflictLimit, int fVerbose)
Definition abcDress2.c:317
void Abc_NtkDress2Transfer(Abc_Ntk_t *pNtk0, Abc_Ntk_t *pNtk1, Vec_Ptr_t *vRes, int fVerbose)
Definition abcDress2.c:445
void Abc_NtkDressPrintStats(Vec_Ptr_t *vRes, int nNodes0, int nNodes1, abctime Time)
Definition abcDress2.c:388
ABC_INT64_T abctime
Definition abc_global.h:332
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the call graph for this function:

◆ Abc_NtkDress2Transfer()

void Abc_NtkDress2Transfer ( Abc_Ntk_t * pNtk0,
Abc_Ntk_t * pNtk1,
Vec_Ptr_t * vRes,
int fVerbose )

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

Synopsis [Transfers IDs from pNtk1 to pNtk2 using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 445 of file abcDress2.c.

446{
447 Vec_Int_t * vClass;
448 Abc_Obj_t * pObj0, * pObj1;
449 int i, k, fComp0, fComp1, Entry;
450 int CounterInv = 0, Counter = 0;
451 char * pName;
452 Vec_PtrForEachEntry( Vec_Int_t *, vRes, vClass, i )
453 {
454 pObj0 = pObj1 = NULL;
455 fComp0 = fComp1 = 0;
456 Vec_IntForEachEntry( vClass, Entry, k )
457 {
458 if ( Abc_ObjEquivId2NtkId(Entry) )
459 {
460 pObj1 = Abc_NtkObj( pNtk1, Abc_ObjEquivId2ObjId(Entry) );
461 fComp1 = Abc_ObjEquivId2Polar(Entry);
462 }
463 else
464 {
465 pObj0 = Abc_NtkObj( pNtk0, Abc_ObjEquivId2ObjId(Entry) );
466 fComp0 = Abc_ObjEquivId2Polar(Entry);
467 }
468 }
469 if ( pObj0 == NULL || pObj1 == NULL )
470 continue;
471 // if the node already has a name, quit
472 pName = Nm_ManFindNameById( pNtk0->pManName, pObj0->Id );
473 if ( pName != NULL )
474 continue;
475 // if the other node has no name, quit
476 pName = Nm_ManFindNameById( pNtk1->pManName, pObj1->Id );
477 if ( pName == NULL )
478 continue;
479 // assign name
480 if ( fComp0 ^ fComp1 )
481 {
482 Abc_ObjAssignName( pObj0, pName, "_inv" );
483 CounterInv++;
484 }
485 else
486 {
487 Abc_ObjAssignName( pObj0, pName, NULL );
488 Counter++;
489 }
490 }
491 if ( fVerbose )
492 {
493 printf( "Total number of names assigned = %5d. (Dir = %5d. Compl = %5d.)\n",
494 Counter + CounterInv, Counter, CounterInv );
495 }
496}
int Abc_ObjEquivId2NtkId(int EquivId)
Definition abcDress2.c:59
ABC_NAMESPACE_IMPL_START int Abc_ObjEquivId2ObjId(int EquivId)
Definition abcDress2.c:57
int Abc_ObjEquivId2Polar(int EquivId)
Definition abcDress2.c:58
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition abcNames.c:69
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
char * Nm_ManFindNameById(Nm_Man_t *p, int ObjId)
Definition nmApi.c:199
Nm_Man_t * pManName
Definition abc.h:160
int Id
Definition abc.h:132
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDressComputeEquivs()

Vec_Ptr_t * Abc_NtkDressComputeEquivs ( Abc_Ntk_t * pNtk1,
Abc_Ntk_t * pNtk2,
int nConflictLimit,
int fVerbose )

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

Synopsis [Computes equivalence classes of objects in pNtk1 and pNtk2.]

Description [Returns the array (Vec_Ptr_t) of integer arrays (Vec_Int_t). Each of the integer arrays contains entries of one equivalence class. Each entry contains the following information: the network number (0/1), the polarity (0/1) and the object ID in the the network (0 <= num < MaxId) where MaxId is the largest number of an ID of an object in that network.]

SideEffects []

SeeAlso []

Definition at line 317 of file abcDress2.c.

318{
319 Dch_Pars_t Pars, * pPars = &Pars;
320 Abc_Ntk_t * pAig1, * pAig2;
321 Aig_Man_t * pMan1, * pMan2, * pMiter;
322 Vec_Ptr_t * vRes;
323 assert( !Abc_NtkIsStrash(pNtk1) );
324 assert( !Abc_NtkIsStrash(pNtk2) );
325 // convert network into AIG
326 pAig1 = Abc_NtkStrash( pNtk1, 1, 1, 0 );
327 pAig2 = Abc_NtkStrash( pNtk2, 1, 1, 0 );
328 pMan1 = Abc_NtkToDar( pAig1, 0, 0 );
329 pMan2 = Abc_NtkToDar( pAig2, 0, 0 );
330 // derive the miter
331 pMiter = Aig_ManCreateDualOutputMiter( pMan1, pMan2 );
332 // set up parameters for SAT sweeping
334 pPars->nBTLimit = nConflictLimit;
335 pPars->fVerbose = fVerbose;
336 // perform SAT sweeping
337 Dch_ComputeEquivalences2( pMiter, pPars );
338 // now, pMiter is annotated with the equivl class info
339 // convert this info into the resulting array
340 vRes = Abc_NtkDressMapIds( pMiter, pNtk1, pNtk2 );
341 Aig_ManStop( pMiter );
342 Aig_ManStop( pMan1 );
343 Aig_ManStop( pMan2 );
344 Abc_NtkDelete( pAig1 );
345 Abc_NtkDelete( pAig2 );
346 return vRes;
347}
Aig_Man_t * Aig_ManCreateDualOutputMiter(Aig_Man_t *p1, Aig_Man_t *p2)
FUNCTION DEFINITIONS ///.
Definition abcDress2.c:83
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Definition abcDar.c:237
Vec_Ptr_t * Abc_NtkDressMapIds(Aig_Man_t *pMiter, Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2)
Definition abcDress2.c:226
void Dch_ComputeEquivalences2(Aig_Man_t *pMiter, Dch_Pars_t *pPars)
Definition abcDress2.c:287
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition abcStrash.c:265
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
typedefABC_NAMESPACE_HEADER_START struct Dch_Pars_t_ Dch_Pars_t
INCLUDES ///.
Definition dch.h:43
void Dch_ManSetDefaultParams(Dch_Pars_t *p)
DECLARATIONS ///.
Definition dchCore.c:45
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDressMapClasses()

Vec_Int_t * Abc_NtkDressMapClasses ( Aig_Man_t * pMiter,
Abc_Ntk_t * pNtk )

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

Synopsis [Create mapping of node IDs of pNtk into equiv classes of pMiter.]

Description []

SideEffects []

SeeAlso []

Definition at line 147 of file abcDress2.c.

148{
149 Vec_Int_t * vId2Lit;
150 Abc_Obj_t * pObj, * pAnd;
151 Aig_Obj_t * pObjMan, * pObjMiter, * pObjRepr;
152 int i;
153 vId2Lit = Vec_IntAlloc( 0 );
154 Vec_IntFill( vId2Lit, Abc_NtkObjNumMax(pNtk), -1 );
155 Abc_NtkForEachNode( pNtk, pObj, i )
156 {
157 // get the pointer to the miter node corresponding to pObj
158 if ( (pAnd = Abc_ObjRegular(pObj->pCopy)) && Abc_ObjType(pAnd) != ABC_OBJ_NONE && // strashed node is present and legal
159 (pObjMan = Aig_Regular((Aig_Obj_t *)pAnd->pCopy)) && Aig_ObjType(pObjMan) != AIG_OBJ_NONE && // AIG node is present and legal
160 (pObjMiter = Aig_Regular((Aig_Obj_t *)pObjMan->pData)) && Aig_ObjType(pObjMiter) != AIG_OBJ_NONE ) // miter node is present and legal
161 {
162 // get the representative of the miter node
163 pObjRepr = Aig_ObjRepr( pMiter, pObjMiter );
164 pObjRepr = pObjRepr? pObjRepr : pObjMiter;
165 // map pObj (whose ID is i) into the repr node ID (i.e. equiv class)
166 Vec_IntWriteEntry( vId2Lit, i, Aig_ObjId(pObjRepr) );
167 }
168 }
169 return vId2Lit;
170}
@ ABC_OBJ_NONE
Definition abc.h:87
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
@ AIG_OBJ_NONE
Definition aig.h:58
Abc_Obj_t * pCopy
Definition abc.h:148
void * pData
Definition aig.h:87
Here is the caller graph for this function:

◆ Abc_NtkDressMapIds()

Vec_Ptr_t * Abc_NtkDressMapIds ( Aig_Man_t * pMiter,
Abc_Ntk_t * pNtk1,
Abc_Ntk_t * pNtk2 )

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

Synopsis [Computes equivalence classes of objects in pNtk1 and pNtk2.]

Description [Internal procedure.]

SideEffects []

SeeAlso []

Definition at line 226 of file abcDress2.c.

227{
228 Vec_Ptr_t * vRes;
229 Vec_Int_t * vId2Lit1, * vId2Lit2, * vCounts0, * vCounts1, * vClassC, * vClass2Num;
230 int i, Class;
231 // start the classes
232 vRes = Vec_PtrAlloc( 1000 );
233 // set polarity of the nodes
236 // create mapping of node IDs of pNtk1/pNtk2 into the IDs of equiv classes of pMiter
237 vId2Lit1 = Abc_NtkDressMapClasses( pMiter, pNtk1 );
238 vId2Lit2 = Abc_NtkDressMapClasses( pMiter, pNtk2 );
239 // count the number of nodes in each equivalence class
240 vCounts0 = Vec_IntStart( Aig_ManObjNumMax(pMiter) );
241 Vec_IntForEachEntry( vId2Lit1, Class, i )
242 if ( Class >= 0 )
243 Vec_IntAddToEntry( vCounts0, Class, 1 );
244 vCounts1 = Vec_IntStart( Aig_ManObjNumMax(pMiter) );
245 Vec_IntForEachEntry( vId2Lit2, Class, i )
246 if ( Class >= 0 )
247 Vec_IntAddToEntry( vCounts1, Class, 1 );
248 // get the costant class
249 vClassC = Vec_IntAlloc( 100 );
250 Vec_IntForEachEntry( vId2Lit1, Class, i )
251 if ( Class == 0 )
252 Vec_IntPush( vClassC, Abc_ObjDressMakeId(pNtk1, i, 0) );
253 Vec_IntForEachEntry( vId2Lit2, Class, i )
254 if ( Class == 0 )
255 Vec_IntPush( vClassC, Abc_ObjDressMakeId(pNtk2, i, 1) );
256 Vec_PtrPush( vRes, vClassC );
257 // map repr node IDs into class numbers
258 vClass2Num = Vec_IntAlloc( 0 );
259 Vec_IntFill( vClass2Num, Aig_ManObjNumMax(pMiter), -1 );
260 // keep classes having at least one element from pNtk1 and one from pNtk2
261 Vec_IntForEachEntry( vId2Lit1, Class, i )
262 if ( Class > 0 && Vec_IntEntry(vCounts0, Class) && Vec_IntEntry(vCounts1, Class) )
263 Vec_IntPush( Abc_ObjDressClass(vRes, vClass2Num, Class), Abc_ObjDressMakeId(pNtk1, i, 0) );
264 Vec_IntForEachEntry( vId2Lit2, Class, i )
265 if ( Class > 0 && Vec_IntEntry(vCounts0, Class) && Vec_IntEntry(vCounts1, Class) )
266 Vec_IntPush( Abc_ObjDressClass(vRes, vClass2Num, Class), Abc_ObjDressMakeId(pNtk2, i, 1) );
267 // package them accordingly
268 Vec_IntFree( vClass2Num );
269 Vec_IntFree( vCounts0 );
270 Vec_IntFree( vCounts1 );
271 Vec_IntFree( vId2Lit1 );
272 Vec_IntFree( vId2Lit2 );
273 return vRes;
274}
int Abc_ObjDressMakeId(Abc_Ntk_t *pNtk, int ObjId, int iNtk)
Definition abcDress2.c:210
Vec_Int_t * Abc_ObjDressClass(Vec_Ptr_t *vRes, Vec_Int_t *vClass2Num, int Class)
Definition abcDress2.c:183
void Abc_NtkDressMapSetPolarity(Abc_Ntk_t *pNtk)
Definition abcDress2.c:124
Vec_Int_t * Abc_NtkDressMapClasses(Aig_Man_t *pMiter, Abc_Ntk_t *pNtk)
Definition abcDress2.c:147
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDressMapSetPolarity()

void Abc_NtkDressMapSetPolarity ( Abc_Ntk_t * pNtk)

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

Synopsis [Sets polarity attribute of each object in the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 124 of file abcDress2.c.

125{
126 Abc_Obj_t * pObj, * pAnd;
127 int i;
128 // each node refers to the the strash copy whose polarity is set
129 Abc_NtkForEachObj( pNtk, pObj, i )
130 {
131 if ( (pAnd = Abc_ObjRegular(pObj->pCopy)) && Abc_ObjType(pAnd) != ABC_OBJ_NONE ) // strashed object is present and legal
132 pObj->fPhase = pAnd->fPhase ^ Abc_ObjIsComplement(pObj->pCopy);
133 }
134}
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition abc.h:449
unsigned fPhase
Definition abc.h:137
Here is the caller graph for this function:

◆ Abc_NtkDressPrintEquivs()

void Abc_NtkDressPrintEquivs ( Vec_Ptr_t * vRes)

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

Synopsis [Prints information about node equivalences.]

Description []

SideEffects []

SeeAlso []

Definition at line 360 of file abcDress2.c.

361{
362 Vec_Int_t * vClass;
363 int i, k, Entry;
364 Vec_PtrForEachEntry( Vec_Int_t *, vRes, vClass, i )
365 {
366 printf( "Class %5d : ", i );
367 printf( "Num =%5d ", Vec_IntSize(vClass) );
368 Vec_IntForEachEntry( vClass, Entry, k )
369 printf( "%5d%c%d ",
370 Abc_ObjEquivId2ObjId(Entry),
371 Abc_ObjEquivId2Polar(Entry)? '-':'+',
372 Abc_ObjEquivId2NtkId(Entry) );
373 printf( "\n" );
374 }
375}
Here is the call graph for this function:

◆ Abc_NtkDressPrintStats()

void Abc_NtkDressPrintStats ( Vec_Ptr_t * vRes,
int nNodes0,
int nNodes1,
abctime Time )

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

Synopsis [Prints information about node equivalences.]

Description []

SideEffects []

SeeAlso []

Definition at line 388 of file abcDress2.c.

389{
390 Vec_Int_t * vClass;
391 int i, k, Entry;
392 int NegAll[2] = {0}, PosAll[2] = {0}, PairsAll = 0, PairsOne = 0;
393 int Pos[2], Neg[2];
394 // count the number of equivalences in each class
395 Vec_PtrForEachEntry( Vec_Int_t *, vRes, vClass, i )
396 {
397 Pos[0] = Pos[1] = 0;
398 Neg[0] = Neg[1] = 0;
399 Vec_IntForEachEntry( vClass, Entry, k )
400 {
401 if ( Abc_ObjEquivId2NtkId(Entry) )
402 {
403 if ( Abc_ObjEquivId2Polar(Entry) )
404 Neg[1]++; // negative polarity in network 1
405 else
406 Pos[1]++; // positive polarity in network 1
407 }
408 else
409 {
410 if ( Abc_ObjEquivId2Polar(Entry) )
411 Neg[0]++; // negative polarity in network 0
412 else
413 Pos[0]++; // positive polarity in network 0
414 }
415 }
416 PosAll[0] += Pos[0]; // total positive polarity in network 0
417 PosAll[1] += Pos[1]; // total positive polarity in network 1
418 NegAll[0] += Neg[0]; // total negative polarity in network 0
419 NegAll[1] += Neg[1]; // total negative polarity in network 1
420
421 // assuming that the name can be transferred to only one node
422 PairsAll += Abc_MinInt(Neg[0] + Pos[0], Neg[1] + Pos[1]);
423 PairsOne += Abc_MinInt(Neg[0], Neg[1]) + Abc_MinInt(Pos[0], Pos[1]);
424 }
425 printf( "Total number of equiv classes = %7d.\n", Vec_PtrSize(vRes) );
426 printf( "Participating nodes from both networks = %7d.\n", NegAll[0]+PosAll[0]+NegAll[1]+PosAll[1] );
427 printf( "Participating nodes from the first network = %7d. (%7.2f %% of nodes)\n", NegAll[0]+PosAll[0], 100.0*(NegAll[0]+PosAll[0])/(nNodes0+1) );
428 printf( "Participating nodes from the second network = %7d. (%7.2f %% of nodes)\n", NegAll[1]+PosAll[1], 100.0*(NegAll[1]+PosAll[1])/(nNodes1+1) );
429 printf( "Node pairs (any polarity) = %7d. (%7.2f %% of names can be moved)\n", PairsAll, 100.0*PairsAll/(nNodes0+1) );
430 printf( "Node pairs (same polarity) = %7d. (%7.2f %% of names can be moved)\n", PairsOne, 100.0*PairsOne/(nNodes0+1) );
431 ABC_PRT( "Total runtime", Time );
432}
#define ABC_PRT(a, t)
Definition abc_global.h:255
ush Pos
Definition deflate.h:88
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkToDar()

Aig_Man_t * Abc_NtkToDar ( Abc_Ntk_t * pNtk,
int fExors,
int fRegisters )
extern

DECLARATIONS ///.

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

Synopsis [Converts the network from the AIG manager into ABC.]

Description [Assumes that registers are ordered after PIs/POs.]

SideEffects []

SeeAlso []

Definition at line 237 of file abcDar.c.

238{
239 Vec_Ptr_t * vNodes;
240 Aig_Man_t * pMan;
241 Aig_Obj_t * pObjNew;
242 Abc_Obj_t * pObj;
243 int i, nNodes, nDontCares;
244 // make sure the latches follow PIs/POs
245 if ( fRegisters )
246 {
247 assert( Abc_NtkBoxNum(pNtk) == Abc_NtkLatchNum(pNtk) );
248 Abc_NtkForEachCi( pNtk, pObj, i )
249 if ( i < Abc_NtkPiNum(pNtk) )
250 {
251 assert( Abc_ObjIsPi(pObj) );
252 if ( !Abc_ObjIsPi(pObj) )
253 Abc_Print( 1, "Abc_NtkToDar(): Temporary bug: The PI ordering is wrong!\n" );
254 }
255 else
256 assert( Abc_ObjIsBo(pObj) );
257 Abc_NtkForEachCo( pNtk, pObj, i )
258 if ( i < Abc_NtkPoNum(pNtk) )
259 {
260 assert( Abc_ObjIsPo(pObj) );
261 if ( !Abc_ObjIsPo(pObj) )
262 Abc_Print( 1, "Abc_NtkToDar(): Temporary bug: The PO ordering is wrong!\n" );
263 }
264 else
265 assert( Abc_ObjIsBi(pObj) );
266 // print warning about initial values
267 nDontCares = 0;
268 Abc_NtkForEachLatch( pNtk, pObj, i )
269 if ( Abc_LatchIsInitDc(pObj) )
270 {
271 Abc_LatchSetInit0(pObj);
272 nDontCares++;
273 }
274 if ( nDontCares )
275 {
276 Abc_Print( 1, "Warning: %d registers in this network have don't-care init values.\n", nDontCares );
277 Abc_Print( 1, "The don't-care are assumed to be 0. The result may not verify.\n" );
278 Abc_Print( 1, "Use command \"print_latch\" to see the init values of registers.\n" );
279 Abc_Print( 1, "Use command \"zero\" to convert or \"init\" to change the values.\n" );
280 }
281 }
282 // create the manager
283 pMan = Aig_ManStart( Abc_NtkNodeNum(pNtk) + 100 );
284 pMan->fCatchExor = fExors;
285 pMan->nConstrs = pNtk->nConstrs;
286 pMan->nBarBufs = pNtk->nBarBufs;
287 pMan->pName = Extra_UtilStrsav( pNtk->pName );
288 pMan->pSpec = Extra_UtilStrsav( pNtk->pSpec );
289 // transfer the pointers to the basic nodes
290 Abc_AigConst1(pNtk)->pCopy = (Abc_Obj_t *)Aig_ManConst1(pMan);
291 Abc_NtkForEachCi( pNtk, pObj, i )
292 {
293 pObj->pCopy = (Abc_Obj_t *)Aig_ObjCreateCi(pMan);
294 // initialize logic level of the CIs
295 ((Aig_Obj_t *)pObj->pCopy)->Level = pObj->Level;
296 }
297
298 // complement the 1-values registers
299 if ( fRegisters ) {
300 Abc_NtkForEachLatch( pNtk, pObj, i )
301 if ( Abc_LatchIsInit1(pObj) )
302 Abc_ObjFanout0(pObj)->pCopy = Abc_ObjNot(Abc_ObjFanout0(pObj)->pCopy);
303 }
304 // perform the conversion of the internal nodes (assumes DFS ordering)
305// pMan->fAddStrash = 1;
306 vNodes = Abc_NtkDfs( pNtk, 0 );
307 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
308// Abc_NtkForEachNode( pNtk, pObj, i )
309 {
310 pObj->pCopy = (Abc_Obj_t *)Aig_And( pMan, (Aig_Obj_t *)Abc_ObjChild0Copy(pObj), (Aig_Obj_t *)Abc_ObjChild1Copy(pObj) );
311// Abc_Print( 1, "%d->%d ", pObj->Id, ((Aig_Obj_t *)pObj->pCopy)->Id );
312 }
313 Vec_PtrFree( vNodes );
314 pMan->fAddStrash = 0;
315 // create the POs
316 Abc_NtkForEachCo( pNtk, pObj, i )
317 Aig_ObjCreateCo( pMan, (Aig_Obj_t *)Abc_ObjChild0Copy(pObj) );
318 // complement the 1-valued registers
319 Aig_ManSetRegNum( pMan, Abc_NtkLatchNum(pNtk) );
320 if ( fRegisters )
321 Aig_ManForEachLiSeq( pMan, pObjNew, i )
322 if ( Abc_LatchIsInit1(Abc_ObjFanout0(Abc_NtkCo(pNtk,i))) )
323 pObjNew->pFanin0 = Aig_Not(pObjNew->pFanin0);
324 // remove dangling nodes
325 nNodes = (Abc_NtkGetChoiceNum(pNtk) == 0)? Aig_ManCleanup( pMan ) : 0;
326 if ( !fExors && nNodes )
327 Abc_Print( 1, "Abc_NtkToDar(): Unexpected %d dangling nodes when converting to AIG!\n", nNodes );
328//Aig_ManDumpVerilog( pMan, "test.v" );
329 // save the number of registers
330 if ( fRegisters )
331 {
332 Aig_ManSetRegNum( pMan, Abc_NtkLatchNum(pNtk) );
333 pMan->vFlopNums = Vec_IntStartNatural( pMan->nRegs );
334// pMan->vFlopNums = NULL;
335// pMan->vOnehots = Abc_NtkConverLatchNamesIntoNumbers( pNtk );
336 if ( pNtk->vOnehots )
337 pMan->vOnehots = (Vec_Ptr_t *)Vec_VecDupInt( (Vec_Vec_t *)pNtk->vOnehots );
338 }
339 if ( !Aig_ManCheck( pMan ) )
340 {
341 Abc_Print( 1, "Abc_NtkToDar: AIG check has failed.\n" );
342 Aig_ManStop( pMan );
343 return NULL;
344 }
345 return pMan;
346}
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:463
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition abcAig.c:683
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition aigMan.c:438
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition aig.h:447
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:104
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition aigObj.c:66
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition aigMan.c:47
int Aig_ManCleanup(Aig_Man_t *p)
Definition aigMan.c:265
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigObj.c:45
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition aigCheck.c:45
char * Extra_UtilStrsav(const char *s)
char * pName
Definition abc.h:158
int nBarBufs
Definition abc.h:174
int nConstrs
Definition abc.h:173
Vec_Ptr_t * vOnehots
Definition abc.h:211
char * pSpec
Definition abc.h:159
unsigned Level
Definition abc.h:142
Aig_Obj_t * pFanin0
Definition aig.h:75
unsigned Level
Definition aig.h:82
Here is the caller graph for this function:

◆ Abc_ObjDressClass()

Vec_Int_t * Abc_ObjDressClass ( Vec_Ptr_t * vRes,
Vec_Int_t * vClass2Num,
int Class )

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

Synopsis [Returns the vector of given equivalence class of objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 183 of file abcDress2.c.

184{
185 int ClassNumber;
186 assert( Class > 0 );
187 ClassNumber = Vec_IntEntry( vClass2Num, Class );
188 assert( ClassNumber != 0 );
189 if ( ClassNumber > 0 )
190 return (Vec_Int_t *)Vec_PtrEntry( vRes, ClassNumber ); // previous class
191 // create new class
192 Vec_IntWriteEntry( vClass2Num, Class, Vec_PtrSize(vRes) );
193 Vec_PtrPush( vRes, Vec_IntAlloc(4) );
194 return (Vec_Int_t *)Vec_PtrEntryLast( vRes );
195}
Here is the caller graph for this function:

◆ Abc_ObjDressMakeId()

int Abc_ObjDressMakeId ( Abc_Ntk_t * pNtk,
int ObjId,
int iNtk )

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

Synopsis [Returns the ID of a node in an equivalence class.]

Description [The ID is composed of three parts: object ID, followed by one bit telling the phase of this node, followed by one bit telling the network to which this node belongs.]

SideEffects []

SeeAlso []

Definition at line 210 of file abcDress2.c.

211{
212 return (ObjId << 2) | (Abc_NtkObj(pNtk,ObjId)->fPhase << 1) | iNtk;
213}
Here is the caller graph for this function:

◆ Abc_ObjEquivId2NtkId()

int Abc_ObjEquivId2NtkId ( int EquivId)
extern

Definition at line 59 of file abcDress2.c.

59{ return EquivId & 1; }
Here is the caller graph for this function:

◆ Abc_ObjEquivId2ObjId()

int Abc_ObjEquivId2ObjId ( int EquivId)
extern

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

FileName [abcDressw.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Transfers names from one netlist to the other.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
abcDressw.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 57 of file abcDress2.c.

57{ return EquivId >> 2; }
Here is the caller graph for this function:

◆ Abc_ObjEquivId2Polar()

int Abc_ObjEquivId2Polar ( int EquivId)
extern

Definition at line 58 of file abcDress2.c.

58{ return (EquivId >> 1) & 1; }
Here is the caller graph for this function:

◆ Aig_ManCreateDualOutputMiter()

Aig_Man_t * Aig_ManCreateDualOutputMiter ( Aig_Man_t * p1,
Aig_Man_t * p2 )

FUNCTION DEFINITIONS ///.

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

Synopsis [Creates the dual-output miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 83 of file abcDress2.c.

84{
85 Aig_Man_t * pNew;
86 Aig_Obj_t * pObj;
87 int i;
88 assert( Aig_ManCiNum(p1) == Aig_ManCiNum(p2) );
89 assert( Aig_ManCoNum(p1) == Aig_ManCoNum(p2) );
90 pNew = Aig_ManStart( Aig_ManObjNumMax(p1) + Aig_ManObjNumMax(p2) );
91 // add first AIG
92 Aig_ManConst1(p1)->pData = Aig_ManConst1(pNew);
93 Aig_ManForEachCi( p1, pObj, i )
94 pObj->pData = Aig_ObjCreateCi( pNew );
95 Aig_ManForEachNode( p1, pObj, i )
96 pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
97 // add second AIG
98 Aig_ManConst1(p2)->pData = Aig_ManConst1(pNew);
99 Aig_ManForEachCi( p2, pObj, i )
100 pObj->pData = Aig_ManCi( pNew, i );
101 Aig_ManForEachNode( p2, pObj, i )
102 pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
103 // add the outputs
104 for ( i = 0; i < Aig_ManCoNum(p1); i++ )
105 {
106 Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(Aig_ManCo(p1, i)) );
107 Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(Aig_ManCo(p2, i)) );
108 }
109 Aig_ManCleanup( pNew );
110 return pNew;
111}
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dch_ComputeEquivalences()

void Dch_ComputeEquivalences ( Aig_Man_t * pAig,
Dch_Pars_t * pPars )
extern

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

Synopsis [Performs computation of AIGs with choices.]

Description [Takes several AIGs and performs choicing.]

SideEffects []

SeeAlso []

Definition at line 136 of file dchCore.c.

137{
138 Dch_Man_t * p;
139 abctime clk, clkTotal = Abc_Clock();
140 // reset random numbers
141 Aig_ManRandom(1);
142 // start the choicing manager
143 p = Dch_ManCreate( pAig, pPars );
144 // compute candidate equivalence classes
145clk = Abc_Clock();
146 p->ppClasses = Dch_CreateCandEquivClasses( pAig, pPars->nWords, pPars->fVerbose );
147p->timeSimInit = Abc_Clock() - clk;
148// Dch_ClassesPrint( p->ppClasses, 0 );
149 p->nLits = Dch_ClassesLitNum( p->ppClasses );
150 // perform SAT sweeping
151 Dch_ManSweep( p );
152 // free memory ahead of time
153p->timeTotal = Abc_Clock() - clkTotal;
154 Dch_ManStop( p );
155}
unsigned Aig_ManRandom(int fReset)
Definition aigUtil.c:1170
int Dch_ClassesLitNum(Dch_Cla_t *p)
Definition dchClass.c:206
Dch_Man_t * Dch_ManCreate(Aig_Man_t *pAig, Dch_Pars_t *pPars)
DECLARATIONS ///.
Definition dchMan.c:45
struct Dch_Man_t_ Dch_Man_t
Definition dchInt.h:50
void Dch_ManStop(Dch_Man_t *p)
Definition dchMan.c:122
void Dch_ManSweep(Dch_Man_t *p)
Definition dchSweep.c:106
Dch_Cla_t * Dch_CreateCandEquivClasses(Aig_Man_t *pAig, int nWords, int fVerbose)
Definition dchSim.c:264
Cube * p
Definition exorList.c:222
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dch_ComputeEquivalences2()

void Dch_ComputeEquivalences2 ( Aig_Man_t * pMiter,
Dch_Pars_t * pPars )

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

Synopsis [Alternative way to compute equivalences.]

Description []

SideEffects []

SeeAlso []

Definition at line 287 of file abcDress2.c.

288{
289 extern Gia_Man_t * Cec4_ManSimulateTest3( Gia_Man_t * p, int nBTLimit, int fVerbose );
290 Gia_Man_t * pGia = Gia_ManFromAigSimple(pMiter);
291 Gia_Man_t * pNew = Cec4_ManSimulateTest3( pGia, pPars->nBTLimit, pPars->fVerbose );
292 int i, k;
293 ABC_FREE( pMiter->pReprs );
294 pMiter->pReprs = ABC_CALLOC( Aig_Obj_t *, Aig_ManObjNumMax(pMiter) );
295 Gia_ManForEachClass( pGia, i )
296 Gia_ClassForEachObj1( pGia, i, k )
297 pMiter->pReprs[k] = Aig_ManObj( pMiter, i );
298 Gia_ManStop( pGia );
299 Gia_ManStop( pNew );
300}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
Definition giaAig.c:212
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
#define Gia_ClassForEachObj1(p, i, iObj)
Definition gia.h:1109
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
#define Gia_ManForEachClass(p, i)
Definition gia.h:1101
Gia_Man_t * Cec4_ManSimulateTest3(Gia_Man_t *p, int nBTLimit, int fVerbose)
Definition cecSatG2.c:2077
Here is the call graph for this function:
Here is the caller graph for this function: