34static void Io_NtkWrite( FILE * pFile,
Abc_Ntk_t * pNtk,
int fWriteLatches,
int fBb2Wb,
int fSeq );
35static void Io_NtkWriteOne( FILE * pFile,
Abc_Ntk_t * pNtk,
int fWriteLatches,
int fBb2Wb,
int fSeq );
36static void Io_NtkWritePis( FILE * pFile,
Abc_Ntk_t * pNtk,
int fWriteLatches );
37static void Io_NtkWritePos( FILE * pFile,
Abc_Ntk_t * pNtk,
int fWriteLatches );
38static void Io_NtkWriteSubckt( FILE * pFile,
Abc_Obj_t * pNode );
39static void Io_NtkWriteAsserts( FILE * pFile,
Abc_Ntk_t * pNtk );
40static void Io_NtkWriteNodeFanins( FILE * pFile,
Abc_Obj_t * pNode );
41static int Io_NtkWriteNode( FILE * pFile,
Abc_Obj_t * pNode,
int Length );
42static void Io_NtkWriteLatch( FILE * pFile,
Abc_Obj_t * pLatch );
64 if ( pNtkTemp == NULL )
66 fprintf( stdout,
"Writing BLIF has failed.\n" );
89 assert( Abc_NtkIsNetlist(pNtk) );
91 pFile = fopen( FileName,
"w" );
94 fprintf( stdout,
"Io_WriteBlif(): Cannot open the output file.\n" );
99 Io_NtkWrite( pFile, pNtk, fWriteLatches, fBb2Wb, fSeq );
103 if ( Abc_NtkBlackboxNum(pNtk) > 0 || Abc_NtkWhiteboxNum(pNtk) > 0 )
107 if ( pNtkTemp == pNtk )
109 fprintf( pFile,
"\n\n" );
110 Io_NtkWrite( pFile, pNtkTemp, fWriteLatches, fBb2Wb, fSeq );
127void Io_NtkWrite( FILE * pFile,
Abc_Ntk_t * pNtk,
int fWriteLatches,
int fBb2Wb,
int fSeq )
130 assert( Abc_NtkIsNetlist(pNtk) );
132 fprintf( pFile,
".model %s\n", Abc_NtkName(pNtk) );
134 Io_NtkWriteOne( pFile, pNtk, fWriteLatches, fBb2Wb, fSeq );
136 pExdc = Abc_NtkExdc( pNtk );
139 fprintf( pFile,
"\n" );
140 fprintf( pFile,
".exdc\n" );
141 Io_NtkWriteOne( pFile, pExdc, fWriteLatches, fBb2Wb, fSeq );
144 fprintf( pFile,
".end\n" );
164 fprintf( pFile,
".attrib white box seq\n" );
168 fprintf( pFile,
".attrib white box comb\n" );
169 fprintf( pFile,
".delay 1\n" );
174 fprintf( pFile,
".names" );
175 Io_NtkWritePis( pFile, pNtk, 1 );
177 fprintf( pFile,
" %s_in\n",
Abc_ObjName(Abc_ObjFanin0(pObj)) );
179 fprintf( pFile,
" %s\n",
Abc_ObjName(Abc_ObjFanin0(pObj)) );
180 for ( v = 0; v < Abc_NtkPiNum(pNtk); v++ )
181 fprintf( pFile,
"1" );
182 fprintf( pFile,
" 1\n" );
184 fprintf( pFile,
".latch %s_in %s 1\n",
Abc_ObjName(Abc_ObjFanin0(pObj)),
Abc_ObjName(Abc_ObjFanin0(pObj)) );
199void Io_NtkWriteOne( FILE * pFile,
Abc_Ntk_t * pNtk,
int fWriteLatches,
int fBb2Wb,
int fSeq )
206 fprintf( pFile,
".inputs" );
207 Io_NtkWritePis( pFile, pNtk, fWriteLatches );
208 fprintf( pFile,
"\n" );
211 fprintf( pFile,
".outputs" );
212 Io_NtkWritePos( pFile, pNtk, fWriteLatches );
213 fprintf( pFile,
"\n" );
216 if ( Abc_NtkHasBlackbox( pNtk ) )
221 fprintf( pFile,
".blackbox\n" );
229 if ( fWriteLatches && !Abc_NtkIsComb(pNtk) )
231 fprintf( pFile,
"\n" );
233 Io_NtkWriteLatch( pFile, pLatch );
234 fprintf( pFile,
"\n" );
239 if ( Abc_NtkBlackboxNum(pNtk) > 0 || Abc_NtkWhiteboxNum(pNtk) > 0 )
241 fprintf( pFile,
"\n" );
243 Io_NtkWriteSubckt( pFile, pNode );
244 fprintf( pFile,
"\n" );
246 Io_NtkWriteSubckt( pFile, pNode );
247 fprintf( pFile,
"\n" );
255 Extra_ProgressBarUpdate( pProgress, i, NULL );
256 if ( Io_NtkWriteNode( pFile, pNode, Length ) )
274void Io_NtkWritePis( FILE * pFile,
Abc_Ntk_t * pNtk,
int fWriteLatches )
289 pNet = Abc_ObjFanout0(pTerm);
294 fprintf( pFile,
" \\\n" );
300 LineLength += AddedLength;
308 pNet = Abc_ObjFanout0(pTerm);
313 fprintf( pFile,
" \\\n" );
319 LineLength += AddedLength;
336void Io_NtkWritePos( FILE * pFile,
Abc_Ntk_t * pNtk,
int fWriteLatches )
351 pNet = Abc_ObjFanin0(pTerm);
356 fprintf( pFile,
" \\\n" );
362 LineLength += AddedLength;
370 pNet = Abc_ObjFanin0(pTerm);
375 fprintf( pFile,
" \\\n" );
381 LineLength += AddedLength;
398void Io_NtkWriteSubckt( FILE * pFile,
Abc_Obj_t * pNode )
405 fprintf( pFile,
".subckt %s", Abc_NtkName(pModel) );
409 fprintf( pFile,
" %s",
Abc_ObjName(Abc_ObjFanout0(pTerm)) );
410 pTerm = Abc_ObjFanin( pNode, i );
411 fprintf( pFile,
"=%s",
Abc_ObjName(Abc_ObjFanin0(pTerm)) );
415 fprintf( pFile,
" %s",
Abc_ObjName(Abc_ObjFanin0(pTerm)) );
416 pTerm = Abc_ObjFanout( pNode, i );
417 fprintf( pFile,
"=%s",
Abc_ObjName(Abc_ObjFanout0(pTerm)) );
419 fprintf( pFile,
"\n" );
433void Io_NtkWriteLatch( FILE * pFile,
Abc_Obj_t * pLatch )
437 pNetLi = Abc_ObjFanin0( Abc_ObjFanin0(pLatch) );
438 pNetLo = Abc_ObjFanout0( Abc_ObjFanout0(pLatch) );
439 Reset = (int)(ABC_PTRUINT_T)Abc_ObjData( pLatch );
441 fprintf( pFile,
".latch" );
444 fprintf( pFile,
" %d\n", Reset-1 );
459void Io_NtkWriteNodeFanins( FILE * pFile,
Abc_Obj_t * pNode )
475 AddedLength =
strlen(pName) + 1;
478 fprintf( pFile,
" \\\n" );
483 fprintf( pFile,
" %s", pName );
484 LineLength += AddedLength;
491 AddedLength =
strlen(pName) + 1;
492 if ( NameCounter && LineLength + AddedLength > 75 )
494 fprintf( pFile,
" \\\n" );
499 fprintf( pFile,
" %s", pName );
528 AddedLength =
strlen(pName) + 1;
529 fprintf( pFile,
" m%d", Abc_ObjId(pNode) );
537 AddedLength =
strlen(pName) + 3;
540 fprintf( pFile,
" \\\n" );
545 fprintf( pFile,
" %c=%s",
'a'+i, pName );
546 LineLength += AddedLength;
553 AddedLength =
strlen(pName) + 3;
554 if ( NameCounter && LineLength + AddedLength > 75 )
556 fprintf( pFile,
" \\\n" );
561 fprintf( pFile,
" %c=%s",
'o', pName );
578 static int fReport = 0;
586 assert ( i == Abc_ObjFaninNum(pNode) );
591 if ( pNode2 == NULL )
594 fReport = 1, printf(
"Warning: Missing second output of gate(s) \"%s\".\n",
Mio_GateReadName(pGate) );
612int Io_NtkWriteNode( FILE * pFile,
Abc_Obj_t * pNode,
int Length )
615 if ( Abc_NtkHasMapping(pNode->
pNtk) )
618 if ( Abc_ObjIsBarBuf(pNode) )
620 fprintf( pFile,
".barbuf " );
622 fprintf( pFile,
"\n" );
626 fprintf( pFile,
".gate" );
628 fprintf( pFile,
"\n" );
634 fprintf( pFile,
".names" );
635 Io_NtkWriteNodeFanins( pFile, pNode );
636 fprintf( pFile,
"\n" );
638 fprintf( pFile,
"%s", (
char*)Abc_ObjData(pNode) );
657 fprintf( pFile,
".subckt" );
659 fprintf( pFile,
"\n" );
677 Abc_Time_t * pTime, * pTimeDefIn, * pTimeDefOut;
683 fprintf( pFile,
"\n" );
685 fprintf( pFile,
".and_gate_delay %g\n", pNtk->
AndGateDelay );
688 fprintf( pFile,
".default_input_arrival %g %g\n", pTimeDefIn->
Rise, pTimeDefIn->
Fall );
691 fprintf( pFile,
".default_output_required %g %g\n", pTimeDefOut->
Rise, pTimeDefOut->
Fall );
693 fprintf( pFile,
"\n" );
699 fprintf( pFile,
".input_arrival %s %g %g\n",
Abc_ObjName(Abc_ObjFanout0(pNode)), pTime->
Rise, pTime->
Fall );
706 fprintf( pFile,
".output_required %s %g %g\n",
Abc_ObjName(Abc_ObjFanin0(pNode)), pTime->
Rise, pTime->
Fall );
709 fprintf( pFile,
"\n" );
711 if ( pTimeDefIn->
Rise != 0.0 || pTimeDefIn->
Fall != 0.0 )
712 fprintf( pFile,
".default_input_drive %g %g\n", pTimeDefIn->
Rise, pTimeDefIn->
Fall );
719 fprintf( pFile,
".input_drive %s %g %g\n",
Abc_ObjName(Abc_ObjFanout0(pNode)), pTime->
Rise, pTime->
Fall );
723 if ( pTimeDefOut->
Rise != 0.0 || pTimeDefOut->
Fall != 0.0 )
724 fprintf( pFile,
".default_output_load %g %g\n", pTimeDefOut->
Rise, pTimeDefOut->
Fall );
731 fprintf( pFile,
".output_load %s %g %g\n",
Abc_ObjName(Abc_ObjFanin0(pNode)), pTime->
Rise, pTime->
Fall );
734 fprintf( pFile,
"\n" );
754 pFile = fopen( pFileNameIn,
"rb" );
757 printf(
"Input file \"%s\" cannot be opened.\n", pFileNameIn );
762 pFile = fopen( pFileNameOut,
"wb" );
765 printf(
"Output file \"%s\" cannot be opened.\n", pFileNameOut );
771 if ( pNetlist == NULL )
773 printf(
"Reading input file \"%s\" has failed.\n", pFileNameIn );
799 int RetValue =
Kit_TruthIsop( (
unsigned *)&uTruth, nVars, vCover, 1 );
800 assert( RetValue == 0 || RetValue == 1 );
802 if ( Vec_IntSize(vCover) == 0 || (Vec_IntSize(vCover) == 1 && Vec_IntEntry(vCover,0) == 0) )
804 char * pStr0 =
" 0\n", * pStr1 =
" 1\n";
806 return Vec_IntSize(vCover) == 0 ? pStr0 : pStr1;
829 int i, nVars = Abc_ObjFaninNum(pNode);
832 printf(
"Node \"%s\" has more than 7 inputs. Writing BLIF has failed.\n",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
836 fprintf( pFile,
"\n" );
840 fprintf( pFile,
".names" );
844 fprintf( pFile,
" %s\n",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
846 fprintf( pFile,
"%s", (
char*)Abc_ObjData(pNode) );
858 word z, uTruth6 = 0, uTruth7[2], Cofs6[2], Cofs7[2][2];
859 int c, iVar, nVarsMin[2], pVars[2][10];
863 pVars[0][i] = pVars[1][i] = i;
890 assert( nVarsMin[0] < 5 );
891 assert( nVarsMin[1] < 5 );
893 fprintf( pFile,
".names" );
894 fprintf( pFile,
" %s",
Abc_ObjName(Abc_ObjFanin(pNode,iVar)) );
895 fprintf( pFile,
" %s_cascade0",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
896 fprintf( pFile,
" %s_cascade1",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
897 fprintf( pFile,
" %s\n",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
898 fprintf( pFile,
"1-1 1\n01- 1\n" );
900 for ( c = 0; c < 2; c++ )
903 (
word)(nVars == 7 ? Cofs7[c][0] : Cofs6[c]), nVarsMin[c], vCover );
904 fprintf( pFile,
".names" );
905 for ( i = 0; i < nVarsMin[c]; i++ )
906 fprintf( pFile,
" %s",
Abc_ObjName(Abc_ObjFanin(pNode,pVars[c][i])) );
907 fprintf( pFile,
" %s_cascade%d\n",
Abc_ObjName(Abc_ObjFanout0(pNode)), c );
908 fprintf( pFile,
"%s", pSop );
912 assert( nVars == 6 || nVars == 7 );
927 printf(
"Node \"%s\" is not decomposable. Writing BLIF has failed.\n",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
932 for ( c = 1; c >= 0; c-- )
935 uTruth7[c] = ((c ? z >> 32 : z) & 0xffff);
936 uTruth7[c] |= (uTruth7[c] << 16);
937 uTruth7[c] |= (uTruth7[c] << 32);
938 for ( i = 0; i < 4; i++ )
939 pVars[c][i] = (z >> (c*32+16+4*i)) & 7;
945 fprintf( pFile,
".names" );
946 for ( i = 0; i < nVarsMin[c]; i++ )
947 if ( pVars[c][i] == 7 )
948 fprintf( pFile,
" %s_cascade",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
950 fprintf( pFile,
" %s",
Abc_ObjName(Abc_ObjFanin(pNode,pVars[c][i])) );
951 fprintf( pFile,
" %s%s\n",
Abc_ObjName(Abc_ObjFanout0(pNode)), c?
"" :
"_cascade" );
955 (
word)Cofs6[c], nVarsMin[c], vCover );
956 fprintf( pFile,
"%s", pSop );
975 int nLeaves = Abc_ObjFaninNum(pNode);
976 int i, nLutLeaf, nLutLeaf2, nLutRoot, Length;
980 if ( Length != 2 && Length != 3 )
982 printf(
"Wrong LUT struct (%s)\n", pStr );
985 for ( i = 0; i < Length; i++ )
986 if ( pStr[i] -
'0' < 3 || pStr[i] -
'0' > 6 )
988 printf(
"The LUT size (%d) should belong to {3,4,5,6}.\n", pStr[i] -
'0' );
992 nLutLeaf = pStr[0] -
'0';
993 nLutLeaf2 = ( Length == 3 ) ? pStr[1] -
'0' : 0;
994 nLutRoot = pStr[Length-1] -
'0';
995 if ( nLeaves > nLutLeaf - 1 + (nLutLeaf2 ? nLutLeaf2 - 1 : 0) + nLutRoot )
997 printf(
"The node size (%d) is too large for the LUT structure %s.\n", nLeaves, pStr );
1002 fprintf( pFile,
"\n" );
1003 if ( nLeaves <= Abc_MaxInt( nLutLeaf2, Abc_MaxInt(nLutLeaf, nLutRoot) ) )
1006 fprintf( pFile,
".names" );
1010 fprintf( pFile,
" %s\n",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
1012 fprintf( pFile,
"%s", (
char*)Abc_ObjData(pNode) );
1019 static word TruthStore[16][1<<10] = {{0}}, * pTruths[16];
1020 word pCube[1<<10], pRes[1<<10], Func0, Func1, Func2;
1021 char pLut0[32], pLut1[32], pLut2[32] = {0}, * pSop;
1024 if ( TruthStore[0][0] == 0 )
1026 static word Truth6[6] = {
1035 int nWordsMax = (1 << 10);
1037 assert( nVarsMax <= 16 );
1038 for ( i = 0; i < nVarsMax; i++ )
1039 pTruths[i] = TruthStore[i];
1040 for ( i = 0; i < 6; i++ )
1041 for ( k = 0; k < nWordsMax; k++ )
1042 pTruths[i][k] = Truth6[i];
1043 for ( i = 6; i < nVarsMax; i++ )
1044 for ( k = 0; k < nWordsMax; k++ )
1045 pTruths[i][k] = ((k >> (i-6)) & 1) ? ~(
word)0 : 0;
1054 if ( Kit_TruthIsConst0((
unsigned *)pRes, nLeaves) || Kit_TruthIsConst1((
unsigned *)pRes, nLeaves) )
1056 fprintf( pFile,
".names %s\n %d\n",
Abc_ObjName(Abc_ObjFanout0(pNode)), Kit_TruthIsConst1((
unsigned *)pRes, nLeaves) );
1066 if ( !
If_CluCheckExt( NULL, pRes, nLeaves, nLutLeaf, nLutRoot, pLut0, pLut1, &Func0, &Func1 ) )
1068 Extra_PrintHex( stdout, (
unsigned *)pRes, nLeaves ); printf(
" " );
1070 printf(
"Node \"%s\" is not decomposable. Writing BLIF has failed.\n",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
1076 if ( !
If_CluCheckExt3( NULL, pRes, nLeaves, nLutLeaf, nLutLeaf2, nLutRoot, pLut0, pLut1, pLut2, &Func0, &Func1, &Func2 ) )
1078 Extra_PrintHex( stdout, (
unsigned *)pRes, nLeaves ); printf(
" " );
1080 printf(
"Node \"%s\" is not decomposable. Writing BLIF has failed.\n",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
1086 fprintf( pFile,
".names" );
1087 for ( i = 0; i < pLut1[0]; i++ )
1088 fprintf( pFile,
" %s",
Abc_ObjName(Abc_ObjFanin(pNode,pLut1[2+i])) );
1089 fprintf( pFile,
" %s_lut1\n",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
1092 fprintf( pFile,
"%s", pSop );
1094 if ( Length == 3 && pLut2[0] > 0 )
1097 fprintf( pFile,
".names" );
1098 for ( i = 0; i < pLut2[0]; i++ )
1099 if ( pLut2[2+i] == nLeaves )
1100 fprintf( pFile,
" %s_lut1",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
1102 fprintf( pFile,
" %s",
Abc_ObjName(Abc_ObjFanin(pNode,pLut2[2+i])) );
1103 fprintf( pFile,
" %s_lut2\n",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
1106 fprintf( pFile,
"%s", pSop );
1110 fprintf( pFile,
".names" );
1111 for ( i = 0; i < pLut0[0]; i++ )
1112 if ( pLut0[2+i] == nLeaves )
1113 fprintf( pFile,
" %s_lut1",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
1114 else if ( pLut0[2+i] == nLeaves+1 )
1115 fprintf( pFile,
" %s_lut2",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
1117 fprintf( pFile,
" %s",
Abc_ObjName(Abc_ObjFanin(pNode,pLut0[2+i])) );
1118 fprintf( pFile,
" %s\n",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
1121 fprintf( pFile,
"%s", pSop );
1139 int nLeaves = Abc_ObjFaninNum(pNode);
1140 int i, nLutLeaf, nLutLeaf2, nLutRoot, Length;
1143 fprintf( pFile,
"\n" );
1144 fprintf( pFile,
".model m%d\n", Abc_ObjId(pNode) );
1145 fprintf( pFile,
".inputs" );
1146 for ( i = 0; i < Abc_ObjFaninNum(pNode); i++ )
1147 fprintf( pFile,
" %c",
'a' + i );
1148 fprintf( pFile,
"\n" );
1149 fprintf( pFile,
".outputs o\n" );
1153 if ( Length != 2 && Length != 3 )
1155 printf(
"Wrong LUT struct (%s)\n", pStr );
1158 for ( i = 0; i < Length; i++ )
1159 if ( pStr[i] -
'0' < 3 || pStr[i] -
'0' > 6 )
1161 printf(
"The LUT size (%d) should belong to {3,4,5,6}.\n", pStr[i] -
'0' );
1165 nLutLeaf = pStr[0] -
'0';
1166 nLutLeaf2 = ( Length == 3 ) ? pStr[1] -
'0' : 0;
1167 nLutRoot = pStr[Length-1] -
'0';
1168 if ( nLeaves > nLutLeaf - 1 + (nLutLeaf2 ? nLutLeaf2 - 1 : 0) + nLutRoot )
1170 printf(
"The node size (%d) is too large for the LUT structure %s.\n", nLeaves, pStr );
1175 if ( nLeaves <= Abc_MaxInt( nLutLeaf2, Abc_MaxInt(nLutLeaf, nLutRoot) ) )
1178 fprintf( pFile,
".names" );
1180 fprintf( pFile,
" %c",
'a' + i );
1182 fprintf( pFile,
" %s\n",
"o" );
1184 fprintf( pFile,
"%s", (
char*)Abc_ObjData(pNode) );
1185 fprintf( pFile,
".end\n" );
1192 static word TruthStore[16][1<<10] = {{0}}, * pTruths[16];
1193 word pCube[1<<10], pRes[1<<10], Func0, Func1, Func2;
1194 char pLut0[32], pLut1[32], pLut2[32] = {0}, * pSop;
1197 if ( TruthStore[0][0] == 0 )
1199 static word Truth6[6] = {
1208 int nWordsMax = (1 << 10);
1210 assert( nVarsMax <= 16 );
1211 for ( i = 0; i < nVarsMax; i++ )
1212 pTruths[i] = TruthStore[i];
1213 for ( i = 0; i < 6; i++ )
1214 for ( k = 0; k < nWordsMax; k++ )
1215 pTruths[i][k] = Truth6[i];
1216 for ( i = 6; i < nVarsMax; i++ )
1217 for ( k = 0; k < nWordsMax; k++ )
1218 pTruths[i][k] = ((k >> (i-6)) & 1) ? ~(
word)0 : 0;
1227 if ( Kit_TruthIsConst0((
unsigned *)pRes, nLeaves) || Kit_TruthIsConst1((
unsigned *)pRes, nLeaves) )
1229 fprintf( pFile,
".names %s\n %d\n",
"o", Kit_TruthIsConst1((
unsigned *)pRes, nLeaves) );
1230 fprintf( pFile,
".end\n" );
1240 if ( !
If_CluCheckExt( NULL, pRes, nLeaves, nLutLeaf, nLutRoot, pLut0, pLut1, &Func0, &Func1 ) )
1242 Extra_PrintHex( stdout, (
unsigned *)pRes, nLeaves ); printf(
" " );
1244 printf(
"Node \"%s\" is not decomposable. Writing BLIF has failed.\n",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
1250 if ( !
If_CluCheckExt3( NULL, pRes, nLeaves, nLutLeaf, nLutLeaf2, nLutRoot, pLut0, pLut1, pLut2, &Func0, &Func1, &Func2 ) )
1252 Extra_PrintHex( stdout, (
unsigned *)pRes, nLeaves ); printf(
" " );
1254 printf(
"Node \"%s\" is not decomposable. Writing BLIF has failed.\n",
Abc_ObjName(Abc_ObjFanout0(pNode)) );
1260 fprintf( pFile,
".names" );
1261 for ( i = 0; i < pLut1[0]; i++ )
1262 fprintf( pFile,
" %c",
'a' + pLut1[2+i] );
1263 fprintf( pFile,
" lut1\n" );
1266 fprintf( pFile,
"%s", pSop );
1268 if ( Length == 3 && pLut2[0] > 0 )
1271 fprintf( pFile,
".names" );
1272 for ( i = 0; i < pLut2[0]; i++ )
1273 if ( pLut2[2+i] == nLeaves )
1274 fprintf( pFile,
" lut1" );
1276 fprintf( pFile,
" %c",
'a' + pLut2[2+i] );
1277 fprintf( pFile,
" lut2\n" );
1280 fprintf( pFile,
"%s", pSop );
1284 fprintf( pFile,
".names" );
1285 for ( i = 0; i < pLut0[0]; i++ )
1286 if ( pLut0[2+i] == nLeaves )
1287 fprintf( pFile,
" lut1" );
1288 else if ( pLut0[2+i] == nLeaves+1 )
1289 fprintf( pFile,
" lut2" );
1291 fprintf( pFile,
" %c",
'a' + pLut0[2+i] );
1292 fprintf( pFile,
" %s\n",
"o" );
1295 fprintf( pFile,
"%s", pSop );
1296 fprintf( pFile,
".end\n" );
1318 assert( Abc_NtkIsNetlist(pNtk) );
1320 pFile = fopen( FileName,
"w" );
1321 if ( pFile == NULL )
1323 fprintf( stdout,
"Io_WriteBlifInt(): Cannot open the output file.\n" );
1328 fprintf( pFile,
".model %s\n", Abc_NtkName(pNtk) );
1330 fprintf( pFile,
".inputs" );
1331 Io_NtkWritePis( pFile, pNtk, 1 );
1332 fprintf( pFile,
"\n" );
1334 fprintf( pFile,
".outputs" );
1335 Io_NtkWritePos( pFile, pNtk, 1 );
1336 fprintf( pFile,
"\n" );
1338 if ( Abc_NtkLatchNum(pNtk) )
1339 fprintf( pFile,
"\n" );
1341 Io_NtkWriteLatch( pFile, pLatch );
1342 if ( Abc_NtkLatchNum(pNtk) )
1343 fprintf( pFile,
"\n" );
1345 vCover = Vec_IntAlloc( (1<<16) );
1349 fprintf( pFile,
"\n" );
1352 fprintf( pFile,
".end\n\n" );
1356 fprintf( pFile,
"\n" );
1368 fprintf( pFile,
".end\n\n" );
1370 Vec_IntFree( vCover );
1388 assert( Abc_NtkIsLogic(pNtk) );
1392 if ( pNtkTemp == NULL )
1394 fprintf( stdout,
"Writing BLIF has failed.\n" );
1397 if ( pLutStruct && fUseHie )
struct Abc_Obj_t_ Abc_Obj_t
#define Abc_NtkForEachCo(pNtk, pCo, i)
ABC_DLL Abc_Time_t * Abc_NodeReadArrival(Abc_Obj_t *pNode)
ABC_DLL Abc_Time_t * Abc_NodeReadOutputLoad(Abc_Ntk_t *pNtk, int iPo)
#define Abc_NtkForEachPo(pNtk, pPo, i)
ABC_DLL Abc_Obj_t * Abc_NtkFetchTwinNode(Abc_Obj_t *pNode)
ABC_DLL Abc_Time_t * Abc_NodeReadInputDrive(Abc_Ntk_t *pNtk, int iPi)
#define Abc_NtkForEachLatch(pNtk, pObj, i)
#define Abc_ObjForEachFanin(pObj, pFanin, i)
ABC_DLL Abc_Time_t * Abc_NtkReadDefaultOutputLoad(Abc_Ntk_t *pNtk)
ABC_DLL void Abc_SopComplement(char *pSop)
#define Abc_NtkForEachBlackbox(pNtk, pObj, i)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
struct Abc_Ntk_t_ Abc_Ntk_t
ABC_DLL Abc_Time_t * Abc_NtkReadDefaultArrival(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
ABC_DLL Abc_Time_t * Abc_NodeReadRequired(Abc_Obj_t *pNode)
ABC_DLL Abc_Time_t * Abc_NtkReadDefaultRequired(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Ntk_t * Abc_NtkToNetlist(Abc_Ntk_t *pNtk)
ABC_DLL void Abc_SopToTruthBig(char *pSop, int nInputs, word **pVars, word *pCube, word *pRes)
struct Abc_Time_t_ Abc_Time_t
#define Abc_NtkForEachWhitebox(pNtk, pObj, i)
ABC_DLL void Abc_SopToTruth7(char *pSop, int nInputs, word r[2])
ABC_DLL int Abc_NtkToSop(Abc_Ntk_t *pNtk, int fMode, int nCubeLimit)
#define Abc_NtkForEachPi(pNtk, pPi, i)
ABC_DLL char * Abc_SopCreateFromIsop(Mem_Flex_t *pMan, int nVars, Vec_Int_t *vCover)
#define Abc_NtkForEachCi(pNtk, pCi, i)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
ABC_DLL word Abc_SopToTruth(char *pSop, int nInputs)
ABC_DLL Abc_Time_t * Abc_NtkReadDefaultInputDrive(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachNode(pNtk, pNode, i)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_CONST(number)
PARAMETERS ///.
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
void Extra_PrintHex(FILE *pFile, unsigned *pTruth, int nVars)
int If_Dec7PickBestMux(word t[2], word c0r[2], word c1r[2])
int If_Dec6PickBestMux(word t, word Cofs[2])
word If_Dec6Perform(word t, int fDerive)
word If_Dec7Perform(word t0[2], int fDerive)
word If_Dec6MinimumBase(word uTruth, int *pSupp, int nVarsAll, int *pnVars)
void If_Dec7MinimumBase(word uTruth[2], int *pSupp, int nVarsAll, int *pnVars)
int If_CluMinimumBase(word *t, int *pSupp, int nVarsAll, int *pnVars)
int If_CluCheckExt3(void *p, word *pTruth, int nVars, int nLutLeaf, int nLutLeaf2, int nLutRoot, char *pLut0, char *pLut1, char *pLut2, word *pFunc0, word *pFunc1, word *pFunc2)
int If_CluCheckExt(void *p, word *pTruth, int nVars, int nLutLeaf, int nLutRoot, char *pLut0, char *pLut1, word *pFunc0, word *pFunc1)
#define IO_WRITE_LINE_LENGTH
MACRO DEFINITIONS ///.
Abc_Ntk_t * Io_ReadNetlist(char *pFileName, Io_FileType_t FileType, int fCheck)
Io_FileType_t Io_ReadFileType(char *pFileName)
DECLARATIONS ///.
void Io_WriteBlifSpecial(Abc_Ntk_t *pNtk, char *FileName, char *pLutStruct, int fUseHie)
void Io_WriteBlifInt(Abc_Ntk_t *pNtk, char *FileName, char *pLutStruct, int fUseHie)
void Io_NtkWriteNodeIntStruct(FILE *pFile, Abc_Obj_t *pNode, Vec_Int_t *vCover, char *pStr)
void Io_WriteBlif(Abc_Ntk_t *pNtk, char *FileName, int fWriteLatches, int fBb2Wb, int fSeq)
void Io_NtkWriteModelIntStruct(FILE *pFile, Abc_Obj_t *pNode, Vec_Int_t *vCover, char *pStr)
void Io_NtkWriteConvertedBox(FILE *pFile, Abc_Ntk_t *pNtk, int fSeq)
void Abc_NtkConvertBb2Wb(char *pFileNameIn, char *pFileNameOut, int fSeq, int fVerbose)
void Io_WriteTimingInfo(FILE *pFile, Abc_Ntk_t *pNtk)
void Io_WriteBlifLogic(Abc_Ntk_t *pNtk, char *FileName, int fWriteLatches)
FUNCTION DEFINITIONS ///.
int Io_NtkWriteNodeSubckt(FILE *pFile, Abc_Obj_t *pNode, int Length)
void Io_NtkWriteNodeInt(FILE *pFile, Abc_Obj_t *pNode, Vec_Int_t *vCover)
int Io_NtkWriteNodeGate(FILE *pFile, Abc_Obj_t *pNode, int Length)
void Io_NtkWriteSubcktFanins(FILE *pFile, Abc_Obj_t *pNode)
char * Io_NtkDeriveSop(Mem_Flex_t *pMem, word uTruth, int nVars, Vec_Int_t *vCover)
unsigned __int64 word
DECLARATIONS ///.
int Kit_TruthIsop(unsigned *puTruth, int nVars, Vec_Int_t *vMemory, int fTryBoth)
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
Mio_Pin_t * Mio_GateReadPins(Mio_Gate_t *pGate)
struct Mio_LibraryStruct_t_ Mio_Library_t
Mio_Gate_t * Mio_GateReadTwin(Mio_Gate_t *pGate)
char * Mio_PinReadName(Mio_Pin_t *pPin)
char * Mio_GateReadName(Mio_Gate_t *pGate)
Mio_Pin_t * Mio_PinReadNext(Mio_Pin_t *pPin)
int Mio_LibraryReadGateNameMax(Mio_Library_t *pLib)
struct Mio_PinStruct_t_ Mio_Pin_t
char * Mio_GateReadOutName(Mio_Gate_t *pGate)
struct Mio_GateStruct_t_ Mio_Gate_t
struct Mem_Flex_t_ Mem_Flex_t
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.