ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
fretInit.c File Reference
#include "fretime.h"
#include "base/io/ioAbc.h"
#include "map/mio/mio.h"
#include "aig/hop/hop.h"
Include dependency graph for fretInit.c:

Go to the source code of this file.

Functions

void * Abc_FrameReadLibGen ()
 
void Abc_NtkMarkCone_rec (Abc_Obj_t *pObj, int fForward)
 
void Abc_FlowRetime_InitState (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///.
 
void Abc_FlowRetime_PrintInitStateInfo (Abc_Ntk_t *pNtk)
 
void Abc_FlowRetime_UpdateForwardInit (Abc_Ntk_t *pNtk)
 
void Abc_FlowRetime_SetupBackwardInit (Abc_Ntk_t *pNtk)
 
int Abc_FlowRetime_SolveBackwardInit (Abc_Ntk_t *pNtk)
 
void Abc_FlowRetime_UpdateBackwardInit (Abc_Ntk_t *pNtk)
 
Abc_Obj_tAbc_FlowRetime_CopyNodeToInitNtk (Abc_Obj_t *pOrigObj)
 
int Abc_FlowRetime_PartialSat (Vec_Ptr_t *vNodes, int cut)
 
void Abc_FlowRetime_ConstrainInit ()
 
void Abc_FlowRetime_RemoveInitBias ()
 
void Abc_FlowRetime_AddInitBias ()
 

Function Documentation

◆ Abc_FlowRetime_AddInitBias()

void Abc_FlowRetime_AddInitBias ( )

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

Synopsis [Adds nodes to bias against uninitializable cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 1218 of file fretInit.c.

1218 {
1219 Abc_Ntk_t *pNtk = pManMR->pNtk;
1220 Abc_Obj_t *pBiasNode, *pObj;
1221 InitConstraint_t *pConstraint;
1222 int i, j, id;
1223 const int nConstraints = Vec_PtrSize( pManMR->vInitConstraints );
1224
1225 pManMR->pDataArray = ABC_REALLOC( Flow_Data_t, pManMR->pDataArray, pManMR->nNodes + (nConstraints*(pManMR->iteration+1)) );
1226 memset(pManMR->pDataArray + pManMR->nNodes, 0, sizeof(Flow_Data_t)*(nConstraints*(pManMR->iteration+1)));
1227
1228 vprintf("\t\tcreating %d bias structures\n", nConstraints);
1229
1230 Vec_PtrForEachEntry(InitConstraint_t*, pManMR->vInitConstraints, pConstraint, i ) {
1231 if (pConstraint->pBiasNode) continue;
1232
1233 // printf("\t\t\tbias %d...\n", i);
1234 pBiasNode = Abc_NtkCreateBlackbox( pNtk );
1235
1236 Vec_IntForEachEntry( &pConstraint->vNodes, id, j ) {
1237 pObj = Abc_NtkObj(pNtk, id);
1238 Abc_FlowRetime_ConnectBiasNode(pBiasNode, pObj, Vec_IntEntry(&pConstraint->vLags, j));
1239 }
1240
1241 // pConstraint->pBiasNode = pBiasNode;
1242 }
1243}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
#define ABC_REALLOC(type, obj, num)
Definition abc_global.h:268
#define vprintf
Definition fretime.h:138
MinRegMan_t * pManMR
Definition fretMain.c:52
struct Flow_Data_t_ Flow_Data_t
struct InitConstraint_t_ InitConstraint_t
Vec_Int_t vNodes
Definition fretime.h:94
Abc_Obj_t * pBiasNode
Definition fretime.h:92
Vec_Int_t vLags
Definition fretime.h:95
char * memset()
#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:

◆ Abc_FlowRetime_ConstrainInit()

void Abc_FlowRetime_ConstrainInit ( )

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

Synopsis [Constrains backward retiming for initializability.]

Description []

SideEffects []

SeeAlso []

Definition at line 1023 of file fretInit.c.

1023 {
1024 Vec_Ptr_t *vNodes;
1025 int low, high, mid;
1026 int i, n, lag;
1027 Abc_Obj_t *pObj = NULL, *pOrigObj;
1028 InitConstraint_t *pConstraint = ABC_ALLOC( InitConstraint_t, 1 );
1029
1030 memset( pConstraint, 0, sizeof(InitConstraint_t) );
1031
1032 assert(pManMR->pInitNtk);
1033
1034 vprintf("\tsearch for initial state conflict...\n");
1035
1036 vNodes = Abc_NtkDfs(pManMR->pInitNtk, 0);
1037 n = Vec_PtrSize(vNodes);
1038 // also add PIs to vNodes
1039 Abc_NtkForEachPi(pManMR->pInitNtk, pObj, i)
1040 Vec_PtrPush(vNodes, pObj);
1041 Vec_PtrReorder(vNodes, n);
1042
1043#if defined(DEBUG_CHECK)
1044 assert(!Abc_FlowRetime_PartialSat( vNodes, 0 ));
1045#endif
1046
1047 // grow initialization constraint
1048 do {
1049 vprintf("\t\t");
1050
1051 // find element to add to set...
1052 low = 0, high = Vec_PtrSize(vNodes);
1053 while (low != high-1) {
1054 mid = (low + high) >> 1;
1055
1056 if (!Abc_FlowRetime_PartialSat( vNodes, mid )) {
1057 low = mid;
1058 vprintf("-");
1059 } else {
1060 high = mid;
1061 vprintf("*");
1062 }
1063 fflush(stdout);
1064 }
1065
1066#if defined(DEBUG_CHECK)
1067 assert(Abc_FlowRetime_PartialSat( vNodes, high ));
1068 assert(!Abc_FlowRetime_PartialSat( vNodes, low ));
1069#endif
1070
1071 // mark its TFO
1072 pObj = (Abc_Obj_t*)Vec_PtrEntry( vNodes, low );
1073 Abc_NtkMarkCone_rec( pObj, 1 );
1074 vprintf(" conflict term = %d ", low);
1075
1076#if 0
1077 printf("init ------\n");
1078 Abc_ObjPrint(stdout, pObj);
1079 printf("\n");
1080 Abc_ObjPrintNeighborhood( pObj, 1 );
1081 printf("------\n");
1082#endif
1083
1084 // add node to constraint
1085 Abc_FlowRetime_GetInitToOrig( pObj, &pOrigObj, &lag );
1086 assert(pOrigObj);
1087 vprintf(" <=> %d/%d\n", Abc_ObjId(pOrigObj), lag);
1088
1089#if 0
1090 printf("orig ------\n");
1091 Abc_ObjPrint(stdout, pOrigObj);
1092 printf("\n");
1093 Abc_ObjPrintNeighborhood( pOrigObj, 1 );
1094 printf("------\n");
1095#endif
1096 Vec_IntPush( &pConstraint->vNodes, Abc_ObjId(pOrigObj) );
1097 Vec_IntPush( &pConstraint->vLags, lag );
1098
1099 } while (Abc_FlowRetime_PartialSat( vNodes, Vec_PtrSize(vNodes) ));
1100
1101 pConstraint->pBiasNode = NULL;
1102
1103 // add constraint
1104 Vec_PtrPush( pManMR->vInitConstraints, pConstraint );
1105
1106 // clear marks
1107 Abc_NtkForEachObj( pManMR->pInitNtk, pObj, i)
1108 pObj->fMarkA = 0;
1109
1110 // free
1111 Vec_PtrFree( vNodes );
1112}
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition abc.h:449
ABC_DLL void Abc_ObjPrint(FILE *pFile, Abc_Obj_t *pObj)
Definition abcPrint.c:1674
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
int Abc_FlowRetime_PartialSat(Vec_Ptr_t *vNodes, int cut)
Definition fretInit.c:956
void Abc_NtkMarkCone_rec(Abc_Obj_t *pObj, int fForward)
Definition retArea.c:147
void Abc_ObjPrintNeighborhood(Abc_Obj_t *pObj, int depth)
Definition fretMain.c:1369
unsigned fMarkA
Definition abc.h:134
#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:

◆ Abc_FlowRetime_CopyNodeToInitNtk()

Abc_Obj_t * Abc_FlowRetime_CopyNodeToInitNtk ( Abc_Obj_t * pOrigObj)

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

Synopsis [Creates a corresponding node in the init state network]

Description []

SideEffects []

SeeAlso []

Definition at line 737 of file fretInit.c.

737 {
738 Abc_Ntk_t *pNtk = pManMR->pNtk;
739 Abc_Ntk_t *pInitNtk = pManMR->pInitNtk;
740 Abc_Obj_t *pInitObj;
741 void *pData;
742 int fCompl[2];
743
744 assert(pOrigObj);
745
746 // what we do depends on the ntk types of original / init networks...
747
748 // (0) convert BI/BO nodes to buffers
749 if (Abc_ObjIsBi( pOrigObj ) || Abc_ObjIsBo( pOrigObj ) ) {
750 pInitObj = Abc_NtkCreateNodeBuf( pInitNtk, NULL );
751 Abc_FlowRetime_ClearInitToOrig( pInitObj );
752 return pInitObj;
753 }
754
755 // (i) strash node -> SOP node
756 if (Abc_NtkIsStrash( pNtk )) {
757
758 if (Abc_AigNodeIsConst( pOrigObj )) {
759 return Abc_NtkCreateNodeConst1( pInitNtk );
760 }
761 if (!Abc_ObjIsNode( pOrigObj )) {
762 assert(Abc_ObjFaninNum(pOrigObj) == 1);
763 pInitObj = Abc_NtkCreateNodeBuf( pInitNtk, NULL );
764 Abc_FlowRetime_ClearInitToOrig( pInitObj );
765 return pInitObj;
766 }
767
768 assert( Abc_ObjIsNode(pOrigObj) );
769 pInitObj = Abc_NtkCreateObj( pInitNtk, ABC_OBJ_NODE );
770
771 fCompl[0] = pOrigObj->fCompl0 ? 1 : 0;
772 fCompl[1] = pOrigObj->fCompl1 ? 1 : 0;
773
774 pData = Abc_SopCreateAnd( (Mem_Flex_t *)pInitNtk->pManFunc, 2, fCompl );
775 assert(pData);
776 pInitObj->pData = Abc_SopRegister( (Mem_Flex_t *)pInitNtk->pManFunc, (const char*)pData );
777 }
778
779 // (ii) mapped node -> SOP node
780 else if (Abc_NtkHasMapping( pNtk )) {
781 if (!pOrigObj->pData) {
782 // assume terminal...
783 assert(Abc_ObjFaninNum(pOrigObj) == 1);
784
785 pInitObj = Abc_NtkCreateNodeBuf( pInitNtk, NULL );
786 Abc_FlowRetime_ClearInitToOrig( pInitObj );
787 return pInitObj;
788 }
789
790 pInitObj = Abc_NtkCreateObj( pInitNtk, (Abc_ObjType_t)Abc_ObjType(pOrigObj) );
791 pData = Mio_GateReadSop((Mio_Gate_t*)pOrigObj->pData);
792 assert( Abc_SopGetVarNum((char*)pData) == Abc_ObjFaninNum(pOrigObj) );
793
794 pInitObj->pData = Abc_SopRegister( (Mem_Flex_t *)pInitNtk->pManFunc, (const char*)pData );
795 }
796
797 // (iii) otherwise, duplicate obj
798 else {
799 pInitObj = Abc_NtkDupObj( pInitNtk, pOrigObj, 0 );
800
801 // copy phase
802 pInitObj->fPhase = pOrigObj->fPhase;
803 }
804
805 assert(pInitObj);
806 return pInitObj;
807}
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition abcObj.c:643
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition abcObj.c:342
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeBuf(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition abcObj.c:706
Abc_ObjType_t
Definition abc.h:86
@ ABC_OBJ_NODE
Definition abc.h:94
ABC_DLL char * Abc_SopCreateAnd(Mem_Flex_t *pMan, int nVars, int *pfCompl)
Definition abcSop.c:168
ABC_DLL int Abc_SopGetVarNum(char *pSop)
Definition abcSop.c:584
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition abcObj.c:109
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, const char *pName)
DECLARATIONS ///.
Definition abcSop.c:62
char * Mio_GateReadSop(Mio_Gate_t *pGate)
Definition mioApi.c:179
struct Mio_GateStruct_t_ Mio_Gate_t
Definition mio.h:43
struct Mem_Flex_t_ Mem_Flex_t
Definition mem.h:34
void * pManFunc
Definition abc.h:191
void * pData
Definition abc.h:145
unsigned fCompl1
Definition abc.h:141
unsigned fPhase
Definition abc.h:137
unsigned fCompl0
Definition abc.h:140
Here is the call graph for this function:

◆ Abc_FlowRetime_InitState()

void Abc_FlowRetime_InitState ( Abc_Ntk_t * pNtk)

FUNCTION DEFINITIONS ///.

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

Synopsis [Updates initial state information.]

Description [Assumes latch boxes in original position, latches in new positions.]

SideEffects []

SeeAlso []

Definition at line 75 of file fretInit.c.

75 {
76
77 if (!pManMR->fComputeInitState) return;
78
79 if (pManMR->fIsForward)
81 else {
83 }
84}
void Abc_FlowRetime_UpdateForwardInit(Abc_Ntk_t *pNtk)
Definition fretInit.c:163
void Abc_FlowRetime_UpdateBackwardInit(Abc_Ntk_t *pNtk)
Definition fretInit.c:665
Here is the call graph for this function:

◆ Abc_FlowRetime_PartialSat()

int Abc_FlowRetime_PartialSat ( Vec_Ptr_t * vNodes,
int cut )

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

Synopsis [Constrains backward retiming for initializability.]

Description []

SideEffects []

SeeAlso []

Definition at line 956 of file fretInit.c.

956 {
957 Abc_Ntk_t *pPartNtk, *pInitNtk = pManMR->pInitNtk;
958 Abc_Obj_t *pObj, *pNext, *pPartObj, *pPartNext, *pPo;
959 int i, j, result;
960
961 assert( Abc_NtkPoNum( pInitNtk ) == 1 );
962
963 pPartNtk = Abc_NtkAlloc( pInitNtk->ntkType, pInitNtk->ntkFunc, 0 );
964
965 // copy network
966 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) {
967 pObj->Level = i;
968 assert(!Abc_ObjIsPo( pObj ));
969
970 if (i < cut && !pObj->fMarkA) {
971 pPartObj = Abc_NtkCreatePi( pPartNtk );
972 Abc_ObjSetCopy( pObj, pPartObj );
973 } else {
974 // copy node
975 pPartObj = Abc_NtkDupObj( pPartNtk, pObj, 0 );
976 // copy complementation
977 pPartObj->fPhase = pObj->fPhase;
978
979 // connect fanins
980 Abc_ObjForEachFanin( pObj, pNext, j ) {
981 pPartNext = Abc_ObjCopy( pNext );
982 assert(pPartNext);
983 Abc_ObjAddFanin( pPartObj, pPartNext );
984 }
985 }
986
987 assert(pObj->pCopy == pPartObj);
988 }
989
990 // create PO
991 pPo = Abc_NtkCreatePo( pPartNtk );
992 pNext = Abc_ObjFanin0( Abc_NtkPo( pInitNtk, 0 ) );
993 pPartNext = Abc_ObjCopy( pNext );
994 assert( pPartNext );
995 Abc_ObjAddFanin( pPo, pPartNext );
996
997 // check network
998#if defined(DEBUG_CHECK)
999 Abc_NtkAddDummyPoNames(pPartNtk);
1000 Abc_NtkAddDummyPiNames(pPartNtk);
1001 Abc_NtkCheck( pPartNtk );
1002#endif
1003
1004 result = Abc_NtkMiterSat( pPartNtk, (ABC_INT64_T)500000, (ABC_INT64_T)50000000, 0, NULL, NULL );
1005
1006 Abc_NtkDelete( pPartNtk );
1007
1008 return !result;
1009}
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 int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
ABC_DLL int Abc_NtkMiterSat(Abc_Ntk_t *pNtk, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int fVerbose, ABC_INT64_T *pNumConfs, ABC_INT64_T *pNumInspects)
FUNCTION DEFINITIONS ///.
Definition abcSat.c:58
ABC_DLL void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:521
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:495
Abc_NtkType_t ntkType
Definition abc.h:156
Abc_NtkFunc_t ntkFunc
Definition abc.h:157
Abc_Obj_t * pCopy
Definition abc.h:148
unsigned Level
Definition abc.h:142
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_FlowRetime_PrintInitStateInfo()

void Abc_FlowRetime_PrintInitStateInfo ( Abc_Ntk_t * pNtk)

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

Synopsis [Prints initial state information.]

Description [Prints distribution of 0,1,and X initial states.]

SideEffects []

SeeAlso []

Definition at line 133 of file fretInit.c.

133 {
134 int i, n0=0, n1=0, nDC=0, nOther=0;
135 Abc_Obj_t *pLatch;
136
137 Abc_NtkForEachLatch( pNtk, pLatch, i ) {
138 if (Abc_LatchIsInit0(pLatch)) n0++;
139 else if (Abc_LatchIsInit1(pLatch)) n1++;
140 else if (Abc_LatchIsInitDc(pLatch)) nDC++;
141 else nOther++;
142 }
143
144 printf("\tinitial states {0,1,x} = {%d, %d, %d}", n0, n1, nDC);
145 if (nOther)
146 printf(" + %d UNKNOWN", nOther);
147 printf("\n");
148}
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
Here is the caller graph for this function:

◆ Abc_FlowRetime_RemoveInitBias()

void Abc_FlowRetime_RemoveInitBias ( )

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

Synopsis [Removes nodes to bias against uninitializable cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 1126 of file fretInit.c.

1126 {
1127 // Abc_Ntk_t *pNtk = pManMR->pNtk;
1128 Abc_Obj_t *pBiasNode;
1129 InitConstraint_t *pConstraint;
1130 int i;
1131
1132 Vec_PtrForEachEntry( InitConstraint_t *, pManMR->vInitConstraints, pConstraint, i ) {
1133 pBiasNode = pConstraint->pBiasNode;
1134 pConstraint->pBiasNode = NULL;
1135
1136 if (pBiasNode)
1137 Abc_NtkDeleteObj(pBiasNode);
1138 }
1139}
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition abcObj.c:170
Here is the call graph for this function:

◆ Abc_FlowRetime_SetupBackwardInit()

void Abc_FlowRetime_SetupBackwardInit ( Abc_Ntk_t * pNtk)

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

Synopsis [Sets up backward initial state computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 489 of file fretInit.c.

489 {
490 Abc_Obj_t *pLatch, *pObj, *pPi;
491 int i;
492 Vec_Ptr_t *vObj = Vec_PtrAlloc(100);
493
494 // create the network used for the initial state computation
495 if (Abc_NtkIsStrash(pNtk)) {
497 } else if (Abc_NtkHasMapping(pNtk))
498 pManMR->pInitNtk = Abc_NtkAlloc( pNtk->ntkType, ABC_FUNC_SOP, 1 );
499 else
500 pManMR->pInitNtk = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
501
502 // mitre inputs
503 Abc_NtkForEachLatch( pNtk, pLatch, i ) {
504 // map latch to initial state network
505 pPi = Abc_NtkCreatePi( pManMR->pInitNtk );
506
507 // DEBUG
508 // printf("setup : mapping latch %d to PI %d\n", pLatch->Id, pPi->Id);
509
510 // has initial state requirement?
511 if (Abc_LatchIsInit0(pLatch)) {
512 pObj = Abc_NtkCreateNodeInv( pManMR->pInitNtk, pPi );
513 Vec_PtrPush(vObj, pObj);
514 }
515 else if (Abc_LatchIsInit1(pLatch)) {
516 Vec_PtrPush(vObj, pPi);
517 }
518
519 Abc_ObjSetData( pLatch, pPi ); // if not verifying init state
520 // FDATA(pLatch)->pInitObj = pPi; // if verifying init state
521 }
522
523 // are there any nodes not DC?
524 if (!Vec_PtrSize(vObj)) {
525 pManMR->fSolutionIsDc = 1;
526 return;
527 } else
528 pManMR->fSolutionIsDc = 0;
529
530 // mitre output
531
532 // create n-input AND gate
533 pObj = Abc_NtkCreateNodeAnd( pManMR->pInitNtk, vObj );
534
535 Abc_ObjAddFanin( Abc_NtkCreatePo( pManMR->pInitNtk ), pObj );
536
537 Vec_PtrFree( vObj );
538}
@ ABC_NTK_LOGIC
Definition abc.h:57
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeAnd(Abc_Ntk_t *pNtk, Vec_Ptr_t *vFanins)
Definition abcObj.c:738
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition abcObj.c:674
@ ABC_FUNC_SOP
Definition abc.h:65
Here is the call graph for this function:

◆ Abc_FlowRetime_SolveBackwardInit()

int Abc_FlowRetime_SolveBackwardInit ( Abc_Ntk_t * pNtk)

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

Synopsis [Solves backward initial state computation.]

Description []

SideEffects [Sets object copies in init ntk.]

SeeAlso []

Definition at line 552 of file fretInit.c.

552 {
553 int i;
554 Abc_Obj_t *pObj, *pInitObj;
555 Vec_Ptr_t *vDelete = Vec_PtrAlloc(0);
556 Abc_Ntk_t *pSatNtk;
557 int result;
558
559 assert(pManMR->pInitNtk);
560
561 // is the solution entirely DC's?
562 if (pManMR->fSolutionIsDc) {
563 Vec_PtrFree(vDelete);
564 Abc_NtkForEachLatch( pNtk, pObj, i ) Abc_LatchSetInitDc( pObj );
565 vprintf("\tno init state computation: all-don't-care solution\n");
566 return 1;
567 }
568
569 // check that network is combinational
570 Abc_NtkForEachObj( pManMR->pInitNtk, pObj, i ) {
571 assert(!Abc_ObjIsLatch(pObj));
572 assert(!Abc_ObjIsBo(pObj));
573 assert(!Abc_ObjIsBi(pObj));
574 }
575
576 // delete superfluous nodes
577 while(Vec_PtrSize( vDelete )) {
578 pObj = (Abc_Obj_t *)Vec_PtrPop( vDelete );
579 Abc_NtkDeleteObj( pObj );
580 }
581 Vec_PtrFree(vDelete);
582
583 // do some final cleanup on the network
586 if (Abc_NtkIsLogic(pManMR->pInitNtk))
587 Abc_NtkCleanup(pManMR->pInitNtk, 0);
588
589#if defined(DEBUG_PRINT_INIT_NTK)
590 Abc_NtkLevelReverse( pManMR->pInitNtk );
591 Abc_NtkForEachObj( pManMR->pInitNtk, pObj, i )
592 if (Abc_ObjLevel( pObj ) < 2)
593 Abc_ObjPrint(stdout, pObj);
594#endif
595
596 vprintf("\tsolving for init state (%d nodes)... ", Abc_NtkObjNum(pManMR->pInitNtk));
597 fflush(stdout);
598#ifdef ABC_USE_CUDD
599 // convert SOPs to BDD
600 if (Abc_NtkHasSop(pManMR->pInitNtk))
601 Abc_NtkSopToBdd( pManMR->pInitNtk );
602 // convert AIGs to BDD
603 if (Abc_NtkHasAig(pManMR->pInitNtk))
604 Abc_NtkAigToBdd( pManMR->pInitNtk );
605#else
606 // convert SOPs to AIG
607 if (Abc_NtkHasSop(pManMR->pInitNtk))
608 Abc_NtkSopToAig( pManMR->pInitNtk );
609#endif
610 pSatNtk = pManMR->pInitNtk;
611
612 // solve
613 result = Abc_NtkMiterSat( pSatNtk, (ABC_INT64_T)500000, (ABC_INT64_T)50000000, 0, NULL, NULL );
614
615 if (!result) {
616 vprintf("SUCCESS\n");
617 } else {
618 vprintf("FAILURE\n");
619 return 0;
620 }
621
622 // clear initial values, associate PIs to latches
623 Abc_NtkForEachPi( pManMR->pInitNtk, pInitObj, i ) Abc_ObjSetCopy( pInitObj, NULL );
624 Abc_NtkForEachLatch( pNtk, pObj, i ) {
625 pInitObj = (Abc_Obj_t*)Abc_ObjData( pObj );
626 assert( Abc_ObjIsPi( pInitObj ));
627 Abc_ObjSetCopy( pInitObj, pObj );
628 Abc_LatchSetInitNone( pObj );
629
630 // DEBUG
631 // printf("solve : getting latch %d from PI %d\n", pObj->Id, pInitObj->Id);
632 }
633
634 // copy solution from PIs to latches
635 assert(pManMR->pInitNtk->pModel);
636 Abc_NtkForEachPi( pManMR->pInitNtk, pInitObj, i ) {
637 if ((pObj = Abc_ObjCopy( pInitObj ))) {
638 if ( pManMR->pInitNtk->pModel[i] )
639 Abc_LatchSetInit1( pObj );
640 else
641 Abc_LatchSetInit0( pObj );
642 }
643 }
644
645#if defined(DEBUG_CHECK)
646 // check that all latches have initial state
647 Abc_NtkForEachLatch( pNtk, pObj, i ) assert( !Abc_LatchIsInitNone( pObj ) );
648#endif
649
650 return 1;
651}
ABC_DLL int Abc_NtkCleanup(Abc_Ntk_t *pNtk, int fVerbose)
Definition abcSweep.c:478
ABC_DLL int Abc_NtkSopToBdd(Abc_Ntk_t *pNtk)
Definition abcFunc.c:865
ABC_DLL int Abc_NtkLevelReverse(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1499
ABC_DLL int Abc_NtkSopToAig(Abc_Ntk_t *pNtk)
Definition abcFunc.c:884
ABC_DLL int Abc_NtkAigToBdd(Abc_Ntk_t *pNtk)
Definition abcFunc.c:869
Here is the call graph for this function:

◆ Abc_FlowRetime_UpdateBackwardInit()

void Abc_FlowRetime_UpdateBackwardInit ( Abc_Ntk_t * pNtk)

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

Synopsis [Updates backward initial state computation problem.]

Description [Assumes box outputs in old positions stored w/ init values.]

SideEffects []

SeeAlso []

Definition at line 665 of file fretInit.c.

665 {
666 Abc_Obj_t *pOrigObj, *pInitObj;
667 Vec_Ptr_t *vBo = Vec_PtrAlloc(100);
668 Vec_Ptr_t *vPi = Vec_PtrAlloc(100);
669 Abc_Ntk_t *pInitNtk = pManMR-> pInitNtk;
670 Abc_Obj_t *pBuf;
671 int i;
672
673 // remove PIs from network (from BOs)
674 Abc_NtkForEachObj( pNtk, pOrigObj, i )
675 if (Abc_ObjIsBo(pOrigObj)) {
676 pInitObj = FDATA(pOrigObj)->pInitObj;
677 assert(Abc_ObjIsPi(pInitObj));
678
679 // DEBUG
680 // printf("update : freeing PI %d\n", pInitObj->Id);
681
682 // create a buffer instead
683 pBuf = Abc_NtkCreateNodeBuf( pInitNtk, NULL );
684 Abc_FlowRetime_ClearInitToOrig( pBuf );
685
686 Abc_ObjBetterTransferFanout( pInitObj, pBuf, 0 );
687 FDATA(pOrigObj)->pInitObj = pBuf;
688 pOrigObj->fMarkA = 1;
689
690 Vec_PtrPush(vBo, pOrigObj);
691 Vec_PtrPush(vPi, pInitObj);
692 }
693
694 // check that PIs are all free
695 Abc_NtkForEachPi( pInitNtk, pInitObj, i) {
696 assert( Abc_ObjFanoutNum( pInitObj ) == 0);
697 }
698
699 // add PIs to to latches
700 Abc_NtkForEachLatch( pNtk, pOrigObj, i ) {
701 assert(Vec_PtrSize(vPi) > 0);
702 pInitObj = (Abc_Obj_t*)Vec_PtrPop(vPi);
703
704 // DEBUG
705 // printf("update : mapping latch %d to PI %d\n", pOrigObj->Id, pInitObj->Id);
706
707 pOrigObj->fMarkA = pOrigObj->fMarkB = 1;
708 FDATA(pOrigObj)->pInitObj = pInitObj;
709 Abc_ObjSetData(pOrigObj, pInitObj);
710 }
711
712 // recursively build init network
713 Vec_PtrForEachEntry( Abc_Obj_t *, vBo, pOrigObj, i )
714 Abc_FlowRetime_UpdateBackwardInit_rec( pOrigObj );
715
716 // clear flags
717 Abc_NtkForEachObj( pNtk, pOrigObj, i )
718 pOrigObj->fMarkA = pOrigObj->fMarkB = 0;
719
720 // deallocate
721 Vec_PtrFree( vBo );
722 Vec_PtrFree( vPi );
723}
#define FDATA(x)
Definition fretime.h:80
void Abc_ObjBetterTransferFanout(Abc_Obj_t *pFrom, Abc_Obj_t *pTo, int complement)
Definition fretMain.c:1032
unsigned fMarkB
Definition abc.h:135
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_FlowRetime_UpdateForwardInit()

void Abc_FlowRetime_UpdateForwardInit ( Abc_Ntk_t * pNtk)

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

Synopsis [Computes initial state after forward retiming.]

Description [Assumes box outputs in old positions stored w/ init values. Uses three-value simulation to preserve don't cares.]

SideEffects []

SeeAlso []

Definition at line 163 of file fretInit.c.

163 {
164 Abc_Obj_t *pObj, *pFanin;
165 int i;
166
167 vprintf("\t\tupdating init state\n");
168
169 Abc_NtkIncrementTravId( pNtk );
170
171 Abc_NtkForEachLatch( pNtk, pObj, i ) {
172 pFanin = Abc_ObjFanin0(pObj);
173 Abc_FlowRetime_UpdateForwardInit_rec( pFanin );
174
175 if (FTEST(pFanin, INIT_0))
176 Abc_LatchSetInit0( pObj );
177 else if (FTEST(pFanin, INIT_1))
178 Abc_LatchSetInit1( pObj );
179 else
180 Abc_LatchSetInitDc( pObj );
181 }
182}
#define INIT_1
Definition fretime.h:53
#define INIT_0
Definition fretime.h:52
#define FTEST(x, y)
Definition fretime.h:83
Here is the caller graph for this function:

◆ Abc_FrameReadLibGen()

void * Abc_FrameReadLibGen ( )
extern

Definition at line 59 of file mainFrame.c.

59{ return s_GlobalFrame->pLibGen; }

◆ Abc_NtkMarkCone_rec()

void Abc_NtkMarkCone_rec ( Abc_Obj_t * pObj,
int fForward )
extern

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

Synopsis [Marks the cone with MarkA.]

Description []

SideEffects []

SeeAlso []

Definition at line 147 of file retArea.c.

148{
149 Abc_Obj_t * pNext;
150 int i;
151 if ( pObj->fMarkA )
152 return;
153 pObj->fMarkA = 1;
154 if ( fForward )
155 {
156 Abc_ObjForEachFanout( pObj, pNext, i )
157 Abc_NtkMarkCone_rec( pNext, fForward );
158 }
159 else
160 {
161 Abc_ObjForEachFanin( pObj, pNext, i )
162 Abc_NtkMarkCone_rec( pNext, fForward );
163 }
164}
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529
void Abc_NtkMarkCone_rec(Abc_Obj_t *pObj, int fForward)
Definition retArea.c:147
Here is the call graph for this function:
Here is the caller graph for this function: