59 Abc_Ntk_t *
Abc_NtkMap(
Abc_Ntk_t * pNtk,
double DelayTarget,
double AreaMulti,
double DelayMulti,
float LogFan,
float Slew,
float Gain,
int nGatesMin,
int fRecovery,
int fSwitching,
int fVerbose )
61 static int fUseMulti = 0;
62 int fShowSwitching = 1;
66 float * pSwitching = NULL;
85 printf(
"The current library is not available.\n" );
88 if ( AreaMulti != 0.0 )
89 fUseMulti = 1, printf(
"The cell areas are multiplied by the factor: <num_fanins> ^ (%.2f).\n", AreaMulti );
90 if ( DelayMulti != 0.0 )
91 fUseMulti = 1, printf(
"The cell delays are multiplied by the factor: <num_fanins> ^ (%.2f).\n", DelayMulti );
94 if ( AreaMulti != 0.0 )
96 if ( DelayMulti != 0.0 )
103 printf(
"Converting \"%s\" into supergate library \"%s\".\n",
110 if ( AreaMulti != 0.0 )
112 if ( DelayMulti != 0.0 )
117 printf(
"Performing mapping with choices.\n" );
120 fShowSwitching |= fSwitching;
121 if ( fShowSwitching )
125 pSwitching = (
float *)vSwitching->pArray;
129 pMan =
Abc_NtkToMap( pNtk, DelayTarget, fRecovery, pSwitching, fVerbose );
147 if ( pNtkNew == NULL )
160 printf(
"Abc_NtkMap: The network check has failed.\n" );
310 int nFanins, Number, i;
317 if ( Number < nNodePis )
319 return pNodePis[Number];
340 for ( i = 0; i < nFanins; i++ )
345 pNodeNew->
pData = pRoot;
356 int i, fInvPin, nLeaves;
373 for ( i = 0; i < nLeaves; i++ )
375 fInvPin = ((uPhaseBest & (1 << i)) > 0);
377 assert( pNodePIs[i] != NULL );
393 if ( pNodeNew->
pData == NULL )
394 printf(
"Error creating mapped network: Library does not have a constant %d gate.\n", fPhase );
491 printf(
"The current library is not available.\n" );
505 printf(
"Performing mapping with choices.\n" );
519 if ( pNtkNew == NULL )
526 printf(
"Abc_NtkMap: The network check has failed.\n" );
566 printf(
"Abc_NtkFromMapSuperChoice(): Converting to SOPs has failed.\n" );
649 int i, fInvPin, nLeaves;
652 if ( pSuperBest == NULL )
661 for ( i = 0; i < nLeaves; i++ )
663 fInvPin = ((uPhaseBest & (1 << i)) > 0);
665 assert( pNodePIs[i] != NULL );
690 int nFanins, Number, i;
697 if ( Number < nNodePis )
699 return pNodePis[Number];
720 for ( i = 0; i < nFanins; i++ )
776 int i, k, nNodes, nFanins, nExtra, * pArray;
781 nNodes = nFanins = 0;
783 pObj->
iTemp = nNodes++;
809 for ( i = 0; i < nExtra; i++ )
815 for ( i = 0; i < nExtra; i++ )
836 int nCis, nCos, nNodes, nFlops;
837 int i, k, nLeaves,
Pos = 4;
838 char * pBuffer, * pName;
843 printf(
"Mapped network has %d CIs, %d COs, %d gates, and %d flops.\n", nCis, nCos, nNodes, nFlops );
844 printf(
"The first %d object IDs (from 0 to %d) are reserved for the CIs.\n", nCis, nCis - 1 );
845 for ( i = 0; i < nNodes; i++ )
847 printf(
"Node %d has fanins {", nCis + i );
848 nLeaves = pArray[Pos++];
849 for ( k = 0; k < nLeaves; k++ )
850 printf(
" %d", pArray[Pos++] );
853 for ( i = 0; i < nCos; i++ )
854 printf(
"CO %d is driven by node %d\n", i, pArray[Pos++] );
855 pBuffer = (
char *)(pArray + Pos);
856 for ( i = 0; i < nNodes; i++ )
859 pBuffer +=
strlen(pName) + 1;
860 printf(
"Node %d has gate \"%s\"\n", nCis + i, pName );
882 printf(
"ABC framework is not initialized by calling Abc_Start()\n" );
885 printf(
"Current network in ABC framework is not defined.\n" );
887 printf(
"Current network in ABC framework is not mapped.\n" );
914 printf(
"Array has size %d ints.\n",
Vec_IntSize(vMapping) );
935 printf(
"ABC framework is not initialized by calling Abc_Start()\n" );
938 printf(
"Current network in ABC framework is not defined.\n" );
940 printf(
"CI index is not valid.\n" );
950 printf(
"ABC framework is not initialized by calling Abc_Start()\n" );
953 printf(
"Current network in ABC framework is not defined.\n" );
955 printf(
"CO index is not valid.\n" );
static Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec(Abc_Ntk_t *pNtkNew, Map_Super_t *pSuper, Abc_Obj_t *pNodePis[], int nNodePis)
static int * Vec_IntArray(Vec_Int_t *p)
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Mio_Gate_t * Mio_LibraryReadGateByName(Mio_Library_t *pLib, char *pName, char *pOutName)
#define Map_NotCond(p, c)
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Map_Node_t * Map_ManReadConst1(Map_Man_t *p)
ABC_DLL void Abc_FrameSetLibSuper(void *pLib)
void Map_SuperLibFree(Map_SuperLib_t *p)
Abc_Obj_t * Abc_NtkFetchTwinNode(Abc_Obj_t *pNode)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Map_Node_t ** Map_ManReadBufs(Map_Man_t *p)
static ABC_NAMESPACE_IMPL_START Map_Man_t * Abc_NtkToMap(Abc_Ntk_t *pNtk, double DelayTarget, int fRecovery, float *pSwitching, int fVerbose)
DECLARATIONS ///.
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Map_Man_t * Map_ManCreate(int nInputs, int nOutputs, int fVerbose)
FUNCTION DEFINITIONS ///.
ABC_DLL void * Abc_FrameReadLibGen()
Abc_Ntk_t * Abc_NtkSuperChoice(Abc_Ntk_t *pNtk)
void Mio_LibraryMultiDelay(Mio_Library_t *pLib, double Multi)
ABC_DLL Vec_Ptr_t * Abc_AigDfsMap(Abc_Ntk_t *pNtk)
Map_Cut_t * Map_NodeReadCuts(Map_Node_t *p)
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Map_Time_t * Abc_NtkMapCopyCoRequired(Abc_Ntk_t *pNtk, Abc_Time_t *ppTimes)
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static char * Vec_StrArray(Vec_Str_t *p)
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
int Abc_SclHasDelayInfo(void *pScl)
void Map_ManSetOutputNames(Map_Man_t *p, char **ppNames)
Map_Super_t ** Map_SuperReadFanins(Map_Super_t *p)
Abc_Ntk_t * Abc_NtkMulti(Abc_Ntk_t *pNtk, int nThresh, int nFaninMax, int fCnf, int fMulti, int fSimple, int fFactor)
FUNCTION DEFINITIONS ///.
ABC_DLL void Abc_NtkTimeSetArrival(Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
Map_Cut_t * Map_CutReadNext(Map_Cut_t *p)
ABC_DLL char ** Abc_NtkCollectCioNames(Abc_Ntk_t *pNtk, int fCollectCos)
static void Abc_NodeSuperChoice(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNode)
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
void Map_NodeSetData(Map_Node_t *p, int fPhase, char *pData)
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachCo(pNtk, pCo, i)
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
static Vec_Str_t * Vec_StrAlloc(int nCap)
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
static abctime Abc_Clock()
void Map_ManSetInputArrivals(Map_Man_t *p, Map_Time_t *pArrivals)
static void Vec_StrPush(Vec_Str_t *p, char Entry)
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Abc_Obj_t * Abc_NodeFromMapSuper_rec(Abc_Ntk_t *pNtkNew, Map_Node_t *pNodeMap, Map_Super_t *pSuper, Abc_Obj_t *pNodePis[], int nNodePis)
int * Abc_NtkOutputMiniMapping(void *pAbc0)
int Map_NodeIsConst(Map_Node_t *p)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
static float Abc_MaxFloat(float a, float b)
#define Map_IsComplement(p)
GLOBAL VARIABLES ///.
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
char * Mio_LibraryReadName(Mio_Library_t *pLib)
DECLARATIONS ///.
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Map_Super_t * Map_CutReadSuperBest(Map_Cut_t *p, int fPhase)
void Map_NodeSetRepr(Map_Node_t *p, Map_Node_t *pRepr)
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Mio_Library_t * Abc_SclDeriveGenlib(void *pScl, float Slew, float Gain, int nGatesMin, int fVerbose)
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
void Map_ManSetDelayTarget(Map_Man_t *p, float DelayTarget)
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static Abc_Ntk_t * Abc_NtkFromMapSuperChoice(Map_Man_t *pMan, Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
static void Vec_StrFree(Vec_Str_t *p)
Map_Node_t ** Map_ManReadInputs(Map_Man_t *p)
void Abc_NtkSetCoRequiredTime(void *pAbc0, int iCo, float Rise, float Fall)
void Map_ManSetOutputRequireds(Map_Man_t *p, Map_Time_t *pArrivals)
#define ABC_NAMESPACE_IMPL_END
int Map_ManReadBufNum(Map_Man_t *p)
ABC_DLL void * Abc_FrameReadLibSuper()
int Map_SuperLibDeriveFromGenlib(Mio_Library_t *pLib, int fVerbose)
void Mio_LibraryMultiArea(Mio_Library_t *pLib, double Multi)
STRUCTURE DEFINITIONS ///.
static void Vec_IntPush(Vec_Int_t *p, int Entry)
int Map_CutReadLeavesNum(Map_Cut_t *p)
Map_Node_t ** Map_CutReadLeaves(Map_Cut_t *p)
void Map_ManSetSwitching(Map_Man_t *p, int fSwitching)
char * Map_NodeReadData(Map_Node_t *p, int fPhase)
static Abc_Obj_t * Abc_NodeFromMapPhase_rec(Abc_Ntk_t *pNtkNew, Map_Node_t *pNodeMap, int fPhase)
Vec_Int_t * Sim_NtkComputeSwitching(Abc_Ntk_t *pNtk, int nPatterns)
FUNCTION DEFINITIONS ///.
#define Abc_NtkForEachNode(pNtk, pNode, i)
#define ABC_NAMESPACE_IMPL_START
void Mio_LibraryTransferDelays(Mio_Library_t *pLibD, Mio_Library_t *pLibS)
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
static Abc_Ntk_t * Abc_NtkFromMap(Map_Man_t *pMan, Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_HEADER_START struct Map_ManStruct_t_ Map_Man_t
INCLUDES ///.
ABC_DLL Abc_Time_t * Abc_NtkGetCiArrivalTimes(Abc_Ntk_t *pNtk)
static int Vec_StrSize(Vec_Str_t *p)
ABC_DLL int Abc_NtkLogicMakeSimpleCos(Abc_Ntk_t *pNtk, int fDuplicate)
Mio_Gate_t * Mio_GateReadTwin(Mio_Gate_t *pGate)
static int Abc_AigNodeIsChoice(Abc_Obj_t *pNode)
Map_Time_t * Abc_NtkMapCopyCiArrival(Abc_Ntk_t *pNtk, Abc_Time_t *ppTimes)
static int Vec_IntSize(Vec_Int_t *p)
#define Abc_NtkForEachCi(pNtk, pCi, i)
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Map_Node_t ** Map_ManReadOutputs(Map_Man_t *p)
ABC_DLL void Abc_NtkTimeSetRequired(Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
ABC_DLL int Abc_NtkBddToSop(Abc_Ntk_t *pNtk, int fDirect)
#define Abc_ObjForEachFanin(pObj, pFanin, i)
void Map_ManCreateNodeDelays(Map_Man_t *p, int LogFan)
Map_Node_t * Map_NodeAnd(Map_Man_t *p, Map_Node_t *p1, Map_Node_t *p2)
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst0(Abc_Ntk_t *pNtk)
void Map_ManSetAreaRecovery(Map_Man_t *p, int fAreaRecovery)
ABC_DLL void * Abc_FrameReadLibScl()
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
void Map_ManFree(Map_Man_t *pMan)
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Map_Node_t * Map_NodeBuf(Map_Man_t *p, Map_Node_t *p1)
void Abc_NtkTestMiniMapping(Abc_Ntk_t *p)
#define ABC_CALLOC(type, num)
int Map_SuperReadFaninNum(Map_Super_t *p)
static void Abc_NodeFromMapCutPhase(Abc_Ntk_t *pNtkNew, Map_Cut_t *pCut, int fPhase)
int Map_Mapping(Map_Man_t *p)
DECLARATIONS ///.
Vec_Int_t * Abc_NtkWriteMiniMapping(Abc_Ntk_t *pNtk)
Mio_Gate_t * Map_SuperReadRoot(Map_Super_t *p)
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
void Map_NodeSetSwitching(Map_Node_t *p, float Switching)
static void Vec_StrPrintStr(Vec_Str_t *p, const char *pStr)
Map_Node_t * Map_ManReadBufDriver(Map_Man_t *p, int i)
Abc_Ntk_t * Abc_NtkMap(Abc_Ntk_t *pNtk, double DelayTarget, double AreaMulti, double DelayMulti, float LogFan, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fVerbose)
FUNCTION DEFINITIONS ///.
int Map_SuperReadNum(Map_Super_t *p)
void Map_ManCleanData(Map_Man_t *p)
#define Abc_NtkForEachPo(pNtk, pPo, i)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
unsigned Map_CutReadPhaseBest(Map_Cut_t *p, int fPhase)
void Map_NodeSetNextE(Map_Node_t *p, Map_Node_t *pNextE)
static int Abc_ObjIsComplement(Abc_Obj_t *p)
char * Mio_GateReadName(Mio_Gate_t *pGate)
Map_Cut_t * Map_NodeReadCutBest(Map_Node_t *p, int fPhase)
void Abc_NtkPrintMiniMapping(int *pArray)
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
char * Mio_GateReadSop(Mio_Gate_t *pGate)
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
static Abc_Obj_t * Abc_NodeFromMap_rec(Abc_Ntk_t *pNtkNew, Map_Node_t *pNodeMap, int fPhase)
ABC_DLL Abc_Time_t * Abc_NtkGetCoRequiredTimes(Abc_Ntk_t *pNtk)
static void Vec_PtrFree(Vec_Ptr_t *p)
void Abc_NtkSetCiArrivalTime(void *pAbc0, int iCi, float Rise, float Fall)