955{
957 char * pStart, * pName;
958 int i;
959
961 {
962startword:
963 if ( Wlc_PrsStrCmp( pStart, "module" ) )
964 {
965
967 if ( pName == NULL )
969
970 if ( Wlc_PrsStrCmp( pName, "CPL_" ) )
971 {
972 while ( ++i < Vec_IntSize(
p->vStarts) )
973 {
974 pStart = Wlc_PrsStr(
p, Vec_IntEntry(
p->vStarts, i));
975 pStart =
strstr( pStart,
"endmodule" );
976 if ( pStart != NULL )
977 break;
978 }
979 continue;
980 }
981 if ( Wlc_PrsStrCmp( pName, "table" ) )
982 {
983
984 int Width1 = -1, Width2 = -1;
985 int v, b, Value, nBits, nInts;
986 unsigned * pTable;
987 Vec_Int_t * vValues = Vec_IntAlloc( 256 );
989 {
990 if ( Wlc_PrsStrCmp( pStart, "endcase" ) )
991 break;
992 pStart = Wlc_PrsFindSymbol( pStart, '\'' );
993 if ( pStart == NULL )
994 continue;
995 Width1 = atoi(pStart-1);
996 pStart = Wlc_PrsFindSymbol( pStart+2, '\'' );
997 if ( pStart == NULL )
998 continue;
999 Width2 = atoi(pStart-1);
1000 Value = 0;
1001 Abc_TtReadHexNumber( (
word *)&Value, pStart+2 );
1002 Vec_IntPush( vValues, Value );
1003 }
1004
1005 nBits = Abc_Base2Log( Vec_IntSize(vValues) );
1006 if ( Vec_IntSize(vValues) != (1 << nBits) )
1007 {
1008 Vec_IntFree( vValues );
1010 }
1011 assert( Width1 == nBits );
1012
1013 nInts = Abc_BitWordNum( Width2 * Vec_IntSize(vValues) );
1015 memset( pTable, 0, nInts *
sizeof(
unsigned) );
1017 for ( b = 0; b < Width2; b++ )
1018 if ( (Value >> b) & 1 )
1019 Abc_InfoSetBit( pTable, v * Width2 + b );
1020 Vec_PtrPush(
p->vTables, pTable );
1021 Vec_IntFree( vValues );
1022 continue;
1023 }
1024 if (
p->pNtk != NULL )
1028 p->pNtk->pMemTable =
p->pMemTable;
p->pMemTable = NULL;
1029 p->pNtk->vTables =
p->vTables;
p->vTables = NULL;
1030
1032 {
1033 pName = Wlc_PrsSkipSpaces( pName );
1034 if ( fInter && Wlc_PrsStrCmp( pName, "wire" ) )
1035 return 0;
1036 if ( Wlc_PrsStrCmp( pName, "input" ) || Wlc_PrsStrCmp( pName, "output" ) || Wlc_PrsStrCmp( pName, "wire" ) )
1037 {
1039 return 0;
1040 }
1041 }
1042 }
1043 else if ( Wlc_PrsStrCmp( pStart, "endmodule" ) )
1044 {
1045 Vec_Int_t * vTemp = Vec_IntStartNatural( Wlc_NtkObjNumMax(
p->pNtk) );
1046 Vec_IntAppend( &
p->pNtk->vNameIds, vTemp );
1047 Vec_IntFree( vTemp );
1048 if (
p->pNtk->vInits )
1049 {
1050
1051 assert( (Vec_IntSize(&
p->pNtk->vFfs) & 1) == 0 );
1052 assert( Vec_IntSize(&
p->pNtk->vFfs) == 2 * Vec_IntSize(
p->pNtk->vInits) );
1054 if ( i & 1 )
1056 else
1058 Vec_IntClear( &
p->pNtk->vFfs );
1059
1060
1062
1063 }
1064 if (
p->pNtk->vArsts && !
p->pNtk->fAsyncRst )
1065 {
1066 int i, NameIdArst;
1068 {
1070 continue;
1071 p->pNtk->fAsyncRst = 1;
1072 printf(
"Detected async reset \"%s\".\n",
Abc_NamStr(
p->pNtk->pManName, NameIdArst) );
1073 break;
1074 }
1075 }
1077 {
1078 assert( Vec_StrEntryLast(
p->vPoPairs) == 0 );
1079 Vec_StrPush(
p->vPoPairs, 0 );
1080 pName = Vec_StrArray(
p->vPoPairs);
1081 while ( *pName )
1082 {
1085 {
1086 Vec_IntPush( &
p->pNtk->vPoPairs, i );
1087 break;
1088 }
1089 assert( i < Wlc_NtkPoNum(
p->pNtk) );
1090 pName +=
strlen(pName) + 1;
1091 }
1092 assert( Vec_IntSize(&
p->pNtk->vPoPairs) % 2 == 0 );
1093 printf(
"Finished parsing %d output pairs to be checked for equivalence.\n", Vec_IntSize(&
p->pNtk->vPoPairs)/2 );
1094 }
1095 break;
1096 }
1097
1098 else if ( Wlc_PrsStrCmp( pStart, "input" ) || Wlc_PrsStrCmp( pStart, "output" ) || Wlc_PrsStrCmp( pStart, "wire" ) || Wlc_PrsStrCmp( pStart, "reg" ) )
1099 {
1100 if ( fInter && (Wlc_PrsStrCmp( pStart, "wire" ) || Wlc_PrsStrCmp( pStart, "reg" )) )
1101 return 0;
1103 return 0;
1104 }
1105 else if ( Wlc_PrsStrCmp( pStart, "assign" ) )
1106 {
1107 int Type, NameId, fFound, XValue = 0;
1108 if ( fInter )
1109 return 0;
1110 pStart +=
strlen(
"assign");
1111
1112 pStart = Wlc_PrsFindName( pStart, &pName );
1113 if ( pStart == NULL )
1116 if ( !fFound )
1118
1119 Type = Wlc_PrsFindDefinition(
p, pStart,
p->vFanins, &XValue );
1120 if ( Type )
1121 {
1122 pObj = Wlc_NtkObj(
p->pNtk, NameId );
1126 }
1127 else
1128 return 0;
1129 }
1130 else if ( Wlc_PrsStrCmp( pStart, "table" ) )
1131 {
1132
1133 int NameId, fFound, iTable = atoi( pStart +
strlen(
"table") );
1134
1135 pStart = Wlc_PrsFindSymbol( pStart, '(' );
1136 if ( pStart == NULL )
1138
1139 pStart = Wlc_PrsFindName( pStart+1, &pName );
1140 if ( pStart == NULL )
1143 if ( !fFound )
1145
1146 Vec_IntClear(
p->vFanins );
1147 Vec_IntPush(
p->vFanins, NameId );
1148 Vec_IntPush(
p->vFanins, iTable );
1149
1150 pStart = Wlc_PrsFindSymbol( pStart, ',' );
1151 if ( pStart == NULL )
1153
1154 pStart = Wlc_PrsFindName( pStart+1, &pName );
1155 if ( pStart == NULL )
1158 if ( !fFound )
1160 pObj = Wlc_NtkObj(
p->pNtk, NameId );
1163 }
1164 else if ( Wlc_PrsStrCmp( pStart, "always" ) )
1165 {
1166
1167 int NameId, NameIdOut = -1, fFound, nValues, fDefaultFound = 0;
1168 if ( fInter )
1169 return 0;
1170
1171 pStart = Wlc_PrsFindWord( pStart, "case", &fFound );
1172 if ( pStart == NULL )
1174
1175 pStart = Wlc_PrsFindSymbol( pStart, '(' );
1176 if ( pStart == NULL )
1178 pStart = Wlc_PrsFindSymbol( pStart+1, '(' );
1179 if ( pStart == NULL )
1181 pStart = Wlc_PrsFindName( pStart+1, &pName );
1182 if ( pStart == NULL )
1185 if ( !fFound )
1187 Vec_IntClear(
p->vFanins );
1188 Vec_IntPush(
p->vFanins, NameId );
1189
1190 pObj = Wlc_NtkObj(
p->pNtk, NameId );
1191 if ( pObj == NULL )
1193
1194 nValues = (1 << Wlc_ObjRange(pObj));
1195 while ( 1 )
1196 {
1197
1198 pStart = Wlc_PrsFindSymbol( pStart, ':' );
1199 if ( pStart == NULL )
1201
1202 pStart = Wlc_PrsFindName( pStart+1, &pName );
1203 if ( pStart == NULL )
1206 if ( !fFound )
1208
1209 pStart = Wlc_PrsFindSymbol( pStart, '=' );
1210 if ( pStart == NULL )
1212
1213 pStart = Wlc_PrsSkipSpaces( pStart+1 );
1214 pStart = Wlc_PrsReadName(
p, pStart,
p->vFanins );
1215 if ( pStart == NULL )
1217
1218 if ( fDefaultFound )
1219 {
1220 int EntryLast = Vec_IntEntryLast(
p->vFanins );
1221 if (nValues != Vec_IntSize(
p->vFanins)-2)
1222 Vec_IntFillExtra(
p->vFanins, nValues + 1, EntryLast );
1223 else
1224 Vec_IntPop(
p->vFanins);
1225
1226 pStart = Wlc_PrsStr(
p, Vec_IntEntry(
p->vStarts, ++i));
1227 pStart = Wlc_PrsSkipSpaces( pStart );
1228 }
1229 else
1230 {
1231
1232 pStart = Wlc_PrsStr(
p, Vec_IntEntry(
p->vStarts, ++i));
1233 pStart = Wlc_PrsSkipSpaces( pStart );
1234 if ( Wlc_PrsIsDigit(pStart) )
1235 continue;
1236 if ( Wlc_PrsStrCmp( pStart, "default" ) )
1237 {
1238 fDefaultFound = 1;
1239 continue;
1240 }
1241 }
1242
1243 pStart = Wlc_PrsFindWord( pStart, "endcase", &fFound );
1244 if ( pStart == NULL )
1246
1247 pStart = Wlc_PrsFindWord( pStart, "end", &fFound );
1248 if ( pStart == NULL )
1250 pStart = Wlc_PrsSkipSpaces( pStart );
1251 break;
1252 }
1253
1254 if ( nValues < Vec_IntSize(
p->vFanins) - 1 )
1255 {
1256
1257 printf( "Warning: The number of values in the case statement is wrong.\n" );
1258 Vec_IntShrink(
p->vFanins,nValues+1);
1259 }
1260 else if ( nValues > Vec_IntSize(
p->vFanins) - 1 )
1262 if ( Wlc_ObjRange(pObj) == 1 )
1263 {
1264
1265 printf( "Warning: Case-statement with 1-bit control is treated as a 2:1 MUX (correct for unsigned signals only).\n" );
1266 }
1267 pObj = Wlc_NtkObj(
p->pNtk, NameIdOut );
1270 goto startword;
1271 }
1272 else if ( Wlc_PrsStrCmp( pStart, "CPL_FF" ) )
1273 {
1274 int NameId = -1, NameIdIn = -1, NameIdOut = -1, fFound, nBits = 1, fFlopIn, fFlopOut;
1275 pStart +=
strlen(
"CPL_FF");
1276 if ( pStart[0] == '#' )
1277 nBits = atoi(pStart+1);
1278
1279 while ( 1 )
1280 {
1281 pStart = Wlc_PrsFindSymbol( pStart, '.' );
1282 if ( pStart == NULL )
1283 break;
1284 pStart = Wlc_PrsSkipSpaces( pStart+1 );
1285 if ( !
p->pNtk->fAsyncRst && !
strncmp(pStart,
"arst", 4) && pStart[4] !=
'v' )
1286 {
1287 int NameIdArst;
1288 pStart = Wlc_PrsFindSymbol( pStart, '(' );
1289 if ( pStart == NULL )
1291 pStart = Wlc_PrsSkipSpaces( pStart+1 );
1292 if ( Wlc_PrsIsDigit(pStart) )
1293 {
1294 int Range, Signed, XValue;
1295 Vec_Int_t * vFanins = Vec_IntAlloc( 100 );
1296 pStart = Wlc_PrsReadConstant(
p, pStart, vFanins, &Range, &Signed, &XValue );
1297 if ( pStart && Vec_IntSize(vFanins) == 1 && Vec_IntEntry(vFanins, 0) == 0 )
1298 {
1299 Vec_IntFree( vFanins );
1300 continue;
1301 }
1302 printf( "Detected async reset.\n" );
1303 p->pNtk->fAsyncRst = 1;
1304 Vec_IntFree( vFanins );
1305 continue;
1306 }
1307 pStart = Wlc_PrsFindName( pStart, &pName );
1308 if ( pStart == NULL )
1311 if (
p->pNtk->vArsts == NULL )
1312 p->pNtk->vArsts = Vec_IntAlloc( 100 );
1313 Vec_IntPushUnique(
p->pNtk->vArsts, NameIdArst );
1314 continue;
1315 }
1316 if ( pStart[0] !=
'd' && (pStart[0] !=
'q' || pStart[1] ==
'b') &&
strncmp(pStart,
"arstval", 7) )
1317 continue;
1318 fFlopIn = (pStart[0] == 'd');
1319 fFlopOut = (pStart[0] == 'q');
1320 pStart = Wlc_PrsFindSymbol( pStart, '(' );
1321 if ( pStart == NULL )
1323 pStart = Wlc_PrsFindName( pStart+1, &pName );
1324 if ( pStart == NULL )
1326 if ( fFlopIn )
1328 else if ( fFlopOut )
1330 else
1332 if ( !fFound )
1334 }
1335 if ( NameIdIn == -1 || NameIdOut == -1 )
1337
1338 pObj = Wlc_NtkObj(
p->pNtk, NameIdOut );
1340 Vec_IntPush( &
p->pNtk->vFfs, NameIdOut );
1341
1342
1343
1344 pObj = Wlc_NtkObj(
p->pNtk, NameIdIn );
1345 Vec_IntPush( &
p->pNtk->vFfs, NameIdIn );
1346
1347
1348
1349 if ( NameId == -1 )
1350 printf(
"Initial value of flop \"%s\" is not specified. Zero is assumed.\n",
Abc_NamStr(
p->pNtk->pManName, NameIdOut) );
1351 else
1352 {
1353 pObj = Wlc_NtkObj(
p->pNtk, NameId );
1354 if ( nBits != Wlc_ObjRange(pObj) )
1355 printf(
"Warning! Flop init signal \"%s\" bit-width (%d) is different from the flop declaration (%d)\n",
Abc_NamStr(
p->pNtk->pManName, NameId), Wlc_ObjRange(pObj), nBits );
1356 }
1357 if (
p->pNtk->vInits == NULL )
1358 p->pNtk->vInits = Vec_IntAlloc( 100 );
1359 Vec_IntPush(
p->pNtk->vInits, NameId > 0 ? NameId : -nBits );
1360
1361
1362 }
1363 else if ( Wlc_PrsStrCmp( pStart, "ABC_DFFRSE" ) )
1364 {
1365 int NameId[10] = {0}, fFound, fFlopIn, fFlopClk, fFlopRst, fFlopSet, fFlopEna, fFlopAsync, fFlopSre, fFlopInit, fFlopOut;
1366 pStart +=
strlen(
"ABC_DFFRSE");
1367 while ( 1 )
1368 {
1369 pStart = Wlc_PrsFindSymbol( pStart, '.' );
1370 if ( pStart == NULL )
1371 break;
1372 pStart = Wlc_PrsSkipSpaces( pStart+1 );
1373 fFlopIn = (pStart[0] == 'd');
1374 fFlopClk = (pStart[0] == 'c');
1375 fFlopRst = (pStart[0] == 'r');
1376 fFlopSet = (pStart[0] == 's' && pStart[1] == 'e');
1377 fFlopEna = (pStart[0] == 'e');
1378 fFlopAsync = (pStart[0] == 'a');
1379 fFlopSre = (pStart[0] == 's' && pStart[1] == 'r');
1380 fFlopInit = (pStart[0] == 'i');
1381 fFlopOut = (pStart[0] == 'q');
1382 pStart = Wlc_PrsFindSymbol( pStart, '(' );
1383 if ( pStart == NULL )
1385 pStart = Wlc_PrsFindName( pStart+1, &pName );
1386 if ( pStart == NULL )
1388 if ( fFlopIn )
1390 else if ( fFlopClk )
1392 else if ( fFlopRst )
1394 else if ( fFlopSet )
1396 else if ( fFlopEna )
1398 else if ( fFlopAsync )
1400 else if ( fFlopSre )
1402 else if ( fFlopInit )
1404 else if ( fFlopOut )
1406 else
1408 if ( !fFound )
1410 }
1411 if ( NameId[0] == -1 || NameId[7] == -1 )
1413
1414 pObj = Wlc_NtkObj(
p->pNtk, NameId[8] );
1416 Vec_IntClear(
p->vFanins );
1417 Vec_IntPush(
p->vFanins, NameId[0] );
1418 Vec_IntPush(
p->vFanins, NameId[1] );
1419 Vec_IntPush(
p->vFanins, NameId[2] );
1420 Vec_IntPush(
p->vFanins, NameId[3] );
1421 Vec_IntPush(
p->vFanins, NameId[4] );
1422 Vec_IntPush(
p->vFanins, NameId[5] );
1423 Vec_IntPush(
p->vFanins, NameId[6] );
1424 Vec_IntPush(
p->vFanins, NameId[7] );
1426 }
1427 else if ( Wlc_PrsStrCmp( pStart, "ABC_DFF" ) )
1428 {
1429 int NameId = -1, NameIdIn = -1, NameIdOut = -1, fFound, nBits = 1, fFlopIn, fFlopOut;
1430 pStart +=
strlen(
"ABC_DFF");
1431 while ( 1 )
1432 {
1433 pStart = Wlc_PrsFindSymbol( pStart, '.' );
1434 if ( pStart == NULL )
1435 break;
1436 pStart = Wlc_PrsSkipSpaces( pStart+1 );
1437 fFlopIn = (pStart[0] == 'd');
1438 fFlopOut = (pStart[0] == 'q');
1439 pStart = Wlc_PrsFindSymbol( pStart, '(' );
1440 if ( pStart == NULL )
1442 pStart = Wlc_PrsFindName( pStart+1, &pName );
1443 if ( pStart == NULL )
1445 if ( fFlopIn )
1447 else if ( fFlopOut )
1449 else
1451 if ( !fFound )
1453 }
1454 if ( NameIdIn == -1 || NameIdOut == -1 )
1456
1457 pObj = Wlc_NtkObj(
p->pNtk, NameIdOut );
1459 Vec_IntPush( &
p->pNtk->vFfs, NameIdOut );
1460 nBits = Wlc_ObjRange(Wlc_NtkObj(
p->pNtk, NameIdOut));
1461
1462 pObj = Wlc_NtkObj(
p->pNtk, NameIdIn );
1463 Vec_IntPush( &
p->pNtk->vFfs, NameIdIn );
1464
1465 if ( Wlc_ObjRange(Wlc_NtkObj(
p->pNtk, NameIdIn)) != nBits )
1466 printf( "Warning! Flop input \"%s\" bit-width (%d) is different from that of flop output (%d)\n",
1467 Abc_NamStr(
p->pNtk->pManName, NameId), Wlc_ObjRange(Wlc_NtkObj(
p->pNtk, NameIdIn)), nBits );
1468
1469 if ( NameId == -1 )
1470 printf(
"Initial value of flop \"%s\" is not specified. Zero is assumed.\n",
Abc_NamStr(
p->pNtk->pManName, NameIdOut) );
1471 else
1472 {
1473 if ( Wlc_ObjRange(Wlc_NtkObj(
p->pNtk, NameId)) != nBits )
1474 printf( "Warning! Flop init signal \"%s\" bit-width (%d) is different from that of flop output (%d)\n",
1475 Abc_NamStr(
p->pNtk->pManName, NameId), Wlc_ObjRange(Wlc_NtkObj(
p->pNtk, NameId)), nBits );
1476 }
1477 if (
p->pNtk->vInits == NULL )
1478 p->pNtk->vInits = Vec_IntAlloc( 100 );
1479 Vec_IntPush(
p->pNtk->vInits, NameId > 0 ? NameId : -Wlc_ObjRange(Wlc_NtkObj(
p->pNtk, NameIdOut)) );
1480
1481
1482 p->pNtk->fEasyFfs = 1;
1483 }
1484 else if ( Wlc_PrsStrCmp( pStart, "CPL_MEM_" ) )
1485 {
1486 int * pNameId = NULL, NameOutput, NameMi = -1, NameMo = -1, NameAddr = -1, NameDi = -1, NameDo = -1, fFound, fRead = 1;
1487 pStart +=
strlen(
"CPL_MEM_");
1488 if ( pStart[0] == 'W' )
1489 fRead = 0;
1490
1491 while ( 1 )
1492 {
1493 pStart = Wlc_PrsFindSymbol( pStart, '.' );
1494 if ( pStart == NULL )
1495 break;
1496 pStart = Wlc_PrsSkipSpaces( pStart+1 );
1497 if ( !
strncmp(pStart,
"mem_data_in", 11) )
1498 pNameId = &NameMi;
1499 else if ( !
strncmp(pStart,
"data_in", 7) )
1500 pNameId = &NameDi;
1501 else if ( !
strncmp(pStart,
"data_out", 8) )
1502 pNameId = fRead ? &NameDo : &NameMo;
1503 else if ( !
strncmp(pStart,
"addr_in", 7) )
1504 pNameId = &NameAddr;
1505 else
1507 pStart = Wlc_PrsFindSymbol( pStart, '(' );
1508 if ( pStart == NULL )
1510 pStart = Wlc_PrsFindName( pStart+1, &pName );
1511 if ( pStart == NULL )
1514 if ( !fFound )
1516 }
1517 if ( fRead && (NameMi == -1 || NameAddr == -1 || NameDo == -1) )
1519 if ( !fRead && (NameMi == -1 || NameAddr == -1 || NameDi == -1 || NameMo == -1) )
1521
1522 NameOutput = fRead ? NameDo : NameMo;
1523 pObj = Wlc_NtkObj(
p->pNtk, NameOutput );
1525 Vec_IntClear(
p->vFanins );
1526 Vec_IntPush(
p->vFanins, NameMi );
1527 Vec_IntPush(
p->vFanins, NameAddr );
1528 if ( !fRead )
1529 Vec_IntPush(
p->vFanins, NameDi );
1530
1532 }
1533 else if ( Wlc_PrsStrCmp( pStart, "ABC_READ" ) )
1534 {
1535 int * pNameId = NULL, NameMemIn = -1, NameData = -1, NameAddr = -1, fFound;
1536 pStart +=
strlen(
"ABC_READ");
1537 while ( 1 )
1538 {
1539 pStart = Wlc_PrsFindSymbol( pStart, '.' );
1540 if ( pStart == NULL )
1541 break;
1542 pStart = Wlc_PrsSkipSpaces( pStart+1 );
1543 if ( !
strncmp(pStart,
"mem_in", 6) )
1544 pNameId = &NameMemIn;
1545 else if ( !
strncmp(pStart,
"addr", 4) )
1546 pNameId = &NameAddr;
1547 else if ( !
strncmp(pStart,
"data", 4) )
1548 pNameId = &NameData;
1549 else
1551 pStart = Wlc_PrsFindSymbol( pStart, '(' );
1552 if ( pStart == NULL )
1554 pStart = Wlc_PrsFindName( pStart+1, &pName );
1555 if ( pStart == NULL )
1558 if ( !fFound )
1560 }
1561 if ( NameMemIn == -1 || NameAddr == -1 || NameData == -1 )
1563
1564 pObj = Wlc_NtkObj(
p->pNtk, NameData );
1566 Vec_IntClear(
p->vFanins );
1567 Vec_IntPush(
p->vFanins, NameMemIn );
1568 Vec_IntPush(
p->vFanins, NameAddr );
1570 p->pNtk->fMemPorts = 1;
1571 }
1572 else if ( Wlc_PrsStrCmp( pStart, "ABC_WRITE" ) )
1573 {
1574 int * pNameId = NULL, NameMemIn = -1, NameMemOut = -1, NameData = -1, NameAddr = -1, fFound;
1575 pStart +=
strlen(
"ABC_WRITE");
1576 while ( 1 )
1577 {
1578 pStart = Wlc_PrsFindSymbol( pStart, '.' );
1579 if ( pStart == NULL )
1580 break;
1581 pStart = Wlc_PrsSkipSpaces( pStart+1 );
1582 if ( !
strncmp(pStart,
"mem_in", 6) )
1583 pNameId = &NameMemIn;
1584 else if ( !
strncmp(pStart,
"mem_out", 7) )
1585 pNameId = &NameMemOut;
1586 else if ( !
strncmp(pStart,
"data", 4) )
1587 pNameId = &NameData;
1588 else if ( !
strncmp(pStart,
"addr", 4) )
1589 pNameId = &NameAddr;
1590 else
1592 pStart = Wlc_PrsFindSymbol( pStart, '(' );
1593 if ( pStart == NULL )
1595 pStart = Wlc_PrsFindName( pStart+1, &pName );
1596 if ( pStart == NULL )
1599 if ( !fFound )
1601 }
1602 if ( NameMemIn == -1 || NameAddr == -1 || NameData == -1 || NameMemOut == -1 )
1604
1605 pObj = Wlc_NtkObj(
p->pNtk, NameMemOut );
1607 Vec_IntClear(
p->vFanins );
1608 Vec_IntPush(
p->vFanins, NameMemIn );
1609 Vec_IntPush(
p->vFanins, NameAddr );
1610 Vec_IntPush(
p->vFanins, NameData );
1612 p->pNtk->fMemPorts = 1;
1613 }
1614 else if ( Wlc_PrsStrCmp( pStart, "CPL_RROT" ) || Wlc_PrsStrCmp( pStart, "CPL_LROT" ) )
1615 {
1616
1617 int right_rotation = Wlc_PrsStrCmp( pStart, "CPL_RROT" );
1618 int NameId = -1, NameIdOut = -1, NameIdInD = -1, NameIdInS = -1, fFound, fRotInD, fRotInS, fRotOut;
1619 pStart +=
strlen(
"CPL_RROT");
1620
1621
1622
1623
1624
1625 while ( 1 )
1626 {
1627 pStart = Wlc_PrsFindSymbol( pStart, '.' );
1628 if ( pStart == NULL )
1629 break;
1630 pStart = Wlc_PrsSkipSpaces( pStart+1 );
1631 if ( pStart[0] != 'o' && pStart[0] != 'd' && pStart[0] != 's')
1632 continue;
1633 fRotInD = (pStart[0] == 'd');
1634 fRotInS = (pStart[0] == 's');
1635 fRotOut = (pStart[0] == 'o');
1636 pStart = Wlc_PrsFindSymbol( pStart, '(' );
1637 if ( pStart == NULL )
1639 pStart = Wlc_PrsFindName( pStart+1, &pName );
1640 if ( pStart == NULL )
1642 if ( fRotInD )
1644 else if ( fRotInS )
1646 else if ( fRotOut )
1648 else
1650 if ( !fFound )
1652 }
1653 if ( NameIdOut == -1 || NameIdInD == -1 || NameIdInS == -1 )
1655
1656 pObj = Wlc_NtkObj(
p->pNtk, NameIdOut );
1658 Vec_IntClear(
p->vFanins );
1659 Vec_IntPush(
p->vFanins, NameIdInD );
1660 Vec_IntPush(
p->vFanins, NameIdInS );
1662 }
1663 else if ( pStart[0] == '(' && pStart[1] == '*' )
1664 {
1665 while ( *pStart++ != ')' );
1666 pStart = Wlc_PrsSkipSpaces( pStart );
1667 goto startword;
1668 }
1669 else if ( pStart[0] != '`' )
1670 {
1672 pStart = Wlc_PrsFindName( pStart, &pName );
1673 return Wlc_PrsWriteErrorMessage(
p, pStart,
"Cannot read line %d beginning with %s.", iLine, (!pName || !pName[0]) ?
"\"?\"" : pName );
1674 }
1675 }
1676 if (
p->nNonZero[0] )
1677 {
1678 printf(
"Warning: Input file contains %d objects with non-zero-based ranges.\n",
p->nNonZero[0] );
1679 printf(
"For example, signal with range [%d:%d] is declared in line %d.\n",
p->nNonZero[1],
p->nNonZero[2],
p->nNonZero[3] );
1680 }
1681 if (
p->nNegative[0] )
1682 {
1683 printf(
"Warning: Input file contains %d objects with negative ranges.\n",
p->nNegative[0] );
1684 printf(
"For example, signal with range [%d:%d] is declared in line %d.\n",
p->nNegative[1],
p->nNegative[2],
p->nNegative[3] );
1685 }
1686 if (
p->nReverse[0] )
1687 {
1688 printf(
"Warning: Input file contains %d objects with reversed ranges.\n",
p->nReverse[0] );
1689 printf(
"For example, signal with range [%d:%d] is declared in line %d.\n",
p->nReverse[1],
p->nReverse[2],
p->nReverse[3] );
1690 }
1691 return 1;
1692}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
unsigned __int64 word
DECLARATIONS ///.
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
int Abc_NamStrFindOrAdd(Abc_Nam_t *p, char *pStr, int *pfFound)
Abc_Nam_t * Abc_NamStart(int nObjs, int nAveSize)
FUNCTION DEFINITIONS ///.
char * Abc_NamStr(Abc_Nam_t *p, int NameId)
char * Wlc_PrsStrtok(char *s, const char *delim)
#define Wlc_PrsForEachLineStart(p, pLine, i, Start)
int Wlc_PrsCheckBitConst0(Wlc_Ntk_t *p, int NameId)
char * Wlc_PrsConvertInitValues(Wlc_Ntk_t *p)
int Wlc_PrsWriteErrorMessage(Wlc_Prs_t *p, char *pCur, const char *format,...)
#define Wlc_PrsForEachLine(p, pLine, i)
int Wlc_PrsFindLine(Wlc_Prs_t *p, char *pCur)
int Wlc_PrsReadDeclaration(Wlc_Prs_t *p, char *pStart)
#define Wlc_NtkForEachPo(p, pPo, i)
void Wlc_ObjSetCo(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int fFlopInput)
#define Wlc_NtkForEachFf(p, pFf, i)
Wlc_Ntk_t * Wlc_NtkAlloc(char *pName, int nObjsAlloc)
void Wlc_ObjAddFanins(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vFanins)
void Wlc_ObjSetCi(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
void Wlc_ObjUpdateType(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int Type)
char * Wlc_ObjName(Wlc_Ntk_t *p, int iObj)