30#define MAX_LINE 1000000
81static inline int Rtl_LibNtkNum(
Rtl_Lib_t * pLib ) {
return Vec_PtrSize(pLib->
vNtks); }
83static inline Rtl_Ntk_t * Rtl_LibTop(
Rtl_Lib_t * pLib ) {
return Rtl_LibNtk( pLib, Rtl_LibNtkNum(pLib)-1 ); }
87static inline Rtl_Ntk_t * Rtl_NtkModule(
Rtl_Ntk_t *
p,
int i ) {
return Rtl_LibNtk(
p->pLib, i ); }
91static inline char * Rtl_NtkName(
Rtl_Ntk_t *
p ) {
return Rtl_NtkStr(
p,
p->NameId); }
93static inline FILE * Rtl_NtkFile(
Rtl_Ntk_t *
p ) {
return p->pLib->pFile; }
94static inline int Rtl_NtkTokId(
Rtl_Ntk_t *
p,
int i ) {
return i < Vec_IntSize(
p->pLib->vTokens) ? Vec_IntEntry(
p->pLib->vTokens, i) : -1; }
95static inline char * Rtl_NtkTokStr(
Rtl_Ntk_t *
p,
int i ) {
return i < Vec_IntSize(
p->pLib->vTokens) ? Rtl_NtkStr(
p, Vec_IntEntry(
p->pLib->vTokens, i)) : NULL; }
96static inline int Rtl_NtkTokCheck(
Rtl_Ntk_t *
p,
int i,
int Tok ) {
return i ==
p->pLib->pMap[Tok]; }
97static inline int Rtl_NtkPosCheck(
Rtl_Ntk_t *
p,
int i,
int Tok ) {
return Vec_IntEntry(
p->pLib->vTokens, i) ==
p->pLib->pMap[Tok]; }
99static inline int Rtl_NtkInputNum(
Rtl_Ntk_t *
p ) {
return p->nInputs; }
100static inline int Rtl_NtkOutputNum(
Rtl_Ntk_t *
p ) {
return p->nOutputs; }
101static inline int Rtl_NtkAttrNum(
Rtl_Ntk_t *
p ) {
return Vec_IntSize(&
p->vAttrs)/2; }
102static inline int Rtl_NtkWireNum(
Rtl_Ntk_t *
p ) {
return Vec_IntSize(&
p->vWires)/
WIRE_NUM; }
103static inline int Rtl_NtkCellNum(
Rtl_Ntk_t *
p ) {
return Vec_IntSize(&
p->vCells); }
104static inline int Rtl_NtkConNum(
Rtl_Ntk_t *
p ) {
return Vec_IntSize(&
p->vConns)/2; }
105static inline int Rtl_NtkObjNum(
Rtl_Ntk_t *
p ) {
return p->nInputs +
p->nOutputs + Rtl_NtkCellNum(
p) + Rtl_NtkConNum(
p); }
107static inline int * Rtl_NtkWire(
Rtl_Ntk_t *
p,
int i ) {
return Vec_IntEntryP(&
p->vWires,
WIRE_NUM*i); }
108static inline int * Rtl_NtkCell(
Rtl_Ntk_t *
p,
int i ) {
return Vec_IntEntryP(&
p->vStore, Vec_IntEntry(&
p->vCells, i)); }
109static inline int * Rtl_NtkCon(
Rtl_Ntk_t *
p,
int i ) {
return Vec_IntEntryP(&
p->vConns, 2*i); }
111static inline int Rtl_WireName(
Rtl_Ntk_t *
p,
int i ) {
return Vec_IntEntry(&
p->vWires,
WIRE_NUM*i) >> 4; }
112static inline char * Rtl_WireNameStr(
Rtl_Ntk_t *
p,
int i ) {
return Rtl_NtkStr(
p, Rtl_WireName(
p, i)); }
113static inline int Rtl_WireFirst(
Rtl_Ntk_t *
p,
int i ) {
return Vec_IntEntry(&
p->vWires,
WIRE_NUM*i); }
114static inline int Rtl_WireWidth(
Rtl_Ntk_t *
p,
int i ) {
return Vec_IntEntry(&
p->vWires,
WIRE_NUM*i+1); }
115static inline int Rtl_WireOffset(
Rtl_Ntk_t *
p,
int i ) {
return Vec_IntEntry(&
p->vWires,
WIRE_NUM*i+2); }
116static inline int Rtl_WireNumber(
Rtl_Ntk_t *
p,
int i ) {
return Vec_IntEntry(&
p->vWires,
WIRE_NUM*i+3); }
117static inline int Rtl_WireBitStart(
Rtl_Ntk_t *
p,
int i ) {
return Vec_IntEntry(&
p->vWires,
WIRE_NUM*i+4); }
118static inline int Rtl_WireMapNameToId(
Rtl_Ntk_t *
p,
int i ) {
return Vec_IntEntry(
p->pLib->vMap, i); }
120static inline int Rtl_CellType(
int * pCell ) {
return pCell[0]; }
121static inline int Rtl_CellName(
int * pCell ) {
return pCell[1]; }
122static inline int Rtl_CellModule(
int * pCell ) {
return pCell[2]; }
123static inline int Rtl_CellInputNum(
int * pCell ) {
return pCell[3]; }
124static inline int Rtl_CellOutputNum(
int * pCell ) {
return pCell[6]-pCell[3]; }
125static inline int Rtl_CellAttrNum(
int * pCell ) {
return pCell[4]; }
126static inline int Rtl_CellParamNum(
int * pCell ) {
return pCell[5]; }
127static inline int Rtl_CellConNum(
int * pCell ) {
return pCell[6]; }
128static inline int Rtl_CellMark(
int * pCell ) {
return pCell[7]; }
131static inline char * Rtl_CellTypeStr(
Rtl_Ntk_t *
p,
int * pCell ) {
return Rtl_NtkStr(
p, Rtl_CellType(pCell)); }
132static inline char * Rtl_CellNameStr(
Rtl_Ntk_t *
p,
int * pCell ) {
return Rtl_NtkStr(
p, Rtl_CellName(pCell)); }
134static inline int Rtl_SigIsNone(
int s ) {
return (s & 0x3) == 0; }
135static inline int Rtl_SigIsConst(
int s ) {
return (s & 0x3) == 1; }
136static inline int Rtl_SigIsSlice(
int s ) {
return (s & 0x3) == 2; }
137static inline int Rtl_SigIsConcat(
int s ) {
return (s & 0x3) == 3; }
139#define Rtl_NtkForEachAttr( p, Par, Val, i ) \
140 for ( i = 0; i < Rtl_NtkAttrNum(p) && (Par = Vec_IntEntry(&p->vAttrs, 2*i)) && (Val = Vec_IntEntry(&p->vAttrs, 2*i+1)); i++ )
141#define Rtl_NtkForEachWire( p, pWire, i ) \
142 for ( i = 0; i < Rtl_NtkWireNum(p) && (pWire = Vec_IntEntryP(&p->vWires, WIRE_NUM*i)); i++ )
143#define Rtl_NtkForEachCell( p, pCell, i ) \
144 for ( i = 0; i < Rtl_NtkCellNum(p) && (pCell = Rtl_NtkCell(p, i)); i++ )
145#define Rtl_NtkForEachCon( p, pCon, i ) \
146 for ( i = 0; i < Rtl_NtkConNum(p) && (pCon = Vec_IntEntryP(&p->vConns, 2*i)); i++ )
148#define Rtl_CellForEachAttr( p, pCell, Par, Val, i ) \
149 for ( i = 0; i < pCell[4] && (Par = pCell[CELL_NUM+2*i]) && (Val = pCell[CELL_NUM+2*i+1]); i++ )
150#define Rtl_CellForEachParam( p, pCell, Par, Val, i ) \
151 for ( i = 0; i < pCell[5] && (Par = pCell[CELL_NUM+2*(pCell[4]+i)]) && (Val = pCell[CELL_NUM+2*(pCell[4]+i)+1]); i++ )
152#define Rtl_CellForEachConnect( p, pCell, Par, Val, i ) \
153 for ( i = 0; i < pCell[6] && (Par = pCell[CELL_NUM+2*(pCell[4]+pCell[5]+i)]) && (Val = pCell[CELL_NUM+2*(pCell[4]+pCell[5]+i)+1]); i++ )
155#define Rtl_CellForEachInput( p, pCell, Par, Val, i ) \
156 Rtl_CellForEachConnect( p, pCell, Par, Val, i ) if ( i >= Rtl_CellInputNum(pCell) ) continue; else
157#define Rtl_CellForEachOutput( p, pCell, Par, Val, i ) \
158 Rtl_CellForEachConnect( p, pCell, Par, Val, i ) if ( i < Rtl_CellInputNum(pCell) ) continue; else
182 Vec_IntGrow( &
p->vWires, 4 );
183 Vec_IntGrow( &
p->vCells, 4 );
184 Vec_IntGrow( &
p->vConns, 4 );
185 Vec_IntGrow( &
p->vStore, 8 );
186 Vec_IntGrow( &
p->vAttrs, 8 );
187 Vec_PtrPush( pLib->
vNtks, (
void *)
p );
212 Counts[0]++, Counts[1] += pWire[1];
214 Counts[2]++, Counts[3] += pWire[1];
216 assert(
p->nInputs == Counts[0] );
217 assert(
p->nOutputs == Counts[2] );
221 int i, * pCell, nBlack = 0, nUser = 0, Counts[
ABC_OPER_LAST] = {0};
222 if ( Rtl_NtkCellNum(
p) == 0 )
226 Counts[Rtl_CellModule(pCell)]++;
231 printf(
"There are %d instances in this network:\n", Rtl_NtkCellNum(
p) );
233 printf(
" %s (%d)",
"blackbox", nBlack );
235 printf(
" %s (%d)",
"user", nUser );
238 printf(
" %s (%d)", Abc_OperName(i), Counts[i] );
244 printf(
"%*s : ", nNameSymbs, Rtl_NtkName(
p) );
245 printf(
"PI = %5d (%5d) ", Counts[0], Counts[1] );
246 printf(
"PO = %5d (%5d) ", Counts[2], Counts[3] );
247 printf(
"Wire = %6d ", Rtl_NtkWireNum(
p) );
248 printf(
"Cell = %6d ", Rtl_NtkCellNum(
p) );
249 printf(
"Con = %6d", Rtl_NtkConNum(
p) );
267 Vec_Int_t * vFound = Vec_IntAlloc( 100 );
269 for ( i = 0; i < 5*(nOffset-1); i++ )
273 printf(
"%s\n", Rtl_NtkName(
p) );
279 if ( Vec_IntFind(vFound, pModel->
NameId) >= 0 )
281 Vec_IntPush( vFound, pModel->
NameId );
284 Vec_IntFree( vFound );
289 printf(
"Hierarchy found in \"%s\":\n",
p->pSpec );
293 printf(
"MODULE %d: ", i );
312 p->vNtks = Vec_PtrAlloc( 100 );
313 Vec_IntGrow( &
p->vConsts, 1000 );
314 Vec_IntGrow( &
p->vSlices, 1000 );
315 Vec_IntGrow( &
p->vConcats, 1000 );
329 Vec_IntFreeP( &
p->vMap );
330 Vec_IntFreeP( &
p->vDirects );
331 Vec_IntFreeP( &
p->vInverses );
332 Vec_IntFreeP( &
p->vTokens );
334 Vec_PtrFree(
p->vNtks );
342 if ( pNtk->
NameId == NameId )
348 char * pName = Rtl_LibStr(
p, NameId );
353 if (
strstr(Rtl_NtkName(pNtk), pName+1) )
356 if ( Counts[1] == Counts0[1] && Counts[3] == Counts0[3] )
365 return (iNtk1 << 16) | iNtk1;
366 else if ( iNtk1 == -1 )
370 int Counts1[4] = {0}, Counts2[4] = {0};
380 if ( Counts1[1] != Counts2[1] || Counts1[3] != Counts2[3] )
382 return (iNtk1 << 16) | iNtk2;
389 printf(
"Modules found in \"%s\":\n",
p->pSpec );
391 nSymbs = Abc_MaxInt( nSymbs,
strlen(Rtl_NtkName(pNtk)) );
427static inline char * Rtl_Num2Name(
int i )
429 if ( i == 1 )
return "module";
430 if ( i == 2 )
return "end";
431 if ( i == 3 )
return "input";
432 if ( i == 4 )
return "output";
433 if ( i == 5 )
return "inout";
434 if ( i == 6 )
return "upto";
435 if ( i == 7 )
return "signed";
436 if ( i == 8 )
return "offset";
437 if ( i == 9 )
return "parameter";
438 if ( i == 10 )
return "wire";
439 if ( i == 11 )
return "connect";
440 if ( i == 12 )
return "cell";
441 if ( i == 13 )
return "width";
442 if ( i == 14 )
return "attribute";
446static inline void Rtl_LibDeriveMap(
Rtl_Lib_t *
p )
525 char * pType = Rtl_NtkStr(
p, Type );
526 if ( pType[0] ==
'$' &&
strncmp(pType,
"$paramod",
strlen(
"$paramod")) )
544 int i, * pWire, nBits = 0;
548 pWire[4] = nBits, nBits += Rtl_WireWidth(
p, i);
556 for ( i = 0; i < Rtl_NtkWireNum(
p); i++ )
558 int NameId = Rtl_WireName(
p, i );
559 assert( Vec_IntEntry(
p->pLib->vMap, NameId) == (fUnmap ? i : -1) );
560 Vec_IntWriteEntry(
p->pLib->vMap, NameId, fUnmap ? -1 : i );
570 for ( i =
p->Slice0; i < p->Slice1; i += 3 )
572 int NameId = Vec_IntEntry( &
p->pLib->vSlices, i );
573 int Left = Vec_IntEntry( &
p->pLib->vSlices, i+1 );
574 int Right = Vec_IntEntry( &
p->pLib->vSlices, i+2 );
575 int Wire = Rtl_WireMapNameToId(
p, NameId );
576 int Offset = Rtl_WireOffset(
p, Wire );
577 int First = Rtl_WireFirst(
p, Wire );
578 assert( First >> 4 == NameId );
586 Vec_IntWriteEntry( &
p->pLib->vSlices, i+1, Right );
587 Vec_IntWriteEntry( &
p->pLib->vSlices, i+2, Left );
592 Vec_IntWriteEntry( &
p->vWires,
WIRE_NUM*i+0, Rtl_WireFirst(
p, i) & ~0x8 );
593 Vec_IntWriteEntry( &
p->vWires,
WIRE_NUM*i+2, 0 );
600 if ( pLib->
vMap == NULL )
621 int i, * pWire, * pPerm = NULL, Count = 0;
624 int First = Rtl_WireFirst(
p, i );
625 int Number = Rtl_WireNumber(
p, i );
626 int fIsPi = (int)((First & 1) > 0);
627 int fIsPo = (int)((First & 2) > 0);
628 assert( (fIsPi || fIsPo) == (Number > 0) );
629 if ( fIsPi || fIsPo )
635 Vec_IntFree( vCost );
640 Vec_Int_t * vTemp = Vec_IntAlloc( Vec_IntSize(&
p->vWires) );
644 pWire = Vec_IntEntryP( &
p->vWires,
WIRE_NUM*pPerm[i] );
646 Vec_IntPush( vTemp, pWire[k] );
649 assert( Vec_IntSize(&
p->vWires) == Vec_IntSize(vTemp) );
651 Vec_IntFree( vTemp );
657 int i, k, Par, Val, * pCell, Value;
664 Vec_IntWriteEntry( vMap, Par >> 2, k );
665 Vec_IntClear( vTemp );
666 for ( k = 0; k < pCell[6]; k++ )
668 int Perm = Vec_IntEntry( vMap, Rtl_WireName(pModel, k) );
669 int Par = pCell[
CELL_NUM+2*(pCell[4]+pCell[5]+Perm)];
670 int Val = pCell[
CELL_NUM+2*(pCell[4]+pCell[5]+Perm)+1];
671 assert( (Par >> 2) == Rtl_WireName(pModel, k) );
672 Vec_IntWriteEntry( vMap, Par >> 2, -1 );
673 Vec_IntPushTwo( vTemp, Par, Val );
676 memcpy( pCell+
CELL_NUM+2*(pCell[4]+pCell[5]), Vec_IntArray(vTemp),
sizeof(
int)*Vec_IntSize(vTemp) );
684 if ( pLib->
vMap == NULL )
708 int Wire = Rtl_WireMapNameToId(
p, NameId );
709 int Width = Rtl_WireWidth(
p, Wire );
714 return pSlice[1] - pSlice[2] + 1;
719 for ( i = 1; i <= pConcat[0]; i++ )
725 if ( Rtl_SigIsNone(Sig) )
727 if ( Rtl_SigIsSlice(Sig) )
729 if ( Rtl_SigIsConcat(Sig) )
731 if ( Rtl_SigIsConst(Sig) )
751 int Wire = Rtl_WireMapNameToId(
p, NameId );
752 int First = Rtl_WireBitStart(
p, Wire );
753 int Width = Rtl_WireWidth(
p, Wire ), i;
754 Left = Left == -1 ? Width-1 : Left;
755 Right = Right == -1 ? 0 : Right;
756 assert ( Right <= Left && Right >= 0 );
757 for ( i = Right; i <= Left; i++ )
758 if ( Vec_IntEntry(&
p->vLits, First+i) == -1 )
769 for ( i = 1; i <= pConcat[0]; i++ )
776 if ( Rtl_SigIsNone(Sig) )
778 else if ( Rtl_SigIsConst(Sig) )
780 else if ( Rtl_SigIsSlice(Sig) )
782 else if ( Rtl_SigIsConcat(Sig) )
794 int Wire = Rtl_WireMapNameToId(
p, NameId );
795 int First = Rtl_WireBitStart(
p, Wire );
796 int Width = Rtl_WireWidth(
p, Wire ), i;
797 Left = Left == -1 ? Width-1 : Left;
798 Right = Right == -1 ? 0 : Right;
799 assert ( Right <= Left && Right >= 0 );
800 for ( i = Right; i <= Left; i++ )
802 assert( Vec_IntEntry(&
p->vLits, First+i) == -1 );
803 Vec_IntWriteEntry(&
p->vLits, First+i, Value );
814 for ( i = 1; i <= pConcat[0]; i++ )
819 if ( Rtl_SigIsNone(Sig) )
821 else if ( Rtl_SigIsSlice(Sig) )
823 else if ( Rtl_SigIsConcat(Sig) )
825 else if ( Rtl_SigIsConst(Sig) )
833 for ( i = 0; i <
p->nInputs; i++ )
835 int First = Rtl_WireBitStart(
p, i );
836 int Width = Rtl_WireWidth(
p, i );
837 for ( b = 0; b < Width; b++ )
839 assert( Vec_IntEntry(&
p->vLits, First+b) == -1 );
840 Vec_IntWriteEntry( &
p->vLits, First+b, Vec_IntSize(&
p->vOrder) );
842 Vec_IntPush( &
p->vOrder, i );
851 for ( i = 0; i <
p->nOutputs; i++ )
854 int First = Rtl_WireBitStart(
p,
p->nInputs + i );
855 int Width = Rtl_WireWidth(
p,
p->nInputs + i );
856 for ( b = 0; b < Width; b++ )
858 assert( Vec_IntEntry(&
p->vLits, First+b) != -1 );
859 Vec_IntPush( vRes, Vec_IntEntry(&
p->vLits, First+b) );
866 int i, k, Par, Val, * pCell, RetValue = 0;
874 if ( k < Rtl_CellInputNum(pCell) )
878 Vec_IntPush( &
p->vOrder,
p->nInputs + i );
887 int i, * pCon, RetValue = 0;
892 if ( Status0 == Status1 )
894 if ( !Status0 && Status1 )
897 Vec_IntPush( &
p->vOrder,
p->nInputs + Rtl_NtkCellNum(
p) + i );
907 printf(
"%4d : ", i );
908 printf(
"Cell %4d ", iCell );
909 if ( iCell < p->nInputs )
910 printf(
"Type Input " );
911 else if ( iCell < p->nInputs + Rtl_NtkCellNum(
p) )
913 int * pCell = Rtl_NtkCell(
p, iCell -
p->nInputs );
914 printf(
"Type %4d ", Rtl_CellType(pCell) );
915 printf(
"%16s ", Rtl_CellTypeStr(
p, pCell) );
916 printf(
"%16s ", Rtl_CellNameStr(
p, pCell) );
919 printf(
"Type Connection " );
926 printf(
"\n*** Printing unused cells:\n" );
931 printf(
"Unused cell %s %s\n", Rtl_CellTypeStr(
p, pCell), Rtl_CellNameStr(
p, pCell) );
939 Vec_IntFill( &
p->vLits, nBits, -1 );
941 Vec_IntClear( &
p->vOrder );
942 Vec_IntGrow( &
p->vOrder, Rtl_NtkObjNum(
p) );
960 if ( pLib->
vMap == NULL )
981 int i, Length =
strlen(
p), Quote = 0;
982 for ( i = 0; i < Length; i++ )
985 else if ( Quote &&
p[i] ==
' ' )
991 assert(
p[0] ==
'\"' &&
p[Length-1] ==
'\"' );
992 for ( i = 1; i < Length-1; i++ )
999 char * pTemp, * pBuffer;
1000 FILE * pFile = fopen( pFileName,
"rb" );
1001 if ( pFile == NULL )
1003 printf(
"Cannot open file \"%s\" for reading.\n", pFileName );
1009 vTokens = Vec_IntAlloc( 1000 );
1010 while ( fgets( pBuffer,
MAX_LINE, pFile ) != NULL )
1012 if ( pBuffer[0] ==
'#' )
1015 pTemp =
strtok( pBuffer,
" \t\r\n" );
1016 if ( pTemp == NULL )
1022 pTemp =
strtok( NULL,
" \t\r\n" );
1024 Vec_IntPush( vTokens, -1 );
1050 if ( pConst[0] == -1 )
1052 fprintf( Rtl_NtkFile(
p),
" %d", pConst[1] );
1055 fprintf( Rtl_NtkFile(
p),
" %d\'", pConst[0] );
1056 for ( i = pConst[0] - 1; i >= 0; i-- )
1057 fprintf( Rtl_NtkFile(
p),
"%d", Abc_InfoHasBit((
unsigned *)pConst+1,i) );
1061 fprintf( Rtl_NtkFile(
p),
" %s", Rtl_NtkStr(
p, pSlice[0]) );
1062 if ( pSlice[1] == pSlice[2] )
1063 fprintf( Rtl_NtkFile(
p),
" [%d]", pSlice[1] );
1065 fprintf( Rtl_NtkFile(
p),
" [%d:%d]", pSlice[1], pSlice[2] );
1070 fprintf( Rtl_NtkFile(
p),
" {" );
1071 for ( i = 1; i <= pConcat[0]; i++ )
1073 fprintf( Rtl_NtkFile(
p),
" }" );
1077 if ( Rtl_SigIsNone(Sig) )
1078 fprintf( Rtl_NtkFile(
p),
" %s", Rtl_NtkStr(
p, Sig >> 2) );
1079 else if ( Rtl_SigIsConst(Sig) )
1081 else if ( Rtl_SigIsSlice(Sig) )
1083 else if ( Rtl_SigIsConcat(Sig) )
1089 fprintf( Rtl_NtkFile(
p),
" wire" );
1090 if ( pWire[1] != 1 ) fprintf( Rtl_NtkFile(
p),
" width %d", pWire[1] );
1091 if ( pWire[2] != 0 ) fprintf( Rtl_NtkFile(
p),
" offset %d", pWire[2] );
1092 if ( pWire[0] & 8 ) fprintf( Rtl_NtkFile(
p),
" upto" );
1093 if ( pWire[0] & 1 ) fprintf( Rtl_NtkFile(
p),
" input %d", pWire[3] );
1094 if ( pWire[0] & 2 ) fprintf( Rtl_NtkFile(
p),
" output %d", pWire[3] );
1095 if ( pWire[0] & 4 ) fprintf( Rtl_NtkFile(
p),
" signed" );
1096 fprintf( Rtl_NtkFile(
p),
" %s\n", Rtl_NtkStr(
p, pWire[0] >> 4) );
1102 fprintf( Rtl_NtkFile(
p),
" attribute %s %s\n", Rtl_NtkStr(
p, Par), Rtl_NtkStr(
p, Val) ); }
1103 fprintf( Rtl_NtkFile(
p),
" cell %s %s\n", Rtl_NtkStr(
p, Rtl_CellType(pCell)), Rtl_NtkStr(
p, pCell[1]) );
1108 fprintf( Rtl_NtkFile(
p),
" end\n" );
1112 fprintf( Rtl_NtkFile(
p),
" connect" );
1115 fprintf( Rtl_NtkFile(
p),
"\n" );
1119 int i, Par, Val, * pWire, * pCell, * pCon;
1120 fprintf( Rtl_NtkFile(
p),
"\n" );
1122 fprintf( Rtl_NtkFile(
p),
"attribute %s %s\n", Rtl_NtkStr(
p, Par), Rtl_NtkStr(
p, Val) );
1123 fprintf( Rtl_NtkFile(
p),
"module %s\n", Rtl_NtkName(
p) );
1130 fprintf( Rtl_NtkFile(
p),
"end\n" );
1134 p->pFile = pFileName ? fopen( pFileName,
"wb" ) : stdout;
1135 if (
p->pFile == NULL )
1137 printf(
"Cannot open output file \"%s\".\n", pFileName );
1143 fprintf(
p->pFile,
"\n" );
1147 if (
p->pFile != stdout )
1170 int RetVal = Vec_IntSize( vConst );
1171 int Width = atoi( pConst );
1172 assert( pConst[0] >=
'0' && pConst[0] <=
'9' );
1173 if (
strstr(pConst,
"\'") )
1175 int Length =
strlen(pConst);
1176 int nWords = (Width + 31) / 32;
1178 Vec_IntPush( vConst, Width );
1179 Vec_IntFillExtra( vConst, Vec_IntSize(vConst) +
nWords, 0 );
1180 pArray = Vec_IntEntryP( vConst, RetVal + 1 );
1181 for ( i = Length-1; i >= Length-Width; i-- )
1182 if ( pConst[i] ==
'1' )
1183 Abc_InfoSetBit( (
unsigned *)pArray, Length-1-i );
1187 Vec_IntPush( vConst, -1 );
1188 Vec_IntPush( vConst, Width );
1190 return (RetVal << 2) | 1;
1195 int RetVal = Vec_IntSize( vSlice );
1196 int Left = atoi( pSlice+1 );
1197 char * pTwo =
strstr( pSlice,
":" );
1198 int Right = pTwo ? atoi( pTwo+1 ) : Left;
1199 assert( pSlice[0] ==
'[' && pSlice[
strlen(pSlice)-1] ==
']' );
1200 Vec_IntPush( vSlice, NameId );
1201 Vec_IntPush( vSlice, Left );
1202 Vec_IntPush( vSlice, Right );
1203 return (RetVal << 2) | 2;
1208 int RetVal = Vec_IntSize( vConcat );
char * pTok;
1212 Vec_IntPush( vConcat, Sig );
1213 pTok = Rtl_NtkTokStr(
p, *pPos );
1215 while ( pTok[0] !=
'}' );
1216 Vec_IntWriteEntry( vConcat, RetVal, Vec_IntSize(vConcat) - RetVal - 1 );
1217 assert( pTok[0] ==
'}' );
1219 return (RetVal << 2) | 3;
1223 int NameId = Rtl_NtkTokId(
p, *pPos );
1224 char * pSig = Rtl_NtkTokStr(
p, (*pPos)++ );
1225 if ( pSig[0] >=
'0' && pSig[0] <=
'9' )
1227 if ( pSig[0] ==
'{' )
1231 char * pNext = Rtl_NtkTokStr(
p, *pPos );
1232 if ( pNext && pNext[0] ==
'[' )
1243 int i, Entry, Prev = -1;
1244 int Width = 1, Upto = 0, Offset = 0, Out = 0, In = 0, Number = 0, Signed = 0;
1246 Vec_IntClear( &
p->pLib->vAttrTemp );
1252 else if ( Rtl_NtkTokCheck(
p, Entry,
RTL_WIDTH) )
1253 Width = atoi( Rtl_NtkTokStr(
p, ++i) );
1255 Offset = atoi( Rtl_NtkTokStr(
p, ++i) );
1256 else if ( Rtl_NtkTokCheck(
p, Entry,
RTL_INPUT) )
1257 Number = atoi( Rtl_NtkTokStr(
p, ++i) ), In = 1,
p->nInputs++;
1259 Number = atoi( Rtl_NtkTokStr(
p, ++i) ), Out = 1,
p->nOutputs++;
1262 else if ( Rtl_NtkTokCheck(
p, Entry,
RTL_UPTO) )
1267 Vec_IntPush( &
p->vWires, (Prev << 4) | (Upto << 3) | (Signed << 2) | (Out << 1) | (In << 0) );
1268 Vec_IntPush( &
p->vWires, Width );
1269 Vec_IntPush( &
p->vWires, Offset );
1270 Vec_IntPush( &
p->vWires, Number );
1271 Vec_IntPush( &
p->vWires, -1 );
1281 Vec_IntPush( &
p->pLib->vAttrTemp, Rtl_NtkTokId(
p, iPos++) );
1282 Vec_IntPush( &
p->pLib->vAttrTemp, Rtl_NtkTokId(
p, iPos++) );
1292 Vec_IntPush( &
p->vAttrTemp, Vec_IntEntry(
p->vTokens, iPos++) );
1293 Vec_IntPush( &
p->vAttrTemp, Vec_IntEntry(
p->vTokens, iPos++) );
1311 int iPosPars, iPosCons, Par, Val, i, Entry;
1313 Vec_IntPush( &
p->vCells, Vec_IntSize(&
p->vStore) );
1314 Vec_IntPush( &
p->vStore, Rtl_NtkTokId(
p, iPos++) );
1315 Vec_IntPush( &
p->vStore, Rtl_NtkTokId(
p, iPos++) );
1316 Vec_IntPush( &
p->vStore, -1 );
1317 Vec_IntPush( &
p->vStore, -1 );
1318 assert( Vec_IntSize(vAttrs) % 2 == 0 );
1319 Vec_IntPush( &
p->vStore, Vec_IntSize(vAttrs)/2 );
1320 iPosPars = Vec_IntSize(&
p->vStore);
1321 Vec_IntPush( &
p->vStore, 0 );
1322 iPosCons = Vec_IntSize(&
p->vStore);
1323 Vec_IntPush( &
p->vStore, 0 );
1324 Vec_IntPush( &
p->vStore, 0 );
1325 assert( Vec_IntSize(&
p->vStore) == Vec_IntEntryLast(&
p->vCells)+
CELL_NUM );
1326 Vec_IntAppend( &
p->vStore, vAttrs );
1327 Vec_IntClear( vAttrs );
1330 if ( Rtl_NtkTokCheck(
p, Entry,
RTL_END) )
1334 int iPosCount = Rtl_NtkTokCheck(
p, Entry,
RTL_PARAMETER) ? iPosPars : iPosCons;
1335 Vec_IntAddToEntry( &
p->vStore, iPosCount, 1 );
1339 Vec_IntPushTwo( &
p->vStore, Par, Val );
1350 int i, Entry, Count = 0;
1352 if ( Rtl_NtkTokCheck(
p, Entry,
RTL_CELL) )
1354 else if ( Rtl_NtkTokCheck(
p, Entry,
RTL_END) )
1370 p->NameId = Rtl_NtkTokId(
p, Mod );
1371 p->Slice0 = Vec_IntSize( &pLib->
vSlices );
1372 Vec_IntAppend( &
p->vAttrs, vAttrs );
1373 Vec_IntClear( vAttrs );
1376 if ( Rtl_NtkTokCheck(
p, Entry,
RTL_WIRE) )
1380 else if ( Rtl_NtkTokCheck(
p, Entry,
RTL_CELL) )
1385 p->Slice1 = Vec_IntSize( &pLib->
vSlices );
1392 int i, iName, * pCell;
1393 vNames = Vec_IntAlloc( 10 );
1394 vCounts = Vec_IntAlloc( 10 );
1398 iName = Vec_IntFind(vNames, Rtl_CellType(pCell));
1401 iName = Vec_IntSize(vNames);
1402 Vec_IntPush( vNames, Rtl_CellType(pCell) );
1403 Vec_IntPush( vCounts, 0 );
1405 Vec_IntAddToEntry( vCounts, iName, 1 );
1408 printf(
" %s (%d)", Rtl_NtkStr(
p, iName), Vec_IntEntry(vCounts, i) );
1410 Vec_IntFree( vNames );
1411 Vec_IntFree( vCounts );
1415 int i, * pCell, nUndef = 0;
1422 pCell[3] = Rtl_CellModule(pCell) <
ABC_INFINITY ? pCell[6]-1 : Rtl_NtkModule(
p, Rtl_CellModule(pCell)-
ABC_INFINITY)->nInputs;
1426 printf(
"Module \"%s\" has %d blackbox instances: ", Rtl_NtkName(
p), nUndef );
1442 if ( pMod && pMod->
iCopy == -1 )
1446 p->iCopy = Vec_PtrSize(vNew);
1447 Vec_PtrPush( vNew,
p );
1451 Rtl_Ntk_t * pNtk;
int n, i, * pCell, Count = 0;
1455 Rtl_Ntk_t * pMod = Rtl_CellNtk( pNtk, pCell );
1456 if ( pMod && pMod == pOne )
1467 if ( pMod && pMod->
iCopy >= 0 )
1479 Vec_Ptr_t * vNew = Vec_PtrAlloc( Vec_PtrSize(
p->vNtks) );
1484 if ( pNtk->
iCopy == -1 )
1486 assert( Vec_PtrSize(
p->vNtks) == Vec_PtrSize(vNew) );
1488 Vec_PtrClear(
p->vNtks );
1489 Vec_PtrAppend(
p->vNtks, vNew );
1490 Vec_PtrFree( vNew );
1495 p->pSpec = Abc_UtilStrsav( pFileSpec );
1498 Rtl_LibDeriveMap(
p );
1499 Vec_IntClear( &
p->vAttrTemp );
1528 int Wire = Rtl_WireMapNameToId(
p, NameId );
1529 int First = Rtl_WireBitStart(
p, Wire );
1530 int Width = Rtl_WireWidth(
p, Wire ), i;
1531 Left = Left == -1 ? Width-1 : Left;
1532 Right = Right == -1 ? 0 : Right;
1533 assert ( Right >= 0 && Right <= Left );
1534 for ( i = Right; i <= Left; i++ )
1536 assert( Vec_IntEntry(&
p->vDrivers, 2*(First+i)) == -4 );
1537 Vec_IntWriteEntry(&
p->vDrivers, 2*(First+i)+0, iCell );
1538 Vec_IntWriteEntry(&
p->vDrivers, 2*(First+i)+1, iBit + (i - Right) );
1540 return Left - Right + 1;
1549 for ( i = 1; i <= pConcat[0]; i++ )
1556 if ( Rtl_SigIsNone(Sig) )
1558 if ( Rtl_SigIsSlice(Sig) )
1560 if ( Rtl_SigIsConcat(Sig) )
1562 if ( Rtl_SigIsConst(Sig) )
1583 int Wire = Rtl_WireMapNameToId(
p, NameId );
1584 int First = Rtl_WireBitStart(
p, Wire );
1585 int Width = Rtl_WireWidth(
p, Wire ), i;
1586 Left = Left == -1 ? Width-1 : Left;
1587 Right = Right == -1 ? 0 : Right;
1588 assert ( Right >= 0 && Right <= Left );
1589 for ( i = Right; i <= Left; i++ )
1590 Vec_IntPush( &
p->vBitTemp, First+i );
1594 int i, nLimit = pConst[0];
1597 for ( i = 0; i < nLimit; i++ )
1598 Vec_IntPush( &
p->vBitTemp, Abc_InfoHasBit((
unsigned *)pConst+1,i)-
CONST_SHIFT );
1607 for ( i = pConcat[0]; i >= 1; i-- )
1612 if ( Rtl_SigIsNone(Sig) )
1614 else if ( Rtl_SigIsConst(Sig) )
1616 else if ( Rtl_SigIsSlice(Sig) )
1618 else if ( Rtl_SigIsConcat(Sig) )
1638 int Wire = Rtl_WireMapNameToId(
p, NameId );
1639 int First = Rtl_WireBitStart(
p, Wire );
1640 int Width = Rtl_WireWidth(
p, Wire ), i;
1641 Left = Left == -1 ? Width-1 : Left;
1642 Right = Right == -1 ? 0 : Right;
1643 assert ( Right >= 0 && Right <= Left );
1644 for ( i = Right; i <= Left; i++ )
1646 assert( Vec_IntEntry(&
p->vLits, First+i) != -1 );
1647 Vec_IntPush( &
p->vBitTemp, Vec_IntEntry(&
p->vLits, First+i) );
1652 int i, nLimit = pConst[0];
1655 for ( i = 0; i < nLimit; i++ )
1656 Vec_IntPush( &
p->vBitTemp, Abc_InfoHasBit((
unsigned *)pConst+1,i) );
1665 for ( i = pConcat[0]; i >= 1; i-- )
1670 if ( Rtl_SigIsNone(Sig) )
1672 else if ( Rtl_SigIsConst(Sig) )
1674 else if ( Rtl_SigIsSlice(Sig) )
1676 else if ( Rtl_SigIsConcat(Sig) )
1687 int Wire = Rtl_WireMapNameToId(
p, NameId );
1688 int First = Rtl_WireBitStart(
p, Wire );
1689 int Width = Rtl_WireWidth(
p, Wire ), i, k = 0;
1690 Left = Left == -1 ? Width-1 : Left;
1691 Right = Right == -1 ? 0 : Right;
1692 assert ( Right >= 0 && Right <= Left );
1693 for ( i = Right; i <= Left; i++ )
1695 assert( Vec_IntEntry(&
p->vLits, First+i) == -1 );
1696 Vec_IntWriteEntry(&
p->vLits, First+i, pLits[k++] );
1708 for ( i = 1; i <= pConcat[0]; i++ )
1716 if ( Rtl_SigIsNone(Sig) )
1718 if ( Rtl_SigIsSlice(Sig) )
1720 if ( Rtl_SigIsConcat(Sig) )
1722 if ( Rtl_SigIsConst(Sig) )
1724 assert( nBits == nLits );
1741 Vec_Int_t * vNew = Vec_IntAlloc( 100 );
int b, i, Count = 0;
1742 for ( i = 0; i <
p->nInputs; i++ )
1744 int Width = Rtl_WireWidth(
p, i );
1745 for ( b = 0; b < Width; b++ )
1746 Vec_IntPush( vNew, Count + Width-1-b );
1753 Vec_Int_t * vNew = Vec_IntAlloc( 100 );
int b, i, Count = 0;
1754 for ( i = 0; i <
p->nOutputs; i++ )
1756 int Width = Rtl_WireWidth(
p,
p->nInputs + i );
1757 for ( b = 0; b < Width; b++ )
1758 Vec_IntPush( vNew, Count + Width-1-b );
1778 for ( i = 0; i <
p->nInputs; i++ )
1780 int First = Rtl_WireBitStart(
p, i );
1781 int Width = Rtl_WireWidth(
p, i );
1782 for ( b = 0; b < Width; b++ )
1784 assert( Vec_IntEntry(&
p->vLits, First+b) == -1 );
1785 Vec_IntWriteEntry( &
p->vLits, First+b, Gia_ManAppendCi(pNew) );
1792 for ( i = 0; i <
p->nOutputs; i++ )
1794 int First = Rtl_WireBitStart(
p,
p->nInputs + i );
1795 int Width = Rtl_WireWidth(
p,
p->nInputs + i );
1796 for ( b = 0; b < Width; b++ )
1798 assert( Vec_IntEntry(&
p->vLits, First+b) != -1 );
1799 Gia_ManAppendCo( pNew, Vec_IntEntry(&
p->vLits, First+b) );
1806 Vec_IntClear( &
p->vBitTemp );
1809 assert( nBits == Vec_IntSize(&
p->vBitTemp) );
1819 int nIns = 0, nOuts = 0, nOuts1, iFirst1 =
Gia_ManFindFirst( pModel, &nOuts1 );
1820 int k, Par, Val, iThis = -1, nBits = 0;
1822 int fFound =
p->pLib->vInverses && (iThis = Vec_IntFind(
p->pLib->vInverses, pModel->
NameId)) >= 0;
1824 Vec_IntClear( &
p->vBitTemp );
1832 Vec_IntWriteEntry( &
p->vBitTemp, k, (k >= iFirst1 && k < iFirst1 + nOuts1) ? Gia_ManAppendBuf(pNew, Val) : Val );
1833 Vec_IntPush( pNew->
vBarBufs, (nIns << 16) | Abc_Var2Lit(pModel->
NameId, 0) );
1835 else if ( pModel->
fRoot )
1837 nIns = Vec_IntSize(&
p->vBitTemp);
1840 Vec_IntWriteEntry( &
p->vBitTemp, k, Gia_ManAppendBuf(pNew, Val) );
1841 Vec_IntPush( pNew->
vBarBufs, (nIns << 16) | Abc_Var2Lit(pModel->
NameId, 0) );
1843 if ( fFound || pModel->
fRoot )
1850 if ( pModel->
fRoot || fFound )
1852 nOuts = Vec_IntSize(&
p->vBitTemp);
1854 Vec_IntWriteEntry( &
p->vBitTemp, k, Gia_ManAppendBuf(pNew, Val) );
1855 Vec_IntPush( pNew->
vBarBufs, (nOuts << 16) | Abc_Var2Lit(pModel->
NameId, 1) );
1856 printf(
"Added %d input buffers and %d output buffers for module %s.\n", nIns, nOuts, Rtl_NtkName(pModel) );
1860 assert( nBits == Vec_IntSize(&
p->vBitTemp) );
1865 int ParamId = Rtl_NtkStrId(
p, pParam );
1871 if ( (Par >> 2) == ParamId )
1873 assert( Rtl_SigIsConst(Val) );
1874 pConst = Vec_IntEntryP( &
p->pLib->vConsts, Val >> 2 );
1875 assert( pConst[0] < 32 );
1884 int i, Par, Val, ValOut = -1, nBits = 0, nRange = -1;
1891 Vec_IntClear( &
p->pLib->vTemp[i] );
1895 Vec_IntClear( &
p->vBitTemp );
1897 Vec_IntAppend( &
p->pLib->vTemp[i], &
p->vBitTemp );
1899 Rtl_NtkBlastNode( pNew, Rtl_CellModule(pCell), Rtl_CellInputNum(pCell),
p->pLib->vTemp, nRange, fSign0, fSign1 );
1900 assert( Vec_IntSize(vRes) > 0 );
1902 assert( nBits == Vec_IntSize(vRes) );
1907 static char Buffer[1000];
1908 if ( (
int)
strlen(pName) <= nSize )
1913 Buffer[nSize-3] =
'.';
1914 Buffer[nSize-2] =
'.';
1915 Buffer[nSize-1] =
'.';
1916 Buffer[nSize-0] = 0;
1921 printf(
"%s (%c%d) ", Rtl_LibStr(
p, Abc_Lit2Var(Lit&0xFFFF)), Abc_LitIsCompl(Lit)?
'o' :
'i', Lit >> 16 );
1926 if ( Vec_IntSize(vBufs) )
1927 printf(
"Found %d buffers (%d groups): ",
p->pGia->nBufs, Vec_IntSize(vBufs) );
1930 if ( Vec_IntSize(vBufs) )
1938 Vec_IntFill( &
p->vLits, nBits, -1 );
1944 iObj -= Rtl_NtkInputNum(
p);
1947 if ( iObj >= Rtl_NtkCellNum(
p) )
1952 pCell = Rtl_NtkCell(
p, iObj);
1958 printf(
"Cannot blast black box %s in module %s.\n", Rtl_NtkStr(
p, Rtl_CellType(pCell)), Rtl_NtkName(
p) );
1967 char Buffer[100];
static int counter = 0;
1970 printf(
"Dumped \"%s\" with AIG for module %-20s : ", Buffer,
Rtl_ShortenName(Rtl_NtkName(
p), 20) );
1973 printf(
"Derived AIG for module %-20s : ",
Rtl_ShortenName(Rtl_NtkName(
p), 20) );
1981 if (
p->pGia == NULL )
2003 int c, i, iBit0, iBit1, * pCon, * pDri0, * pDri1, nChanges = 0;
2006 Vec_IntClear( &
p->vBitTemp );
2008 Vec_IntClearAppend( &
p->vBitTemp2, &
p->vBitTemp );
2010 Vec_IntClear( &
p->vBitTemp );
2012 assert( Vec_IntSize(&
p->vBitTemp2) == Vec_IntSize(&
p->vBitTemp) );
2016 pDri0 = iBit0 >= 0 ? Vec_IntEntryP(&
p->vDrivers, 2*iBit0) : NULL;
2017 pDri1 = iBit1 >= 0 ? Vec_IntEntryP(&
p->vDrivers, 2*iBit1) : NULL;
2018 assert( iBit0 >= 0 || iBit1 >= 0 );
2021 if ( pDri1[0] == -4 )
2023 assert( pDri1[1] == -4 );
2032 if ( pDri0[0] == -4 )
2034 assert( pDri0[1] == -4 );
2041 if ( pDri0[0] == -4 && pDri1[0] != -4 )
2043 assert( pDri0[1] == -4 );
2049 if ( pDri1[0] == -4 && pDri0[0] != -4 )
2051 assert( pDri1[1] == -4 );
2064 int i, k, Par, Val, * pCell, iBit = 0;
2065 Vec_IntFill( &
p->vDrivers, 2*nBits, -4 );
2066 for ( i = 0; i <
p->nInputs; i++ )
2068 int First = Rtl_WireBitStart(
p, i );
2069 int Width = Rtl_WireWidth(
p, i );
2070 for ( k = 0; k < Width; k++ )
2072 assert( Vec_IntEntry(&
p->vDrivers, 2*(First+k)) == -4 );
2073 Vec_IntWriteEntry(&
p->vDrivers, 2*(First+k)+0, -1 );
2074 Vec_IntWriteEntry(&
p->vDrivers, 2*(First+k)+1, iBit++ );
2083 for ( i = 0; i < 100; i++ )
2087 printf(
"Mapping connections did not succeed after %d iterations.\n", i );
2094 if ( Vec_IntEntry(&
p->vLits, iBit) == -1 )
2096 int * pDriver = Vec_IntEntryP(&
p->vDrivers, 2*iBit);
2097 assert( pDriver[0] != -4 );
2100 assert( Vec_IntEntry(&
p->vLits, iBit) >= 0 );
2101 return Vec_IntEntry(&
p->vLits, iBit);
2105 int i, Par, Val, pLits[3] = {-1, -1, -1}, iBit;
2109 Vec_IntClear( &
p->vBitTemp );
2111 vTemp = Vec_IntDup( &
p->vBitTemp );
2112 iBit = Vec_IntEntry( vTemp, i==2 ? 0 : iInput );
2118 Vec_IntFree( vTemp );
2124 int i, k, Par, Val, iBit;
2128 Vec_IntClear( &
p->vBitTemp );
2130 vTemp = Vec_IntDup( &
p->vBitTemp );
2134 Vec_IntFree( vTemp );
2140 assert( pDriver[0] != -1 );
2141 if ( pDriver[0] == -3 )
2143 int * pDriver1 = Vec_IntEntryP( &
p->vDrivers, 2*pDriver[1] );
2144 if ( Vec_IntEntry(&
p->vLits, pDriver[1]) == -1 )
2146 assert( Vec_IntEntry(&
p->vLits, pDriver[1]) >= 0 );
2147 Vec_IntWriteEntry( &
p->vLits, iBit, Vec_IntEntry(&
p->vLits, pDriver[1]) );
2150 if ( pDriver[0] == -2 )
2152 Vec_IntWriteEntry( &
p->vLits, iBit, pDriver[1] );
2157 int * pCell = Rtl_NtkCell(
p, pDriver[0]);
2158 assert( pDriver[0] >= 0 );
2162 Vec_IntWriteEntry( &
p->vLits, iBit, iLit );
2171 printf(
"Cannot blast black box %s in module %s.\n", Rtl_NtkStr(
p, Rtl_CellType(pCell)), Rtl_NtkName(
p) );
2179 Vec_IntFill( &
p->vLits, nBits, -1 );
2180printf(
"Blasting %s...\r", Rtl_NtkName(
p) );
2185 p->pGia->vBarBufs = Vec_IntAlloc( 1000 );
2188 for ( i = 0; i <
p->nOutputs; i++ )
2190 int First = Rtl_WireBitStart(
p,
p->nInputs + i );
2191 int Width = Rtl_WireWidth(
p,
p->nInputs + i );
2192 for ( b = 0; b < Width; b++ )
2205 char Buffer[100];
static int counter = 0;
2208 printf(
"Dumped \"%s\" with AIG for module %-20s : ", Buffer,
Rtl_ShortenName(Rtl_NtkName(
p), 20) );
2211 printf(
"Derived AIG for module %-20s : ",
Rtl_ShortenName(Rtl_NtkName(
p), 20) );
2218 if ( pNtk->
iCopy == -1 )
2222 Rtl_Ntk_t * pMod = Rtl_CellNtk( pNtk, pCell );
2240 Rtl_Ntk_t * pNtk = Rtl_LibNtk(pLib, iNtk);
2246 if ( pNtk->
iCopy == -1 && pNtk->
pGia == NULL )
2262 Vec_Int_t * vLevel;
int i, iNtk1, iNtk2;
2268 int Type = Vec_IntEntry( vLevel, 1 );
2269 int Name1 = Vec_IntEntry( vLevel, 2 );
2270 int Name2 = Vec_IntEntry( vLevel, 3 );
2274 printf(
"Cannot find networks \"%s\" and \"%s\" in the design.\n", Rtl_LibStr(
p, Name1), Rtl_LibStr(
p, Name2) );
2277 if ( Type != Rtl_LibStrId(
p,
"equal") )
2280 iNtk2 = iNtk & 0xFFFF;
2281 pNtk1 = Rtl_LibNtk(
p, iNtk1);
2282 pNtk2 = Rtl_LibNtk(
p, iNtk2);
2283 pNtk1->
iCopy = iNtk2;
2284 if ( iNtk1 == iNtk2 )
2285 printf(
"Preparing to prove \"%s\".\n", Rtl_NtkName(pNtk1) );
2287 printf(
"Preparing to replace \"%s\" by \"%s\".\n", Rtl_NtkName(pNtk1), Rtl_NtkName(pNtk2) );
2307 int i, k, Status, fFound = 0;
2308 printf(
"Performing preprocessing for verification.\n" );
2315 if ( Gia_ManCiNum(p1->pGia) != Gia_ManCiNum(p2->pGia) ||
2316 Gia_ManCoNum(p1->pGia) != Gia_ManCoNum(p2->pGia) )
2322 printf(
"Proved equivalent modules: %s == %s\n", Rtl_NtkName(p1), Rtl_NtkName(p2) );
2324 if ( Gia_ManAndNum(p1->pGia) > Gia_ManAndNum(p2->pGia) )
2326 assert( Gia_ManAndNum(p1->pGia) <= Gia_ManAndNum(p2->pGia) );
2334 printf(
"Preprocessing not succeded.\n" );
2335 Abc_PrintTime( 1,
"Preprocessing time", Abc_Clock() - clk );
2338 if (
p != p1 &&
p != p2 )
2346 abctime clk = Abc_Clock();
int Status;
2350 int RetValue = Gia_ManAndNum(pSwp);
2351 char * pFileName =
"miter_to_solve.aig";
2352 printf(
"Dumped the miter into file \"%s\".\n", pFileName );
2356 if ( RetValue == 0 )
2357 printf(
"Verification problem solved after SAT sweeping! " );
2362 Gia_ManAppendCo( pCopy, 0 );
2366 printf(
"Verification problem solved after CEC! " );
2368 printf(
"Verification problem is NOT solved (miter has %d nodes)! ", RetValue );
2370 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
2390 printf(
"\nProving equivalence of \"%s\" and \"%s\"...\n", Rtl_NtkName(pNtk1), Rtl_NtkName(pNtk2) );
2391 if ( Gia_ManCiNum(pNtk1->
pGia) != Gia_ManCiNum(pNtk2->
pGia) ||
2392 Gia_ManCoNum(pNtk1->
pGia) != Gia_ManCoNum(pNtk2->
pGia) )
2394 printf(
"The number of inputs/outputs does not match.\n" );
2400 Abc_Print( 1,
"Networks are equivalent after collapsing. " );
2405 if ( Gia_ManAndNum(pNew) == 0 )
2406 Abc_Print( 1,
"Networks are equivalent. " );
2408 Abc_Print( 1,
"Networks are UNDECIDED. " );
2417 printf(
"The networks are equivalent. " );
2419 printf(
"The networks are NOT equivalent. " );
2421 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
2425 int i, * pWire, Counts[4] = {0}, nBits = 0;
2430 Counts[0]++, Counts[1] += pWire[1];
2432 Counts[2]++, Counts[3] += pWire[1];
2434 assert(
p->nInputs == Counts[0] );
2435 assert(
p->nOutputs == Counts[2] );
2436 *pnOuts = Counts[3];
2441 if ( pWire[1] == Counts[3] )
2450 Vec_Int_t * vPiPerm = Vec_IntAlloc( Gia_ManPiNum(pGia) );
2452 for ( n = 0; n < 2; n++ )
2453 for ( i = 0; i < Gia_ManPiNum(pGia); i++ )
2454 if ( n == (i >= iFirst && i < iFirst + nBits) )
2455 Vec_IntPush( vPiPerm, i );
2459 Vec_IntFree( vPiPerm );
2466 assert( iFirst >= 0 && iFirst + nBufs < p->nBufs );
2469 if ( Gia_ObjIsBuf(pObj) && iBuf >= iFirst && iBuf < iFirst + nBufs )
2470 Vec_IntPush( vRes, i );
2471 iBuf += Gia_ObjIsBuf(pObj);
2479 Vec_Int_t * vMap = Vec_IntStartFull( Gia_ManObjNum(
p) );
2485 printf(
"Reducing %d buffers... Size(vOne) = %d. Size(vTwo) = %d. \n",
p->nBufs, Vec_IntSize(vOne), Vec_IntSize(vTwo) );
2488 Vec_IntWriteEntry( vMap, Two, One );
2489 Vec_IntFree( vOne );
2490 Vec_IntFree( vTwo );
2495 Vec_IntFree( vMap );
2505 int Res = printf(
"\nProving inverse equivalence of \"%s\" and \"%s\".\n", Rtl_NtkName(pNtk1), Rtl_NtkName(pNtk2) );
2512 char * pFileName =
"inv_miter.aig";
2516 printf(
"Dumping inverse miter into file \"%s\".\n", pFileName );
2518 printf(
"Dumped the miter into file \"%s\".\n", pFileName );
2520 Abc_Print( 1,
"Networks are equivalent after collapsing. " );
2526 if ( Gia_ManAndNum(pNew) == 0 )
2527 Abc_Print( 1,
"Networks are equivalent. " );
2529 Abc_Print( 1,
"Networks are UNDECIDED. " );
2539 printf(
"The networks are equivalent. " );
2541 printf(
"The networks are NOT equivalent. " );
2546 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
2551 printf(
"\nProving property \"%s\".\n", Rtl_NtkName(pNtk) );
2558 Vec_Int_t * vRoots = Vec_IntAlloc( 100 );
2561 int Name1 = Vec_IntEntry( vLevel, 2 );
2562 int Name2 = Vec_IntEntry( vLevel, 3 );
2566 printf(
"Cannot find networks \"%s\" and \"%s\" in the design.\n", Rtl_LibStr(
p, Name1), Rtl_LibStr(
p, Name2) );
2577 Vec_IntPushTwo( vRoots, iNtk >> 16, iNtk & 0xFFFF );
2585 Vec_Int_t * vRoots, * vLevel;
int i, iNtk1, iNtk2, fInv = 0;
2587 if ( Vec_IntEntry( vLevel, 1 ) == Rtl_LibStrId(
p,
"inverse") )
2597 int Prove = Vec_IntEntry( vLevel, 0 );
2598 int Type = Vec_IntEntry( vLevel, 1 );
2599 int Name1 = Vec_IntEntry( vLevel, 2 );
2600 int Name2 = Vec_IntEntry( vLevel, 3 );
2604 printf(
"Cannot find networks \"%s\" and \"%s\" in the design.\n", Rtl_LibStr(
p, Name1), Rtl_LibStr(
p, Name2) );
2608 iNtk2 = iNtk & 0xFFFF;
2609 if ( Prove != Rtl_LibStrId(
p,
"prove") )
2610 printf(
"Unknown task in line %d.\n", i );
2615 if ( Type == Rtl_LibStrId(
p,
"equal") )
2617 else if ( Type == Rtl_LibStrId(
p,
"inverse") )
2619 else if ( Type == Rtl_LibStrId(
p,
"property") )
2626 Vec_WecFree( vGuide );
2627 Vec_IntFree( vRoots );
2642static inline void Gia_ManPatchBufDriver(
Gia_Man_t *
p,
int iObj,
int iLit0 )
2645 assert( iObj > Abc_Lit2Var(iLit0) );
2646 pObj->
iDiff0 = pObj->
iDiff1 = iObj - Abc_Lit2Var(iLit0);
2654 Vec_Wec_t * vBufs = Vec_WecStart( Vec_IntSize(
p->vBarBufs) );
2655 Vec_Int_t * vPairs = Vec_IntAlloc( 10 );
2656 Vec_Int_t * vTypes = Vec_IntAlloc(
p->nBufs );
2657 Vec_Int_t * vMap = Vec_IntStartFull( Gia_ManObjNum(
p) );
2658 Gia_Obj_t * pObj;
int i, k = 0, Entry, Buf0, Buf1, fChange = 1;
2660 Vec_IntFillExtra( vTypes, Vec_IntSize(vTypes) + (Entry >> 16), i );
2661 assert( Vec_IntSize(vTypes) ==
p->nBufs );
2663 if ( Gia_ObjIsBuf(pObj) )
2665 Vec_WecPush( vBufs, Vec_IntEntry(vTypes, k), i );
2666 Vec_IntWriteEntry( vMap, i, Vec_IntEntry(vTypes, k++) );
2670 if ( Gia_ObjIsBuf(pObj) && Gia_ObjIsBuf(Gia_ObjFanin0(pObj)) )
2671 Vec_IntPushUnique( vPairs, (Vec_IntEntry(vMap, Gia_ObjFaninId0(pObj, i)) << 16) | (Vec_IntEntry(vMap, i) & 0xFFFF) );
2674 printf(
"Connected boundaries:\n" );
2677 printf(
"%2d -> %2d : ", Entry >> 16, Entry & 0xFFFF );
2686 int Entry1, Entry2, j;
2689 if ( (Entry1 & 0xFFFF) + 1 == (Entry2 >> 16) )
2691 Vec_IntWriteEntry( vPairs, j, ((Entry1 >> 16) << 16) | (Entry2 & 0xFFFF) );
2692 Vec_IntDrop( vPairs, j+1 );
2701 Vec_IntWriteEntry( vPairs, i, (((Entry >> 16) - 1) << 16) | ((Entry & 0xFFFF) + 1) );
2707 printf(
"Transformed boundaries:\n" );
2710 printf(
"%2d -> %2d : ", Entry >> 16, Entry & 0xFFFF );
2719 Vec_Int_t * vLevel0 = Vec_WecEntry( vBufs, Entry >> 16 );
2720 Vec_Int_t * vLevel1 = Vec_WecEntry( vBufs, Entry & 0xFFFF );
2722 Gia_ManPatchBufDriver(
p, Buf1, Gia_ObjFaninLit0(Gia_ManObj(
p, Buf0), Buf0) );
2725 Vec_IntFree( vPairs );
2726 Vec_IntFree( vTypes );
2727 Vec_IntFree( vMap );
2728 Vec_WecFree( vBufs );
2748 assert( Vec_IntSize(vPermI) == Gia_ManCiNum(
p) );
2749 assert( Vec_IntSize(vPermO) == Gia_ManCoNum(
p) );
2751 pNew->
pName = Abc_UtilStrsav(
p->pName);
2752 Gia_ManConst0(
p)->Value = 0;
2754 Gia_ManCi(
p, Vec_IntEntry(vPermI, i))->Value = Gia_ManAppendCi(pNew);
2757 if ( Gia_ObjIsBuf(pObj) )
2758 pObj->
Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
2760 pObj->
Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2764 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManCo(
p, Vec_IntEntry(vPermO, i))) );
2785 printf(
"Cannot find module \"%s\" in the current design.\n", pModule );
2797 printf(
"Cannot find top module \"%s\".\n", pTopModule );
2805 Vec_IntPush( vRoots, iNtk );
2814 Vec_IntFree( vPermI );
2815 Vec_IntFree( vPermO );
2821 printf(
"Derived global AIG for the top module \"%s\". ", Rtl_NtkStr(pTop, NameId) );
2822 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
2825 Vec_IntFree( vRoots );
2849 if ( nModules == 0 )
2854 Vec_IntFreeP( &
p->vInverses );
2864 pNtk2->
iCopy = iNtk1;
2870 Vec_IntFreeP( &
p->vDirects );
2880 printf(
"Cannot find networks \"%s\" and \"%s\" in the design.\n", Rtl_LibStr(
p, Name1), Rtl_LibStr(
p, Name2) );
2885 int iNtk1 = iNtk >> 16;
2886 int iNtk2 = iNtk & 0xFFFF;
2889 assert( iNtk1 != iNtk2 );
2892 printf(
"Setting \"%s\" (appearing %d times) and \"%s\" (appearing %d times) as inverse-equivalent.\n",
2894 if (
p->vInverses == NULL )
2895 p->vInverses = Vec_IntAlloc( 10 );
2896 Vec_IntPushTwo(
p->vInverses, pNtk1->
NameId, pNtk2->
NameId );
2900 printf(
"Replacing \"%s\" (appearing %d times) by \"%s\" (appearing %d times).\n",
2902 pNtk1->
iCopy = iNtk2;
2906 if (
p->vDirects == NULL )
2907 p->vDirects = Vec_IntAlloc( 10 );
2908 Vec_IntPushTwo(
p->vDirects, pNtk1->
NameId, pNtk2->
NameId );
2928 if ( nModules == 0 )
2931 for ( i = 0; i < nModules; i++ )
2936 pNtk = Rtl_LibNtk(
p, iNtk );
2938 printf(
"Marking module \"%s\" (appearing %d times in the hierarchy).\n", ppModule[i],
Rtl_LibCountInsts(
p, pNtk) );
#define ABC_SWAP(Type, a, b)
int * Abc_MergeSortCost(int *pCosts, int nSize)
#define ABC_ALLOC(type, num)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
int Cec_ManVerifyTwoInv(Gia_Man_t *p0, Gia_Man_t *p1, int fVerbose)
int Cec_ManVerifySimple(Gia_Man_t *p)
int Cec_ManVerifyTwo(Gia_Man_t *p0, Gia_Man_t *p1, int fVerbose)
void Gia_ManDupRebuild(Gia_Man_t *pNew, Gia_Man_t *p, Vec_Int_t *vLits, int fBufs)
#define MAX_LINE
DECLARATIONS ///.
void Gia_ManStop(Gia_Man_t *p)
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
#define Gia_ManForEachAnd(p, pObj, i)
void Gia_ManStopP(Gia_Man_t **p)
void Gia_ManHashAlloc(Gia_Man_t *p)
Gia_Man_t * Gia_ManRehash(Gia_Man_t *p, int fAddStrash)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
struct Gia_Obj_t_ Gia_Obj_t
Gia_Man_t * Gia_ManDupPerm(Gia_Man_t *p, Vec_Int_t *vPiPerm)
void Gia_ManInvertPos(Gia_Man_t *pAig)
struct Gia_Man_t_ Gia_Man_t
Gia_Man_t * Gia_ManDupMap(Gia_Man_t *p, Vec_Int_t *vMap)
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Gia_Man_t * Gia_ManDupNoBuf(Gia_Man_t *p)
Gia_Man_t * Gia_ManMiterInverse(Gia_Man_t *pBot, Gia_Man_t *pTop, int fDualOut, int fVerbose)
Gia_Man_t * Gia_ManMiter(Gia_Man_t *pAig0, Gia_Man_t *pAig1, int nInsDup, int fDualOut, int fSeq, int fImplic, int fVerbose)
#define Gia_ManForEachCo(p, pObj, i)
#define Gia_ManForEachCi(p, pObj, i)
void Gia_ManHashStop(Gia_Man_t *p)
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
Vec_Int_t vTemp[TEMP_NUM]
int Abc_NamStrFind(Abc_Nam_t *p, char *pStr)
void Abc_NamStop(Abc_Nam_t *p)
int Abc_NamStrFindOrAdd(Abc_Nam_t *p, char *pStr, int *pfFound)
int Abc_NamObjNumMax(Abc_Nam_t *p)
Abc_Nam_t * Abc_NamStart(int nObjs, int nAveSize)
FUNCTION DEFINITIONS ///.
char * Abc_NamStr(Abc_Nam_t *p, int NameId)
typedefABC_NAMESPACE_HEADER_START struct Abc_Nam_t_ Abc_Nam_t
INCLUDES ///.
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryTwo(vVec1, vVec2, Entry1, Entry2, i)
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
void Rtl_NtkBlastNode(Gia_Man_t *pNew, int Type, int nIns, Vec_Int_t *vDatas, int nRange, int fSign0, int fSign1)
Vec_Wec_t * Wln_ReadGuidance(char *pFileName, Abc_Nam_t *p)
Gia_Man_t * Gia_ManMoveSharedFirst(Gia_Man_t *pGia, int iFirst, int nBits)
int Rtl_NtkReadConst(Rtl_Ntk_t *p, char *pConst)
void Rtl_NtkPrintSig(Rtl_Ntk_t *p, int Sig)
Vec_Int_t * Rtl_NtkRevPermOutput(Rtl_Ntk_t *p)
void Rtl_LibFree(Rtl_Lib_t *p)
int Rtl_NtkReadType(Rtl_Ntk_t *p, int Type)
Rtl_Ntk_t * Rtl_NtkAlloc(Rtl_Lib_t *pLib)
FUNCTION DEFINITIONS ///.
void Rtl_NtkPrintCell(Rtl_Ntk_t *p, int *pCell)
#define Rtl_NtkForEachAttr(p, Par, Val, i)
void Rtl_NtkPrintConst(Rtl_Ntk_t *p, int *pConst)
void Rtl_NtkBlastMap(Rtl_Ntk_t *p, int nBits)
int Rtl_NtkInsertSignalRange(Rtl_Ntk_t *p, int Sig, int *pLits, int nLits)
int Abc_NtkFromGiaCollapse(Gia_Man_t *pGia)
#define Rtl_CellForEachParam(p, pCell, Par, Val, i)
int * Rlt_NtkFindIOPerm(Rtl_Ntk_t *p)
int Rtl_NtkCountSliceRange(Rtl_Ntk_t *p, int *pSlice)
int Rtl_LibFindTwoModules(Rtl_Lib_t *p, int Name1, int Name2)
void Rtl_LibOrderCells(Rtl_Lib_t *pLib)
void Rtl_LibSolve(Rtl_Lib_t *pLib, void *pNtk)
void Rtl_NtkPrintHieStats(Rtl_Ntk_t *p, int nOffset)
void Rtl_NtkPrintWire(Rtl_Ntk_t *p, int *pWire)
int Rtl_NtkInsertConcatRange(Rtl_Ntk_t *p, int *pConcat, int *pLits, int nLits)
void Rtl_TokenUnspace(char *p)
void Rtl_NtkBlastOutputs(Gia_Man_t *pNew, Rtl_Ntk_t *p)
void Rtl_NtkSetWireRange(Rtl_Ntk_t *p, int NameId, int Left, int Right, int Value)
Gia_Man_t * Rtl_LibCollapse(Rtl_Lib_t *p, char *pTopModule, int fRev, int fVerbose)
void Rtl_NtkCollectConstInfo(Rtl_Ntk_t *p, int *pConst)
void Rtl_LibPrintHieStats(Rtl_Lib_t *p)
void Rtl_NtkSetSliceRange(Rtl_Ntk_t *p, int *pSlice, int Value)
int Rtl_NtkCountConcatRange(Rtl_Ntk_t *p, int *pConcat)
#define Rtl_CellForEachAttr(p, pCell, Par, Val, i)
void Rtl_LibMark_rec(Rtl_Ntk_t *pNtk)
int Rtl_NtkMapSignalRange(Rtl_Ntk_t *p, int Sig, int iCell, int iBit)
#define Rtl_NtkForEachWire(p, pWire, i)
int Rtl_NtkReadAttribute2(Rtl_Lib_t *p, int iPos)
void Rtl_LibBlastClean(Rtl_Lib_t *p)
Gia_Man_t * Rtl_NtkBlast(Rtl_Ntk_t *p)
void Rtl_NtkCollectSignalRange(Rtl_Ntk_t *p, int Sig)
void Rtl_NtkCollectWireInfo(Rtl_Ntk_t *p, int NameId, int Left, int Right)
void Rtl_NtkUpdateBoxes(Rtl_Ntk_t *p)
int Rtl_NtkCheckWireRange(Rtl_Ntk_t *p, int NameId, int Left, int Right)
int Rtl_NtkReviewConnections(Rtl_Ntk_t *p)
void Rtl_NtkSetSignalRange(Rtl_Ntk_t *p, int Sig, int Value)
void Rtl_NtkCollectSignalInfo(Rtl_Ntk_t *p, int Sig)
Gia_Man_t * Gia_ManReduceBuffers(Rtl_Lib_t *pLib, Gia_Man_t *p)
int Rtl_NtkCountWireRange(Rtl_Ntk_t *p, int NameId)
int Rtl_NtkCellParamValue(Rtl_Ntk_t *p, int *pCell, char *pParam)
Vec_Int_t * Gia_ManCollectBufs(Gia_Man_t *p, int iFirst, int nBufs)
void Rtl_LibUpdateBoxes(Rtl_Lib_t *p)
int Rtl_NtkReadCell(Rtl_Ntk_t *p, int iPos)
void Rtl_NtkBlastConnect(Gia_Man_t *pNew, Rtl_Ntk_t *p, int *pCon)
void Rtl_NtkOrderWires(Rtl_Ntk_t *p)
void Rtl_LibPreprocess(Rtl_Lib_t *pLib)
int Rtl_NtkBlast2Spec(Rtl_Ntk_t *p, int *pCell, int iInput)
void Rtl_NtkBlastHierarchy(Gia_Man_t *pNew, Rtl_Ntk_t *p, int *pCell)
int Rtl_NtkReadWire(Rtl_Ntk_t *p, int iPos)
void Rtl_NtkCollectSliceInfo(Rtl_Ntk_t *p, int *pSlice)
Gia_Man_t * Rtl_NtkBlast2(Rtl_Ntk_t *p)
void Rtl_NtkBlastPrepareInputs(Rtl_Ntk_t *p, int *pCell)
void Rtl_LibUpdateInstances(Rtl_Ntk_t *p)
void Rtl_NtkPrintBufOne(Rtl_Lib_t *p, int Lit)
int Rtl_NtkReadSlice(Rtl_Ntk_t *p, char *pSlice, int NameId)
void Rtl_NtkPrintSlice(Rtl_Ntk_t *p, int *pSlice)
void Rtl_LibBlast2(Rtl_Lib_t *pLib, Vec_Int_t *vRoots, int fInv)
void Rtl_NtkCollectConcatInfo(Rtl_Ntk_t *p, int *pConcat)
int Rtl_NtkBlastCons(Rtl_Ntk_t *p)
#define Rtl_CellForEachConnect(p, pCell, Par, Val, i)
void Rtl_LibBlast(Rtl_Lib_t *pLib)
Rtl_Lib_t * Rtl_LibAlloc()
void Wln_SolveEqual(Rtl_Lib_t *p, int iNtk1, int iNtk2)
void Rtl_LibSetParents(Rtl_Lib_t *p)
void Rtl_LibNormRanges(Rtl_Lib_t *pLib)
int Rtl_NtkCountSignalRange(Rtl_Ntk_t *p, int Sig)
int Rtl_NtkMapConcatRange(Rtl_Ntk_t *p, int *pConcat, int iCell, int iBit)
void Rtl_NtkCountPio(Rtl_Ntk_t *p, int Counts[4])
#define Rtl_NtkForEachCell(p, pCell, i)
int Rtl_LibCountInsts(Rtl_Lib_t *p, Rtl_Ntk_t *pOne)
void Rtl_LibSetReplace(Rtl_Lib_t *p, Vec_Wec_t *vGuide)
int Rtl_LibFindModule2(Rtl_Lib_t *p, int NameId, int iNtk0)
void Rtl_LibReorderModules_rec(Rtl_Ntk_t *p, Vec_Ptr_t *vNew)
void Rtl_LibPrintStats(Rtl_Lib_t *p)
void Rtl_TokenRespace(char *p)
int Gia_ManFindFirst(Rtl_Ntk_t *p, int *pnOuts)
Vec_Int_t * Rtl_NtkCollectOutputs(Rtl_Ntk_t *p)
void Rtl_NtkPrintStats(Rtl_Ntk_t *p, int nNameSymbs)
void Rtl_NtkInitInputs(Rtl_Ntk_t *p)
void Rtl_LibPrint(char *pFileName, Rtl_Lib_t *p)
int Rtl_NtkCollectOrComputeBit(Rtl_Ntk_t *p, int iBit)
void Rtl_NtkBlastOperator(Gia_Man_t *pNew, Rtl_Ntk_t *p, int *pCell)
void Rtl_NtkBlastInputs(Gia_Man_t *pNew, Rtl_Ntk_t *p)
int Rtl_NtkReadConcat(Rtl_Ntk_t *p, int *pPos)
struct Rtl_Ntk_t_ Rtl_Ntk_t
void Rtl_NtkFree(Rtl_Ntk_t *p)
void Rtl_NtkPrintBufs(Rtl_Ntk_t *p, Vec_Int_t *vBufs)
void Rtl_NtkPrintUnusedCells(Rtl_Ntk_t *p)
void Rtl_NtkCollectConstRange(Rtl_Ntk_t *p, int *pConst)
void Rtl_NtkCollectConcatRange(Rtl_Ntk_t *p, int *pConcat)
Vec_Int_t * Rtl_NtkReadFile(char *pFileName, Abc_Nam_t *p)
void Rtl_NtkNormRanges(Rtl_Ntk_t *p)
#define Rtl_CellForEachInput(p, pCell, Par, Val, i)
int Wln_ReadMatchEnd(Rtl_Ntk_t *p, int Mod)
int Rtl_NtkMapSliceRange(Rtl_Ntk_t *p, int *pSlice, int iCell, int iBit)
void Rtl_NtkPrintConcat(Rtl_Ntk_t *p, int *pConcat)
Gia_Man_t * Cec4_ManSimulateTest3(Gia_Man_t *p, int nBTLimit, int fVerbose)
#define Rtl_NtkForEachCon(p, pCon, i)
void Rtl_NtkCollectSliceRange(Rtl_Ntk_t *p, int *pSlice)
void Rtl_NtkPrintConnection(Rtl_Ntk_t *p, int *pCon)
int Rtl_NtkCheckSignalRange(Rtl_Ntk_t *p, int Sig)
int Rtl_NtkReadNtk(Rtl_Lib_t *pLib, int Mod)
int Rtl_NtkMapWireRange(Rtl_Ntk_t *p, int NameId, int Left, int Right, int iCell, int iBit)
int Rtl_NtkSetParents(Rtl_Ntk_t *p)
void Rtl_LibReorderModules(Rtl_Lib_t *p)
int Rtl_NtkCheckSliceRange(Rtl_Ntk_t *p, int *pSlice)
Gia_Man_t * Gia_ManDupPermIO(Gia_Man_t *p, Vec_Int_t *vPermI, Vec_Int_t *vPermO)
char * Rtl_ShortenName(char *pName, int nSize)
void Wln_LibGraftOne(Rtl_Lib_t *p, char **pModules, int nModules, int fInv, int fVerbose)
int Rtl_NtkReadConnect(Rtl_Ntk_t *p, int iPos)
Vec_Int_t * Wln_ReadNtkRoots(Rtl_Lib_t *p, Vec_Wec_t *vGuide)
void Wln_LibMarkHierarchy(Rtl_Lib_t *p, char **ppModule, int nModules, int fVerbose)
void Rtl_NtkPrintCellOrder(Rtl_Ntk_t *p)
int Rtl_NtkCheckConcatRange(Rtl_Ntk_t *p, int *pConcat)
int Rtl_NtkReviewCells(Rtl_Ntk_t *p)
void Wln_SolveWithGuidance(char *pFileName, Rtl_Lib_t *p)
Vec_Int_t * Rtl_NtkRevPermInput(Rtl_Ntk_t *p)
void Rtl_NtkCollectWireRange(Rtl_Ntk_t *p, int NameId, int Left, int Right)
void Rtl_NtkOrderCells(Rtl_Ntk_t *p)
int Rtl_NtkInsertWireRange(Rtl_Ntk_t *p, int NameId, int Left, int Right, int *pLits, int nLits)
void Rtl_NtkPrint(Rtl_Ntk_t *p)
void Rtl_NtkBlast2_rec(Rtl_Ntk_t *p, int iBit, int *pDriver)
Rtl_Lib_t * Rtl_LibReadFile(char *pFileName, char *pFileSpec)
int Rtl_LibFindModule(Rtl_Lib_t *p, int NameId)
void Rtl_LibOrderWires(Rtl_Lib_t *pLib)
void Rtl_NtkMapWires(Rtl_Ntk_t *p, int fUnmap)
int Rtl_NtkReadAttribute(Rtl_Ntk_t *p, int iPos)
void Rtl_NtkReportUndefs(Rtl_Ntk_t *p)
int Rtl_NtkInsertSliceRange(Rtl_Ntk_t *p, int *pSlice, int *pLits, int nLits)
int Rtl_NtkRangeWires(Rtl_Ntk_t *p)
void Wln_SolveInverse(Rtl_Lib_t *p, int iNtk1, int iNtk2)
void Rtl_NtkSetConcatRange(Rtl_Ntk_t *p, int *pConcat, int Value)
#define Rtl_CellForEachOutput(p, pCell, Par, Val, i)
Gia_Man_t * Rtl_ReduceInverse(Rtl_Lib_t *pLib, Gia_Man_t *p)
int Wln_ReadFindToken(char *pToken, Abc_Nam_t *p)
DECLARATIONS ///.
void Rtl_NtkPrintOpers(Rtl_Ntk_t *p)
void Wln_SolveProperty(Rtl_Lib_t *p, int iNtk)
int Rtl_NtkReadSig(Rtl_Ntk_t *p, int *pPos)
int Rtl_LibReadType(char *pType)
int Rtl_LibReturnNtk(Rtl_Lib_t *p, char *pModule)
struct Rtl_Lib_t_ Rtl_Lib_t