ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
rewire_map.c File Reference
#include "rewire_map.h"
Include dependency graph for rewire_map.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START Abc_Ntk_tAbc_NtkFromAigPhase (Aig_Man_t *pMan)
 DECLARATIONS ///.
 
Abc_Ntk_tAbc_NtkDarAmap (Abc_Ntk_t *pNtk, Amap_Par_t *pPars)
 
void * Abc_FrameReadLibGen2 ()
 
Vec_Int_tAbc_NtkWriteMiniMapping (Abc_Ntk_t *pNtk)
 
void Abc_NtkPrintMiniMapping (int *pArray)
 
Abc_Ntk_tAbc_NtkFromMiniMapping (int *vMapping)
 
Mini_Aig_tAbc_MiniAigFromNtk (Abc_Ntk_t *pNtk)
 
void Nf_ManSetDefaultPars (Jf_Par_t *pPars)
 
Gia_Man_tNf_ManPerformMapping (Gia_Man_t *pGia, Jf_Par_t *pPars)
 
Abc_Ntk_tAbc_NtkFromMappedGia (Gia_Man_t *p, int fFindEnables, int fUseBuffs)
 
Abc_Ntk_tAbc_NtkFromCellMappedGia (Gia_Man_t *p, int fUseBuffs)
 
int Gia_ManSimpleMapping (Gia_Man_t *p, int nBound, int Seed, int nBTLimit, int nTimeout, int fVerbose, int fKeepFile, int argc, char **argv)
 
Abc_Ntk_tGia_ManRewirePut (Gia_Man_t *pGia)
 
Abc_Ntk_tAbc_ManRewireMapAmap (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tGia_ManRewireMapNf (Gia_Man_t *pGia)
 
Abc_Ntk_tGia_ManRewireMapSimap (Gia_Man_t *pGia, int nBound, int nBTLimit, int nTimeout)
 
Vec_Int_tAbc_ManRewireNtkWriteMiniMapping (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_ManRewireNtkFromMiniMapping (int *vMapping)
 
Mini_Aig_tAbc_ManRewireMiniAigFromNtk (Abc_Ntk_t *pNtk)
 

Function Documentation

◆ Abc_FrameReadLibGen2()

void * Abc_FrameReadLibGen2 ( )
extern

Definition at line 60 of file mainFrame.c.

60{ return s_GlobalFrame->pLibGen2; }

◆ Abc_ManRewireMapAmap()

Abc_Ntk_t * Abc_ManRewireMapAmap ( Abc_Ntk_t * pNtk)

Definition at line 46 of file rewire_map.c.

46 {
47 Amap_Par_t Pars, *pPars = &Pars;
49 Abc_Ntk_t *pNtkMapped = Abc_NtkDarAmap(pNtk, pPars);
50 if (pNtkMapped == NULL) {
51 Abc_Print(-1, "Mapping has failed.\n");
52 return NULL;
53 }
54 return pNtkMapped;
55}
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
void Amap_ManSetDefaultParams(Amap_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition amapCore.c:46
struct Amap_Par_t_ Amap_Par_t
Definition amap.h:44
Abc_Ntk_t * Abc_NtkDarAmap(Abc_Ntk_t *pNtk, Amap_Par_t *pPars)
Definition abcDar.c:4558
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ManRewireMiniAigFromNtk()

Mini_Aig_t * Abc_ManRewireMiniAigFromNtk ( Abc_Ntk_t * pNtk)

Definition at line 86 of file rewire_map.c.

86 {
87 return Abc_MiniAigFromNtk(pNtk);
88}
Mini_Aig_t * Abc_MiniAigFromNtk(Abc_Ntk_t *pNtk)
Definition abcMini.c:147
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ManRewireNtkFromMiniMapping()

Abc_Ntk_t * Abc_ManRewireNtkFromMiniMapping ( int * vMapping)

Definition at line 82 of file rewire_map.c.

82 {
83 return Abc_NtkFromMiniMapping(vMapping);
84}
Abc_Ntk_t * Abc_NtkFromMiniMapping(int *vMapping)
Definition abcMap.c:907
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ManRewireNtkWriteMiniMapping()

Vec_Int_t * Abc_ManRewireNtkWriteMiniMapping ( Abc_Ntk_t * pNtk)

Definition at line 78 of file rewire_map.c.

78 {
79 return Abc_NtkWriteMiniMapping(pNtk);
80}
Vec_Int_t * Abc_NtkWriteMiniMapping(Abc_Ntk_t *pNtk)
Definition abcMap.c:834
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_MiniAigFromNtk()

Mini_Aig_t * Abc_MiniAigFromNtk ( Abc_Ntk_t * pNtk)
extern

Definition at line 147 of file abcMini.c.

148{
149 Abc_Ntk_t *pNtkRes = NULL;
150 Mini_Aig_t *pAig;
151 if (!Abc_NtkIsStrash(pNtk)) {
152 pNtk = pNtkRes = Abc_NtkStrash( pNtk, 0, 1, 0 );
153 if ( pNtkRes == NULL )
154 {
155 printf("Strashing has failed.\n" );
156 return NULL;
157 }
158 }
159 pAig = Abc_NtkToMiniAig(pNtk);
160 if (pNtkRes) Abc_NtkDelete(pNtkRes);
161 return pAig;
162}
Mini_Aig_t * Abc_NtkToMiniAig(Abc_Ntk_t *pNtk)
Definition abcMini.c:123
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
struct Mini_Aig_t_ Mini_Aig_t
BASIC TYPES ///.
Definition miniaig.h:48
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDarAmap()

Abc_Ntk_t * Abc_NtkDarAmap ( Abc_Ntk_t * pNtk,
Amap_Par_t * pPars )
extern

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

Synopsis [Gives the current ABC network to AIG manager for processing.]

Description []

SideEffects []

SeeAlso []

Definition at line 4558 of file abcDar.c.

4559{
4560 extern Vec_Ptr_t * Amap_ManTest( Aig_Man_t * pAig, Amap_Par_t * pPars );
4561 Vec_Ptr_t * vMapping;
4562 Abc_Ntk_t * pNtkAig = NULL;
4563 Aig_Man_t * pMan;
4564 Aig_MmFlex_t * pMem;
4565
4566 assert( Abc_NtkIsStrash(pNtk) );
4567 // convert to the AIG manager
4568 pMan = Abc_NtkToDarChoices( pNtk );
4569 if ( pMan == NULL )
4570 return NULL;
4571
4572 // perform computation
4573 vMapping = Amap_ManTest( pMan, pPars );
4574 Aig_ManStop( pMan );
4575 if ( vMapping == NULL )
4576 return NULL;
4577 pMem = (Aig_MmFlex_t *)Vec_PtrPop( vMapping );
4578 pNtkAig = Amap_ManProduceNetwork( pNtk, vMapping );
4579 Aig_MmFlexStop( pMem, 0 );
4580 Vec_PtrFree( vMapping );
4581
4582 // make sure everything is okay
4583 if ( pNtkAig && !Abc_NtkCheck( pNtkAig ) )
4584 {
4585 Abc_Print( 1, "Abc_NtkDar: The network check has failed.\n" );
4586 Abc_NtkDelete( pNtkAig );
4587 return NULL;
4588 }
4589 return pNtkAig;
4590}
Aig_Man_t * Abc_NtkToDarChoices(Abc_Ntk_t *pNtk)
Definition abcDar.c:359
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Amap_ManProduceNetwork(Abc_Ntk_t *pNtk, Vec_Ptr_t *vMapping)
Definition abcDar.c:4498
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
Definition aigMem.c:337
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
struct Aig_MmFlex_t_ Aig_MmFlex_t
Definition aig.h:53
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
Vec_Ptr_t * Amap_ManTest(Aig_Man_t *pAig, Amap_Par_t *pPars)
Definition amapCore.c:70
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkFromAigPhase()

ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkFromAigPhase ( Aig_Man_t * pMan)
extern

DECLARATIONS ///.

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

FileName [rewire_map.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Re-wiring.]

Synopsis []

Author [Jiun-Hao Chen]

Affiliation [National Taiwan University]

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

Revision [

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

]

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

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

Description [This procedure should be called after seq sweeping, which changes the number of registers.]

SideEffects []

SeeAlso []

Definition at line 595 of file abcDar.c.

596{
597 Vec_Ptr_t * vNodes;
598 Abc_Ntk_t * pNtkNew;
599 Abc_Obj_t * pObjNew;
600 Aig_Obj_t * pObj, * pObjLo, * pObjLi;
601 int i;
602 assert( pMan->nAsserts == 0 );
603 // perform strashing
605 pNtkNew->nConstrs = pMan->nConstrs;
606 pNtkNew->nBarBufs = pMan->nBarBufs;
607 // duplicate the name and the spec
608// pNtkNew->pName = Extra_UtilStrsav(pMan->pName);
609// pNtkNew->pSpec = Extra_UtilStrsav(pMan->pSpec);
610 Aig_ManConst1(pMan)->pData = Abc_AigConst1(pNtkNew);
611 // create PIs
612 Aig_ManForEachPiSeq( pMan, pObj, i )
613 {
614 pObjNew = Abc_NtkCreatePi( pNtkNew );
615// Abc_ObjAssignName( pObjNew, Abc_ObjName(pObjNew), NULL );
616 pObj->pData = pObjNew;
617 }
618 // create POs
619 Aig_ManForEachPoSeq( pMan, pObj, i )
620 {
621 pObjNew = Abc_NtkCreatePo( pNtkNew );
622// Abc_ObjAssignName( pObjNew, Abc_ObjName(pObjNew), NULL );
623 pObj->pData = pObjNew;
624 }
625 assert( Abc_NtkCiNum(pNtkNew) == Aig_ManCiNum(pMan) - Aig_ManRegNum(pMan) );
626 assert( Abc_NtkCoNum(pNtkNew) == Aig_ManCoNum(pMan) - Aig_ManRegNum(pMan) );
627 // create as many latches as there are registers in the manager
628 Aig_ManForEachLiLoSeq( pMan, pObjLi, pObjLo, i )
629 {
630 pObjNew = Abc_NtkCreateLatch( pNtkNew );
631 pObjLi->pData = Abc_NtkCreateBi( pNtkNew );
632 pObjLo->pData = Abc_NtkCreateBo( pNtkNew );
633 Abc_ObjAddFanin( pObjNew, (Abc_Obj_t *)pObjLi->pData );
634 Abc_ObjAddFanin( (Abc_Obj_t *)pObjLo->pData, pObjNew );
635 Abc_LatchSetInit0( pObjNew );
636// Abc_ObjAssignName( (Abc_Obj_t *)pObjLi->pData, Abc_ObjName((Abc_Obj_t *)pObjLi->pData), NULL );
637// Abc_ObjAssignName( (Abc_Obj_t *)pObjLo->pData, Abc_ObjName((Abc_Obj_t *)pObjLo->pData), NULL );
638 }
639 // rebuild the AIG
640 vNodes = Aig_ManDfs( pMan, 1 );
641 Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
642 if ( Aig_ObjIsBuf(pObj) )
643 pObj->pData = (Abc_Obj_t *)Aig_ObjChild0Copy(pObj);
644 else
645 pObj->pData = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, (Abc_Obj_t *)Aig_ObjChild0Copy(pObj), (Abc_Obj_t *)Aig_ObjChild1Copy(pObj) );
646 Vec_PtrFree( vNodes );
647 // connect the PO nodes
648 Aig_ManForEachCo( pMan, pObj, i )
649 {
650 pObjNew = (Abc_Obj_t *)Aig_ObjChild0Copy(pObj);
651 Abc_ObjAddFanin( Abc_NtkCo(pNtkNew, i), pObjNew );
652 }
653
654 Abc_NtkAddDummyPiNames( pNtkNew );
655 Abc_NtkAddDummyPoNames( pNtkNew );
656 Abc_NtkAddDummyBoxNames( pNtkNew );
657
658 // check the resulting AIG
659 if ( !Abc_NtkCheck( pNtkNew ) )
660 Abc_Print( 1, "Abc_NtkFromAigPhase(): Network check has failed.\n" );
661 return pNtkNew;
662}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition abcNtk.c:53
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:84
ABC_DLL void Abc_NtkAddDummyBoxNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:547
struct Abc_Aig_t_ Abc_Aig_t
Definition abc.h:117
@ ABC_NTK_STRASH
Definition abc.h:58
ABC_DLL void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:521
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition abcAig.c:700
@ ABC_FUNC_AIG
Definition abc.h:67
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition abcAig.c:683
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:495
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition aig.h:438
#define Aig_ManForEachCo(p, pObj, i)
Definition aig.h:398
Vec_Ptr_t * Aig_ManDfs(Aig_Man_t *p, int fNodesOnly)
Definition aigDfs.c:145
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition aig.h:444
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition aig.h:450
int nBarBufs
Definition abc.h:174
int nConstrs
Definition abc.h:173
void * pManFunc
Definition abc.h:191
void * pData
Definition aig.h:87
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the caller graph for this function:

◆ Abc_NtkFromCellMappedGia()

Abc_Ntk_t * Abc_NtkFromCellMappedGia ( Gia_Man_t * p,
int fUseBuffs )
extern

Definition at line 967 of file abcDar.c.

968{
969 int fFixDrivers = 1;
970 int fVerbose = 0;
971 Abc_Ntk_t * pNtkNew;
972 Vec_Int_t * vCopyLits;
973 Abc_Obj_t * pObjNew, * pObjNewLi, * pObjNewLo;
974 Gia_Obj_t * pObj, * pObjLi, * pObjLo;
975 int i, k, iLit, iFanLit, nCells, fNeedConst[2] = {0};
976 Mio_Cell2_t * pCells = Mio_CollectRootsNewDefault2( 6, &nCells, 0 );
977 assert( Gia_ManHasCellMapping(p) );
978 // start network
979 pNtkNew = Abc_NtkAlloc( ABC_NTK_LOGIC, ABC_FUNC_MAP, 1 );
980 pNtkNew->pName = Extra_UtilStrsav(p->pName);
981 pNtkNew->pSpec = Extra_UtilStrsav(p->pSpec);
982 assert( pNtkNew->pManFunc == Abc_FrameReadLibGen() );
983 vCopyLits = Vec_IntStartFull( 2*Gia_ManObjNum(p) );
984 // create PIs
985 Gia_ManForEachPi( p, pObj, i )
986 Abc_NtkFromCellWrite( vCopyLits, Gia_ObjId(p, pObj), 0, Abc_ObjId( Abc_NtkCreatePi( pNtkNew ) ) );
987 // create POs
988 Gia_ManForEachPo( p, pObj, i )
989 Abc_NtkFromCellWrite( vCopyLits, Gia_ObjId(p, pObj), 0, Abc_ObjId( Abc_NtkCreatePo( pNtkNew ) ) );
990 // create as many latches as there are registers in the manager
991 Gia_ManForEachRiRo( p, pObjLi, pObjLo, i )
992 {
993 pObjNew = Abc_NtkCreateLatch( pNtkNew );
994 pObjNewLi = Abc_NtkCreateBi( pNtkNew );
995 pObjNewLo = Abc_NtkCreateBo( pNtkNew );
996 Abc_ObjAddFanin( pObjNew, pObjNewLi );
997 Abc_ObjAddFanin( pObjNewLo, pObjNew );
998// pObjLi->Value = Abc_ObjId( pObjNewLi );
999// pObjLo->Value = Abc_ObjId( pObjNewLo );
1000 Abc_NtkFromCellWrite( vCopyLits, Gia_ObjId(p, pObjLi), 0, Abc_ObjId( pObjNewLi ) );
1001 Abc_NtkFromCellWrite( vCopyLits, Gia_ObjId(p, pObjLo), 0, Abc_ObjId( pObjNewLo ) );
1002 Abc_LatchSetInit0( pObjNew );
1003 }
1004
1005 // create constants
1006 Gia_ManForEachCo( p, pObj, i )
1007 if ( Gia_ObjFaninId0p(p, pObj) == 0 )
1008 fNeedConst[Gia_ObjFaninC0(pObj)] = 1;
1009 Gia_ManForEachBuf( p, pObj, i )
1010 if ( Gia_ObjFaninId0p(p, pObj) == 0 )
1011 fNeedConst[Gia_ObjFaninC0(pObj)] = 1;
1012 if ( fNeedConst[0] )
1013 Abc_NtkFromCellWrite( vCopyLits, 0, 0, Abc_ObjId(Abc_NtkCreateNodeConst0(pNtkNew)) );
1014 if ( fNeedConst[1] )
1015 Abc_NtkFromCellWrite( vCopyLits, 0, 1, Abc_ObjId(Abc_NtkCreateNodeConst1(pNtkNew)) );
1016
1017 // rebuild the AIG
1018 Gia_ManForEachCell( p, iLit )
1019 {
1020 int fSkip = 0;
1021 if ( Gia_ObjIsCellBuf(p, iLit) )
1022 {
1023 assert( !Abc_LitIsCompl(iLit) );
1024 // build buffer
1025 pObjNew = Abc_NtkCreateNode( pNtkNew );
1026 iFanLit = Gia_ObjFaninLit0p( p, Gia_ManObj(p, Abc_Lit2Var(iLit)) );
1027 Abc_ObjAddFanin( pObjNew, Abc_NtkFromCellRead(pNtkNew, vCopyLits, Abc_Lit2Var(iFanLit), Abc_LitIsCompl(iFanLit)) );
1028 pObjNew->pData = NULL; // barrier buffer
1029 assert( Abc_ObjIsBarBuf(pObjNew) );
1030 pNtkNew->nBarBufs2++;
1031 }
1032 else if ( Gia_ObjIsCellInv(p, iLit) )
1033 {
1034 int iLitNot = Abc_LitNot(iLit);
1035 if ( !Abc_LitIsCompl(iLit) ) // positive phase
1036 {
1037 // build negative phase
1038 assert( Vec_IntEntry(vCopyLits, iLitNot) == -1 );
1039 assert( Gia_ObjCellId(p, iLitNot) > 0 );
1040 pObjNew = Abc_NtkCreateNode( pNtkNew );
1041 Gia_CellForEachFanin( p, iLitNot, iFanLit, k )
1042 Abc_ObjAddFanin( pObjNew, Abc_NtkFromCellRead(pNtkNew, vCopyLits, Abc_Lit2Var(iFanLit), Abc_LitIsCompl(iFanLit)) );
1043 pObjNew->pData = Mio_LibraryReadGateByName( (Mio_Library_t *)pNtkNew->pManFunc, pCells[Gia_ObjCellId(p, iLitNot)].pName, NULL );
1044 Abc_NtkFromCellWrite( vCopyLits, Abc_Lit2Var(iLitNot), Abc_LitIsCompl(iLitNot), Abc_ObjId(pObjNew) );
1045 fSkip = 1;
1046 }
1047 else // negative phase
1048 {
1049 // positive phase is available
1050 assert( Vec_IntEntry(vCopyLits, iLitNot) != -1 );
1051 }
1052 // build inverter
1053 pObjNew = Abc_NtkCreateNode( pNtkNew );
1054 Abc_ObjAddFanin( pObjNew, Abc_NtkFromCellRead(pNtkNew, vCopyLits, Abc_Lit2Var(iLit), Abc_LitIsCompl(iLitNot)) );
1055 pObjNew->pData = Mio_LibraryReadGateByName( (Mio_Library_t *)pNtkNew->pManFunc, pCells[3].pName, NULL );
1056 }
1057 else
1058 {
1059 assert( Gia_ObjCellId(p, iLit) >= 0 );
1060 pObjNew = Abc_NtkCreateNode( pNtkNew );
1061 Gia_CellForEachFanin( p, iLit, iFanLit, k )
1062 Abc_ObjAddFanin( pObjNew, Abc_NtkFromCellRead(pNtkNew, vCopyLits, Abc_Lit2Var(iFanLit), Abc_LitIsCompl(iFanLit)) );
1063 pObjNew->pData = Mio_LibraryReadGateByName( (Mio_Library_t *)pNtkNew->pManFunc, pCells[Gia_ObjCellId(p, iLit)].pName, NULL );
1064 }
1065 assert( Vec_IntEntry(vCopyLits, iLit) == -1 );
1066 Abc_NtkFromCellWrite( vCopyLits, Abc_Lit2Var(iLit), Abc_LitIsCompl(iLit), Abc_ObjId(pObjNew) );
1067 // skip next
1068 iLit += fSkip;
1069 }
1070
1071 // connect the PO nodes
1072 Gia_ManForEachCo( p, pObj, i )
1073 {
1074 pObjNew = Abc_NtkFromCellRead( pNtkNew, vCopyLits, Gia_ObjFaninId0p(p, pObj), Gia_ObjFaninC0(pObj) );
1075 Abc_ObjAddFanin( Abc_NtkCo(pNtkNew, i), pObjNew );
1076 }
1077 // create names
1078 Abc_NtkAddDummyPiNames( pNtkNew );
1079 Abc_NtkAddDummyPoNames( pNtkNew );
1080 Abc_NtkAddDummyBoxNames( pNtkNew );
1081
1082 // decouple the PO driver nodes to reduce the number of levels
1083 if ( fFixDrivers )
1084 {
1085 int nDupGates = Abc_NtkLogicMakeSimpleCos( pNtkNew, !fUseBuffs );
1086 if ( fVerbose && nDupGates && !Abc_FrameReadFlag("silentmode") )
1087 {
1088 if ( fUseBuffs )
1089 printf( "Added %d buffers/inverters to decouple the CO drivers.\n", nDupGates );
1090 else
1091 printf( "Duplicated %d gates to decouple the CO drivers.\n", nDupGates );
1092 }
1093 }
1094
1095 assert( Gia_ManPiNum(p) == Abc_NtkPiNum(pNtkNew) );
1096 assert( Gia_ManPoNum(p) == Abc_NtkPoNum(pNtkNew) );
1097 assert( Gia_ManRegNum(p) == Abc_NtkLatchNum(pNtkNew) );
1098 Vec_IntFree( vCopyLits );
1099 ABC_FREE( pCells );
1100
1101 // check the resulting AIG
1102 if ( !Abc_NtkCheck( pNtkNew ) )
1103 Abc_Print( 1, "Abc_NtkFromMappedGia(): Network check has failed.\n" );
1104 return pNtkNew;
1105}
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition abcObj.c:643
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst0(Abc_Ntk_t *pNtk)
Definition abcObj.c:612
@ ABC_NTK_LOGIC
Definition abc.h:57
ABC_DLL int Abc_NtkLogicMakeSimpleCos(Abc_Ntk_t *pNtk, int fDuplicate)
Definition abcUtil.c:1080
@ ABC_FUNC_MAP
Definition abc.h:68
#define ABC_FREE(obj)
Definition abc_global.h:267
ABC_DLL char * Abc_FrameReadFlag(char *pFlag)
Definition mainFrame.c:69
ABC_DLL void * Abc_FrameReadLibGen()
Definition mainFrame.c:59
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
char * Extra_UtilStrsav(const char *s)
#define Gia_ManForEachBuf(p, pObj, i)
Definition gia.h:1210
#define Gia_ManForEachPo(p, pObj, i)
Definition gia.h:1250
#define Gia_ManForEachCell(p, i)
Definition gia.h:1181
#define Gia_ManForEachPi(p, pObj, i)
Definition gia.h:1248
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition gia.h:1256
#define Gia_CellForEachFanin(p, i, iFanLit, k)
Definition gia.h:1183
struct Mio_LibraryStruct_t_ Mio_Library_t
Definition mio.h:42
Mio_Cell2_t * Mio_CollectRootsNewDefault2(int nInputs, int *pnGates, int fVerbose)
Definition mioUtils.c:877
Mio_Gate_t * Mio_LibraryReadGateByName(Mio_Library_t *pLib, char *pName, char *pOutName)
Definition mioApi.c:105
struct Mio_Cell2_t_ Mio_Cell2_t
Definition mio.h:57
char * pName
Definition abc.h:158
char * pSpec
Definition abc.h:159
int nBarBufs2
Definition abc.h:175
void * pData
Definition abc.h:145
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkFromMappedGia()

Abc_Ntk_t * Abc_NtkFromMappedGia ( Gia_Man_t * p,
int fFindEnables,
int fUseBuffs )
extern

Definition at line 768 of file abcDar.c.

769{
770 int fVerbose = 0;
771 int fDuplicate = 0;
772 Abc_Ntk_t * pNtkNew;
773 Abc_Obj_t * pObjNew, * pObjNewLi, * pObjNewLo, * pConst0 = NULL;
774 Gia_Obj_t * pObj, * pObjLi, * pObjLo;
775 Vec_Ptr_t * vReflect;
776 int i, k, iFan, nDupGates, nCountMux = 0;
777 assert( Gia_ManHasMapping(p) || p->pMuxes || fFindEnables );
778 assert( !fFindEnables || !p->pMuxes );
779 pNtkNew = Abc_NtkAlloc( ABC_NTK_LOGIC, Gia_ManHasMapping(p) ? ABC_FUNC_AIG : ABC_FUNC_SOP, 1 );
780 // duplicate the name and the spec
781 pNtkNew->pName = Extra_UtilStrsav(p->pName);
782 pNtkNew->pSpec = Extra_UtilStrsav(p->pSpec);
784 // create constant
785 pConst0 = Abc_NtkCreateNodeConst0( pNtkNew );
786 Gia_ManConst0(p)->Value = Abc_ObjId(pConst0);
787 // create PIs
788 Gia_ManForEachPi( p, pObj, i )
789 pObj->Value = Abc_ObjId( Abc_NtkCreatePi( pNtkNew ) );
790 // create POs
791 Gia_ManForEachPo( p, pObj, i )
792 pObj->Value = Abc_ObjId( Abc_NtkCreatePo( pNtkNew ) );
793 // create as many latches as there are registers in the manager
794 Gia_ManForEachRiRo( p, pObjLi, pObjLo, i )
795 {
796 pObjNew = Abc_NtkCreateLatch( pNtkNew );
797 pObjNewLi = Abc_NtkCreateBi( pNtkNew );
798 pObjNewLo = Abc_NtkCreateBo( pNtkNew );
799 Abc_ObjAddFanin( pObjNew, pObjNewLi );
800 Abc_ObjAddFanin( pObjNewLo, pObjNew );
801 pObjLi->Value = Abc_ObjId( pObjNewLi );
802 pObjLo->Value = Abc_ObjId( pObjNewLo );
803 Abc_LatchSetInit0( pObjNew );
804 }
805 // rebuild the AIG
806 if ( fFindEnables )
807 {
808 Gia_ManForEachCo( p, pObj, i )
809 {
810 pObjNew = NULL;
811 if ( Gia_ObjIsRi(p, pObj) && Gia_ObjIsMuxType(Gia_ObjFanin0(pObj)) )
812 {
813 int iObjRo = Gia_ObjRiToRoId( p, Gia_ObjId(p, pObj) );
814 int iLitE, iLitT, iCtrl = Gia_ObjRecognizeMuxLits( p, Gia_ObjFanin0(pObj), &iLitT, &iLitE );
815 iLitE = Abc_LitNotCond( iLitE, Gia_ObjFaninC0(pObj) );
816 iLitT = Abc_LitNotCond( iLitT, Gia_ObjFaninC0(pObj) );
817 if ( Abc_Lit2Var(iLitT) == iObjRo )
818 {
819 int iTemp = iLitE;
820 iLitE = iLitT;
821 iLitT = iTemp;
822 iCtrl = Abc_LitNot( iCtrl );
823 }
824 if ( Abc_Lit2Var(iLitE) == iObjRo )
825 {
826 Abc_Obj_t * pObjCtrl = Abc_NtkFromMappedGia_rec( pNtkNew, p, Abc_Lit2Var(iCtrl), Abc_LitIsCompl(iCtrl) );
827 Abc_Obj_t * pObjNodeT = Abc_NtkFromMappedGia_rec( pNtkNew, p, Abc_Lit2Var(iLitT), Abc_LitIsCompl(iLitT) );
828 Abc_Obj_t * pObjNodeE = Abc_NtkFromMappedGia_rec( pNtkNew, p, Abc_Lit2Var(iLitE), Abc_LitIsCompl(iLitE) );
829 pObjNew = Abc_NtkCreateNode( pNtkNew );
830 Abc_ObjAddFanin( pObjNew, pObjCtrl );
831 Abc_ObjAddFanin( pObjNew, pObjNodeT );
832 Abc_ObjAddFanin( pObjNew, pObjNodeE );
833 pObjNew->pData = Abc_SopCreateMux( (Mem_Flex_t *)pNtkNew->pManFunc );
834 nCountMux++;
835 }
836 }
837 if ( pObjNew == NULL )
838 pObjNew = Abc_NtkFromMappedGia_rec( pNtkNew, p, Gia_ObjFaninId0p(p, pObj), Gia_ObjFaninC0(pObj) );
839 Abc_ObjAddFanin( Abc_NtkCo(pNtkNew, i), pObjNew );
840 }
841 }
842 else if ( p->pMuxes )
843 {
844 Gia_ManForEachAnd( p, pObj, i )
845 {
846 pObjNew = Abc_NtkCreateNode( pNtkNew );
847 if ( Gia_ObjIsMuxId(p, i) )
848 {
849 Abc_ObjAddFanin( pObjNew, Abc_NtkObj(pNtkNew, Gia_ObjValue(Gia_ObjFanin2(p, pObj))) );
850 Abc_ObjAddFanin( pObjNew, Abc_NtkObj(pNtkNew, Gia_ObjValue(Gia_ObjFanin1(pObj))) );
851 Abc_ObjAddFanin( pObjNew, Abc_NtkObj(pNtkNew, Gia_ObjValue(Gia_ObjFanin0(pObj))) );
852 pObjNew->pData = Abc_SopCreateMux( (Mem_Flex_t *)pNtkNew->pManFunc );
853 if ( Gia_ObjFaninC2(p, pObj) ) Abc_SopComplementVar( (char *)pObjNew->pData, 0 );
854 if ( Gia_ObjFaninC1(pObj) ) Abc_SopComplementVar( (char *)pObjNew->pData, 1 );
855 if ( Gia_ObjFaninC0(pObj) ) Abc_SopComplementVar( (char *)pObjNew->pData, 2 );
856 }
857 else if ( Gia_ObjIsXor(pObj) )
858 {
859 Abc_ObjAddFanin( pObjNew, Abc_NtkObj(pNtkNew, Gia_ObjValue(Gia_ObjFanin0(pObj))) );
860 Abc_ObjAddFanin( pObjNew, Abc_NtkObj(pNtkNew, Gia_ObjValue(Gia_ObjFanin1(pObj))) );
861 pObjNew->pData = Abc_SopCreateXor( (Mem_Flex_t *)pNtkNew->pManFunc, 2 );
862 if ( Gia_ObjFaninC0(pObj) ) Abc_SopComplementVar( (char *)pObjNew->pData, 0 );
863 if ( Gia_ObjFaninC1(pObj) ) Abc_SopComplementVar( (char *)pObjNew->pData, 1 );
864 }
865 else
866 {
867 Abc_ObjAddFanin( pObjNew, Abc_NtkObj(pNtkNew, Gia_ObjValue(Gia_ObjFanin0(pObj))) );
868 Abc_ObjAddFanin( pObjNew, Abc_NtkObj(pNtkNew, Gia_ObjValue(Gia_ObjFanin1(pObj))) );
869 pObjNew->pData = Abc_SopCreateAnd( (Mem_Flex_t *)pNtkNew->pManFunc, 2, NULL );
870 if ( Gia_ObjFaninC0(pObj) ) Abc_SopComplementVar( (char *)pObjNew->pData, 0 );
871 if ( Gia_ObjFaninC1(pObj) ) Abc_SopComplementVar( (char *)pObjNew->pData, 1 );
872 }
873 pObj->Value = Abc_ObjId( pObjNew );
874 }
875 }
876 else
877 {
878 vReflect = Vec_PtrStart( Gia_ManObjNum(p) );
879 Gia_ManForEachLut( p, i )
880 {
881 pObj = Gia_ManObj(p, i);
882 assert( pObj->Value == ~0 );
883 if ( Gia_ObjLutSize(p, i) == 0 )
884 {
885 pObj->Value = Abc_ObjId(pConst0);
886 continue;
887 }
888 pObjNew = Abc_NtkCreateNode( pNtkNew );
889 Gia_LutForEachFanin( p, i, iFan, k )
890 Abc_ObjAddFanin( pObjNew, Abc_NtkObj(pNtkNew, Gia_ObjValue(Gia_ManObj(p, iFan))) );
891 pObjNew->pData = Abc_ObjHopFromGia( (Hop_Man_t *)pNtkNew->pManFunc, p, i, vReflect );
892 pObjNew->fPersist = Gia_ObjLutIsMux(p, i) && Gia_ObjLutSize(p, i) == 3;
893 pObj->Value = Abc_ObjId( pObjNew );
894 }
895 Vec_PtrFree( vReflect );
896 }
897 //if ( fFindEnables )
898 // printf( "Extracted %d flop enable signals.\n", nCountMux );
899 // connect the PO nodes
900 if ( !fFindEnables )
901 Gia_ManForEachCo( p, pObj, i )
902 {
903 pObjNew = Abc_NtkObj( pNtkNew, Gia_ObjValue(Gia_ObjFanin0(pObj)) );
904 Abc_ObjAddFanin( Abc_NtkCo(pNtkNew, i), Abc_ObjNotCond( pObjNew, Gia_ObjFaninC0(pObj) ) );
905 }
906 // create names
907 Abc_NtkAddDummyPiNames( pNtkNew );
908 Abc_NtkAddDummyPoNames( pNtkNew );
909 Abc_NtkAddDummyBoxNames( pNtkNew );
910
911 // decouple the PO driver nodes to reduce the number of levels
912 nDupGates = Abc_NtkLogicMakeSimpleCos( pNtkNew, !fUseBuffs );
913 if ( fVerbose && nDupGates && !Abc_FrameReadFlag("silentmode") )
914 {
915 if ( !fDuplicate )
916 printf( "Added %d buffers/inverters to decouple the CO drivers.\n", nDupGates );
917 else
918 printf( "Duplicated %d gates to decouple the CO drivers.\n", nDupGates );
919 }
920 // remove const node if it is not used
921 if ( !Abc_ObjIsNone(pConst0) && Abc_ObjFanoutNum(pConst0) == 0 )
922 Abc_NtkDeleteObj( pConst0 );
923
924 assert( Gia_ManPiNum(p) == Abc_NtkPiNum(pNtkNew) );
925 assert( Gia_ManPoNum(p) == Abc_NtkPoNum(pNtkNew) );
926 assert( Gia_ManRegNum(p) == Abc_NtkLatchNum(pNtkNew) );
927
928 // check the resulting AIG
929 if ( !Abc_NtkCheck( pNtkNew ) )
930 Abc_Print( 1, "Abc_NtkFromMappedGia(): Network check has failed.\n" );
931 return pNtkNew;
932}
Abc_Obj_t * Abc_NtkFromMappedGia_rec(Abc_Ntk_t *pNtkNew, Gia_Man_t *p, int iObj, int fAddInv)
Definition abcDar.c:746
Hop_Obj_t * Abc_ObjHopFromGia(Hop_Man_t *pHopMan, Gia_Man_t *p, int GiaId, Vec_Ptr_t *vCopies)
Definition abcDar.c:721
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition abcObj.c:170
ABC_DLL char * Abc_SopCreateAnd(Mem_Flex_t *pMan, int nVars, int *pfCompl)
Definition abcSop.c:168
ABC_DLL void Abc_SopComplementVar(char *pSop, int iVar)
Definition abcSop.c:678
ABC_DLL char * Abc_SopCreateXor(Mem_Flex_t *pMan, int nVars)
Definition abcSop.c:280
@ ABC_FUNC_SOP
Definition abc.h:65
ABC_DLL char * Abc_SopCreateMux(Mem_Flex_t *pMan)
Definition abcSop.c:335
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
int Gia_ObjRecognizeMuxLits(Gia_Man_t *p, Gia_Obj_t *pNode, int *iLitT, int *iLitE)
Definition giaUtil.c:1133
#define Gia_ManForEachLut(p, i)
Definition gia.h:1157
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition gia.h:1161
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
Definition giaUtil.c:982
void Gia_ManFillValue(Gia_Man_t *p)
Definition giaUtil.c:369
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition hop.h:49
struct Mem_Flex_t_ Mem_Flex_t
Definition mem.h:34
unsigned fPersist
Definition abc.h:139
unsigned Value
Definition gia.h:89
Here is the call graph for this function:

◆ Abc_NtkFromMiniMapping()

Abc_Ntk_t * Abc_NtkFromMiniMapping ( int * pArray)
extern

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

Synopsis [Build mapped network from the mini-mapped format.]

Description []

SideEffects []

SeeAlso []

Definition at line 907 of file abcMap.c.

908{
909 if ( !pArray ) {
910 printf("Mapping is not available.\n");
911 return NULL;
912 }
914 if ( !pLib ) {
915 printf("Library is not available.\n");
916 return NULL;
917 }
919 pNtkMapped->pName = Extra_UtilStrsav( "mapped" );
920 pNtkMapped->pManFunc = pLib;
921 int nCis, nCos, nNodes, nFlops;
922 int i, k, nLeaves, Pos = 4;
923 char * pBuffer, * pName;
924 Mio_Gate_t *pGate;
925 Abc_Obj_t * pObj;
926 nCis = pArray[0];
927 nCos = pArray[1];
928 nNodes = pArray[2];
929 nFlops = pArray[3];
930 // create pis
931 for ( i = 0; i < nCis-nFlops; i++ )
932 Abc_NtkCreatePi( pNtkMapped );
933 // create nodes
934 for ( i = 0; i < nNodes; i++ )
935 Abc_NtkCreateNode( pNtkMapped );
936 // create pos
937 for ( i = 0; i < nCos-nFlops; i++ )
938 Abc_NtkCreatePo( pNtkMapped );
939 // create flops
940 for ( i = 0; i < nFlops; i++ )
941 Abc_NtkAddLatch( pNtkMapped, NULL, ABC_INIT_ZERO );
942 // connect nodes
943 for ( i = 0; i < nNodes; i++ )
944 {
945 nLeaves = pArray[Pos++];
946 for ( k = 0; k < nLeaves; k++ )
947 Abc_ObjAddFanin( Abc_NtkObj( pNtkMapped, nCis + i + 1 ), Abc_NtkObj( pNtkMapped, pArray[Pos++] + 1 ) );
948 }
949 for ( i = 0; i < nCos; i++ )
950 Abc_ObjAddFanin( Abc_NtkCo( pNtkMapped, i ), Abc_NtkObj( pNtkMapped, pArray[Pos++] + 1 ) );
951
952 pBuffer = (char *)(pArray + Pos);
953 for ( i = 0; i < nNodes; i++ )
954 {
955 pName = pBuffer;
956 pBuffer += strlen(pName) + 1;
957 pGate = Mio_LibraryReadGateByName( pLib, pName, NULL );
958 Abc_NtkObj( pNtkMapped, nCis + i + 1 )->pData = pGate;
959 }
960
961 assert( Abc_NtkCiNum(pNtkMapped) == nCis );
962 Abc_NtkForEachCi( pNtkMapped, pObj, i ) {
963 pName = pBuffer;
964 pBuffer += strlen(pName) + 1;
965 Abc_ObjAssignName( pObj, pName, NULL );
966 }
967 assert( Abc_NtkCoNum(pNtkMapped) == nCos );
968 Abc_NtkForEachCo( pNtkMapped, pObj, i ) {
969 pName = pBuffer;
970 pBuffer += strlen(pName) + 1;
971 Abc_ObjAssignName( pObj, pName, NULL );
972 }
973
974 if ( !Abc_NtkCheck( pNtkMapped ) ) {
975 fprintf( stdout, "Abc_NtkFromMiniMapping(): Network check has failed.\n" );
976 }
977
978 return pNtkMapped;
979}
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
ABC_DLL Abc_Obj_t * Abc_NtkAddLatch(Abc_Ntk_t *pNtk, Abc_Obj_t *pDriver, Abc_InitType_t Init)
Definition abcLatch.c:254
@ ABC_INIT_ZERO
Definition abc.h:104
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition abcNames.c:69
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
ush Pos
Definition deflate.h:88
struct Mio_GateStruct_t_ Mio_Gate_t
Definition mio.h:43
int strlen()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkPrintMiniMapping()

void Abc_NtkPrintMiniMapping ( int * pArray)
extern

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

Synopsis [Prints mapped network represented in mini-mapped format.]

Description []

SideEffects []

SeeAlso []

Definition at line 1030 of file abcMap.c.

1031{
1032 int nCis, nCos, nNodes, nFlops;
1033 int i, k, nLeaves, Pos = 4;
1034 char * pBuffer, * pName;
1035 nCis = pArray[0];
1036 nCos = pArray[1];
1037 nNodes = pArray[2];
1038 nFlops = pArray[3];
1039 printf( "Mapped network has %d CIs, %d COs, %d gates, and %d flops.\n", nCis, nCos, nNodes, nFlops );
1040 printf( "The first %d object IDs (from 0 to %d) are reserved for the CIs.\n", nCis, nCis - 1 );
1041 for ( i = 0; i < nNodes; i++ )
1042 {
1043 nLeaves = pArray[Pos++];
1044 printf( "Node %d has %d fanins {", nCis + i, nLeaves );
1045 for ( k = 0; k < nLeaves; k++ )
1046 printf( " %d", pArray[Pos++] );
1047 printf( " }\n" );
1048 }
1049 for ( i = 0; i < nCos; i++ )
1050 printf( "CO %d is driven by node %d\n", i, pArray[Pos++] );
1051 pBuffer = (char *)(pArray + Pos);
1052 for ( i = 0; i < nNodes; i++ )
1053 {
1054 pName = pBuffer;
1055 pBuffer += strlen(pName) + 1;
1056 printf( "Node %d has gate \"%s\"\n", nCis + i, pName );
1057 }
1058 for ( i = 0; i < nCis; i++ )
1059 {
1060 pName = pBuffer;
1061 pBuffer += strlen(pName) + 1;
1062 printf( "CI %d has name \"%s\"\n", i, pName );
1063 }
1064 for ( i = 0; i < nCos; i++ )
1065 {
1066 pName = pBuffer;
1067 pBuffer += strlen(pName) + 1;
1068 printf( "CO %d has name \"%s\"\n", i, pName );
1069 }
1070}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkWriteMiniMapping()

Vec_Int_t * Abc_NtkWriteMiniMapping ( Abc_Ntk_t * pNtk)
extern

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

Synopsis [Dumps mapped network in the mini-mapped format.]

Description []

SideEffects []

SeeAlso []

Definition at line 834 of file abcMap.c.

835{
836 Vec_Ptr_t * vNodes;
837 Vec_Int_t * vMapping;
838 Vec_Str_t * vGates;
839 Abc_Obj_t * pObj, * pFanin;
840 int i, k, nNodes, nFanins, nExtra, * pArray;
841 assert( Abc_NtkHasMapping(pNtk) );
842 // collect nodes in the DFS order
843 vNodes = Abc_NtkDfs( pNtk, 0 );
844 // assign unique numbers
845 nNodes = nFanins = 0;
846 Abc_NtkForEachCi( pNtk, pObj, i )
847 pObj->iTemp = nNodes++;
848 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
849 pObj->iTemp = nNodes++, nFanins += Abc_ObjFaninNum(pObj);
850 // allocate attay to store mapping (4 counters + fanins for each node + PO drivers + gate names)
851 vMapping = Vec_IntAlloc( 4 + Abc_NtkNodeNum(pNtk) + nFanins + Abc_NtkCoNum(pNtk) + 10000 );
852 // write the numbers of CI/CO/Node/FF
853 Vec_IntPush( vMapping, Abc_NtkCiNum(pNtk) );
854 Vec_IntPush( vMapping, Abc_NtkCoNum(pNtk) );
855 Vec_IntPush( vMapping, Vec_PtrSize(vNodes) );
856 Vec_IntPush( vMapping, Abc_NtkLatchNum(pNtk) );
857 // write the nodes
858 vGates = Vec_StrAlloc( 10000 );
859 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
860 {
861 Vec_IntPush( vMapping, Abc_ObjFaninNum(pObj) );
862 Abc_ObjForEachFanin( pObj, pFanin, k )
863 Vec_IntPush( vMapping, pFanin->iTemp );
864 // remember this gate (to be added to the mapping later)
865 Vec_StrPrintStr( vGates, Mio_GateReadName((Mio_Gate_t *)pObj->pData) );
866 Vec_StrPush( vGates, '\0' );
867 }
868 // write the COs literals
869 Abc_NtkForEachCo( pNtk, pObj, i )
870 Vec_IntPush( vMapping, Abc_ObjFanin0(pObj)->iTemp );
871 // write signal names
872 Abc_NtkForEachCi( pNtk, pObj, i ) {
873 Vec_StrPrintStr( vGates, Abc_ObjName(pObj) );
874 Vec_StrPush( vGates, '\0' );
875 }
876 Abc_NtkForEachCo( pNtk, pObj, i ) {
877 Vec_StrPrintStr( vGates, Abc_ObjName(pObj) );
878 Vec_StrPush( vGates, '\0' );
879 }
880 // finish off the array
881 nExtra = 4 - Vec_StrSize(vGates) % 4;
882 for ( i = 0; i < nExtra; i++ )
883 Vec_StrPush( vGates, '\0' );
884 // add gates to the array
885 assert( Vec_StrSize(vGates) % 4 == 0 );
886 nExtra = Vec_StrSize(vGates) / 4;
887 pArray = (int *)Vec_StrArray(vGates);
888 for ( i = 0; i < nExtra; i++ )
889 Vec_IntPush( vMapping, pArray[i] );
890 // cleanup and return
891 Vec_PtrFree( vNodes );
892 Vec_StrFree( vGates );
893 return vMapping;
894}
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition mioApi.c:169
int iTemp
Definition abc.h:149
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManRewireMapNf()

Abc_Ntk_t * Gia_ManRewireMapNf ( Gia_Man_t * pGia)

Definition at line 57 of file rewire_map.c.

57 {
58 Jf_Par_t Pars, * pPars = &Pars;
59 Nf_ManSetDefaultPars( pPars );
60 Gia_Man_t *pGiaNew = Nf_ManPerformMapping(pGia, pPars);
61 if (pGiaNew == NULL) {
62 Abc_Print(-1, "Mapping has failed.\n");
63 return NULL;
64 }
65 Abc_Ntk_t *pNtkMapped = Abc_NtkFromCellMappedGia(pGiaNew, 0);
66 return pNtkMapped;
67}
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
struct Jf_Par_t_ Jf_Par_t
Definition gia.h:333
Abc_Ntk_t * Abc_NtkFromCellMappedGia(Gia_Man_t *p, int fUseBuffs)
Definition abcDar.c:967
void Nf_ManSetDefaultPars(Jf_Par_t *pPars)
Definition giaNf.c:2527
Gia_Man_t * Nf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaNf.c:2734
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManRewireMapSimap()

Abc_Ntk_t * Gia_ManRewireMapSimap ( Gia_Man_t * pGia,
int nBound,
int nBTLimit,
int nTimeout )

Definition at line 69 of file rewire_map.c.

69 {
70 if (!Gia_ManSimpleMapping(pGia, nBound, 0, nBTLimit, nTimeout, 0, 0, 0, NULL)) {
71 // Abc_Print(-1, "Mapping has failed.\n");
72 return NULL;
73 }
74 Abc_Ntk_t *pNtkMapped = Abc_NtkFromCellMappedGia(pGia, 0);
75 return pNtkMapped;
76}
int Gia_ManSimpleMapping(Gia_Man_t *p, int nBound, int Seed, int nBTLimit, int nTimeout, int fVerbose, int fKeepFile, int argc, char **argv)
Definition giaSatLut.c:1572
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManRewirePut()

Abc_Ntk_t * Gia_ManRewirePut ( Gia_Man_t * pGia)

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

FileName [rewire_map.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Re-wiring.]

Synopsis []

Author [Jiun-Hao Chen]

Affiliation [National Taiwan University]

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

Revision [

Id
rewire_map.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 38 of file rewire_map.c.

38 {
39 Aig_Man_t *pMan = Gia_ManToAig(pGia, 0);
40 Abc_Ntk_t *pNtk = Abc_NtkFromAigPhase(pMan);
41 Abc_NtkSetName(pNtk, Abc_UtilStrsav(Gia_ManName(pGia)));
42 Aig_ManStop(pMan);
43 return pNtk;
44}
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
Definition giaAig.c:318
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkFromAigPhase(Aig_Man_t *pMan)
DECLARATIONS ///.
Definition abcDar.c:595
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSimpleMapping()

int Gia_ManSimpleMapping ( Gia_Man_t * p,
int nBound,
int Seed,
int nBTLimit,
int nTimeout,
int fVerbose,
int fKeepFile,
int argc,
char ** argv )
extern

Definition at line 1572 of file giaSatLut.c.

1573{
1574 abctime clkStart = Abc_Clock();
1575 srand(time(NULL));
1576 int Status, Rand = ((((unsigned)rand()) << 12) ^ ((unsigned)rand())) & 0xFFFFFF;
1577 char pFileNameI[32]; sprintf( pFileNameI, "_%06x_.cnf", Rand );
1578 char pFileNameO[32]; sprintf( pFileNameO, "_%06x_.out", Rand );
1579 if ( nBound == 0 )
1580 nBound = 5 * Gia_ManAndNum(p);
1581 Vec_Str_t * vStr = Gia_ManSimpleCnf( p, nBound/2 );
1582 int nVars = 7*(Gia_ManObjNum(p)-Gia_ManCoNum(p));
1583 if ( !Gia_ManDumpCnf(pFileNameI, vStr, nVars) ) {
1584 Vec_StrFree( vStr );
1585 return 0;
1586 }
1587 if ( fVerbose )
1588 printf( "SAT variables = %d. SAT clauses = %d. Cardinality bound = %d. Conflict limit = %d. Timeout = %d.\n",
1589 nVars, Vec_StrCountEntry(vStr, '\n'), nBound, nBTLimit, nTimeout );
1590 Vec_Int_t * vRes = Gia_RunKadical( pFileNameI, pFileNameO, Seed, nBTLimit, nTimeout, fVerbose, &Status );
1591 unlink( pFileNameI );
1592 //unlink( pFileNameO );
1593 if ( fKeepFile ) Gia_ManDumpCnf2( vStr, nVars, argc, argv, Abc_Clock() - clkStart, Status );
1594 Vec_StrFree( vStr );
1595 if ( vRes == NULL )
1596 return 0;
1597 Vec_IntFreeP( &p->vCellMapping );
1598 assert( p->vCellMapping == NULL );
1599 Vec_IntDrop( vRes, 0 );
1600 if ( fVerbose ) Gia_ManSimplePrintMapping( vRes, Gia_ManCiNum(p) );
1601 p->vCellMapping = Gia_ManDeriveSimpleMapping( p, vRes );
1602 Vec_IntFree( vRes );
1603 if ( fVerbose ) Abc_PrintTime( 0, "Total time", Abc_Clock() - clkStart );
1604 return 1;
1605}
ABC_INT64_T abctime
Definition abc_global.h:332
void Gia_ManSimplePrintMapping(Vec_Int_t *vRes, int nIns)
Definition giaSatLut.c:1513
Vec_Str_t * Gia_ManSimpleCnf(Gia_Man_t *p, int nBound)
Definition giaSatLut.c:1339
Vec_Int_t * Gia_ManDeriveSimpleMapping(Gia_Man_t *p, Vec_Int_t *vRes)
Definition giaSatLut.c:1459
int Gia_ManDumpCnf(char *pFileName, Vec_Str_t *vStr, int nVars)
Definition giaSatLut.c:1536
Vec_Int_t * Gia_RunKadical(char *pFileNameIn, char *pFileNameOut, int Seed, int nBTLimit, int TimeOut, int fVerbose, int *pStatus)
Definition giaSatLut.c:1237
int Gia_ManDumpCnf2(Vec_Str_t *vStr, int nVars, int argc, char **argv, abctime Time, int Status)
Definition giaSatLut.c:1544
char * sprintf()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Nf_ManPerformMapping()

Gia_Man_t * Nf_ManPerformMapping ( Gia_Man_t * pGia,
Jf_Par_t * pPars )
extern

Definition at line 2734 of file giaNf.c.

2735{
2736 Gia_Man_t * pNew;
2737 if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t*)p->pManTime) && Gia_ManIsNormalized(p) )
2738 {
2739 pNew = Gia_ManDupUnnormalize( p );
2740 if ( pNew == NULL )
2741 return NULL;
2742 Gia_ManTransferTiming( pNew, p );
2743 p = pNew;
2744 // mapping
2745 pNew = Nf_ManPerformMappingInt( p, pPars );
2746 if ( pNew != p )
2747 {
2748 Gia_ManTransferTiming( pNew, p );
2749 Gia_ManStop( p );
2750 }
2751 // normalize
2752 pNew = Gia_ManDupNormalize( p = pNew, 0 );
2754 Gia_ManTransferTiming( pNew, p );
2755 Gia_ManStop( p );
2756 assert( Gia_ManIsNormalized(pNew) );
2757 }
2758 else
2759 {
2760 pNew = Nf_ManPerformMappingInt( p, pPars );
2761 Gia_ManTransferTiming( pNew, p );
2762 //Gia_ManCellMappingVerify( pNew );
2763 // remove choices after mapping
2764 ABC_FREE( pNew->pReprs );
2765 ABC_FREE( pNew->pNexts );
2766 }
2767 //pNew->MappedDelay = (int)((If_Par_t *)pp)->FinalDelay;
2768 //pNew->MappedArea = (int)((If_Par_t *)pp)->FinalArea;
2769 return pNew;
2770}
void Gia_ManTransferCellMapping(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaNf.c:2695
Gia_Man_t * Nf_ManPerformMappingInt(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaNf.c:2556
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition giaTim.c:114
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2370
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p, int fHashMapping)
Definition giaTim.c:139
Gia_Man_t * Gia_ManDupUnnormalize(Gia_Man_t *p)
Definition giaTim.c:382
Gia_Rpr_t * pReprs
Definition gia.h:126
int * pNexts
Definition gia.h:127
int Tim_ManBoxNum(Tim_Man_t *p)
Definition timMan.c:722
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition tim.h:92
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Nf_ManSetDefaultPars()

void Nf_ManSetDefaultPars ( Jf_Par_t * pPars)
extern

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

Synopsis [Technology mappping.]

Description []

SideEffects []

SeeAlso []

Definition at line 2527 of file giaNf.c.

2528{
2529 memset( pPars, 0, sizeof(Jf_Par_t) );
2530 pPars->nLutSize = 6;
2531 pPars->nCutNum = 16;
2532 pPars->nProcNum = 0;
2533 pPars->nRounds = 4;
2534 pPars->nRoundsEla = 2;
2535 pPars->nRelaxRatio = 0;
2536 pPars->nCoarseLimit = 3;
2537 pPars->nAreaTuner = 0;
2538 pPars->nReqTimeFlex = 0;
2539 pPars->nVerbLimit = 5;
2540 pPars->DelayTarget = -1;
2541 pPars->fAreaOnly = 0;
2542 pPars->fPinPerm = 0;
2543 pPars->fPinQuick = 0;
2544 pPars->fPinFilter = 0;
2545 pPars->fOptEdge = 1;
2546 pPars->fCoarsen = 0;
2547 pPars->fCutMin = 1;
2548 pPars->fGenCnf = 0;
2549 pPars->fPureAig = 0;
2550 pPars->fVerbose = 0;
2551 pPars->fVeryVerbose = 0;
2552 pPars->nLutSizeMax = NF_LEAF_MAX;
2553 pPars->nCutNumMax = NF_CUT_MAX;
2554 pPars->MapDelayTarget = 0;
2555}
#define NF_CUT_MAX
Definition giaNf.c:47
#define NF_LEAF_MAX
DECLARATIONS ///.
Definition giaNf.c:46
float MapDelayTarget
Definition gia.h:387
int nReqTimeFlex
Definition gia.h:344
int fPinQuick
Definition gia.h:352
int nRounds
Definition gia.h:339
int fGenCnf
Definition gia.h:360
int nProcNum
Definition gia.h:338
int nRelaxRatio
Definition gia.h:341
int nCutNum
Definition gia.h:337
int nRoundsEla
Definition gia.h:340
int fOptEdge
Definition gia.h:354
int fAreaOnly
Definition gia.h:350
int nCutNumMax
Definition gia.h:373
int fCoarsen
Definition gia.h:357
int nLutSizeMax
Definition gia.h:372
int fPinPerm
Definition gia.h:351
int nLutSize
Definition gia.h:336
int fPinFilter
Definition gia.h:353
int nAreaTuner
Definition gia.h:343
int fVeryVerbose
Definition gia.h:371
int fCutMin
Definition gia.h:358
int fPureAig
Definition gia.h:365
int nCoarseLimit
Definition gia.h:342
int fVerbose
Definition gia.h:370
int nVerbLimit
Definition gia.h:345
int DelayTarget
Definition gia.h:349
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function: