Skip to content

Commit 40ea8a7

Browse files
committed
Enabling support for input/output names in mini mapping format.
1 parent 9390a74 commit 40ea8a7

File tree

2 files changed

+53
-31
lines changed

2 files changed

+53
-31
lines changed

src/base/abci/abcMap.c

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ Vec_Int_t * Abc_NtkWriteMiniMapping( Abc_Ntk_t * pNtk )
852852
// write the numbers of CI/CO/Node/FF
853853
Vec_IntPush( vMapping, Abc_NtkCiNum(pNtk) );
854854
Vec_IntPush( vMapping, Abc_NtkCoNum(pNtk) );
855-
Vec_IntPush( vMapping, Abc_NtkNodeNum(pNtk) );
855+
Vec_IntPush( vMapping, Vec_PtrSize(vNodes) );
856856
Vec_IntPush( vMapping, Abc_NtkLatchNum(pNtk) );
857857
// write the nodes
858858
vGates = Vec_StrAlloc( 10000 );
@@ -868,6 +868,15 @@ Vec_Int_t * Abc_NtkWriteMiniMapping( Abc_Ntk_t * pNtk )
868868
// write the COs literals
869869
Abc_NtkForEachCo( pNtk, pObj, i )
870870
Vec_IntPush( vMapping, Abc_ObjFanin0(pObj)->iTemp );
871+
// write signal names
872+
Abc_NtkForEachCi( pNtk, pObj, i ) {
873+
Vec_StrPrintStr( vGates, Abc_ObjName(pObj) );
874+
Vec_StrPush( vGates, '\0' );
875+
}
876+
Abc_NtkForEachCo( pNtk, pObj, i ) {
877+
Vec_StrPrintStr( vGates, Abc_ObjName(pObj) );
878+
Vec_StrPush( vGates, '\0' );
879+
}
871880
// finish off the array
872881
nExtra = 4 - Vec_StrSize(vGates) % 4;
873882
for ( i = 0; i < nExtra; i++ )
@@ -913,19 +922,23 @@ Abc_Ntk_t * Abc_NtkFromMiniMapping( int *pArray )
913922
int i, k, nLeaves, Pos = 4;
914923
char * pBuffer, * pName;
915924
Mio_Gate_t *pGate;
925+
Abc_Obj_t * pObj;
916926
nCis = pArray[0];
917927
nCos = pArray[1];
918928
nNodes = pArray[2];
919929
nFlops = pArray[3];
920-
// create pi
921-
for ( i = 0; i < nCis; i++ )
930+
// create pis
931+
for ( i = 0; i < nCis-nFlops; i++ )
922932
Abc_NtkCreatePi( pNtkMapped );
933+
// create pos
934+
for ( i = 0; i < nCos-nFlops; i++ )
935+
Abc_NtkCreatePo( pNtkMapped );
936+
// create flops
937+
for ( i = 0; i < nFlops; i++ )
938+
Abc_NtkAddLatch( pNtkMapped, NULL, ABC_INIT_ZERO );
923939
// create nodes
924940
for ( i = 0; i < nNodes; i++ )
925941
Abc_NtkCreateNode( pNtkMapped );
926-
// create po
927-
for ( i = 0; i < nCos; i++ )
928-
Abc_NtkCreatePo( pNtkMapped );
929942
// connect nodes
930943
for ( i = 0; i < nNodes; i++ )
931944
{
@@ -944,26 +957,21 @@ Abc_Ntk_t * Abc_NtkFromMiniMapping( int *pArray )
944957
pGate = Mio_LibraryReadGateByName( pLib, pName, NULL );
945958
Abc_NtkObj( pNtkMapped, nCis + i + 1 )->pData = pGate;
946959
}
947-
Abc_NtkAddDummyPiNames( pNtkMapped );
948-
Abc_NtkAddDummyPoNames( pNtkMapped );
949960

950-
// decouple the PO driver nodes to reduce the number of levels
951-
int fFixDrivers = 1, fUseBuffs = 1, fVerbose = 1;
952-
if ( fFixDrivers )
953-
{
954-
int nDupGates = Abc_NtkLogicMakeSimpleCos( pNtkMapped, !fUseBuffs );
955-
if ( fVerbose && nDupGates && !Abc_FrameReadFlag("silentmode") )
956-
{
957-
if ( fUseBuffs )
958-
printf( "Added %d buffers/inverters to decouple the CO drivers.\n", nDupGates );
959-
else
960-
printf( "Duplicated %d gates to decouple the CO drivers.\n", nDupGates );
961-
}
961+
assert( Abc_NtkCiNum(pNtkMapped) == nCis );
962+
Abc_NtkForEachCi( pNtkMapped, pObj, i ) {
963+
pName = pBuffer;
964+
pBuffer += strlen(pName) + 1;
965+
Abc_ObjAssignName( pObj, pName, NULL );
966+
}
967+
assert( Abc_NtkCoNum(pNtkMapped) == nCos );
968+
Abc_NtkForEachCo( pNtkMapped, pObj, i ) {
969+
pName = pBuffer;
970+
pBuffer += strlen(pName) + 1;
971+
Abc_ObjAssignName( pObj, pName, NULL );
962972
}
963973

964974
if ( !Abc_NtkCheck( pNtkMapped ) ) {
965-
//extern void Abc_NtkPrintMiniMapping( int * pArray );
966-
//Abc_NtkPrintMiniMapping( pArray );
967975
fprintf( stdout, "Abc_NtkFromMiniMapping(): Network check has failed.\n" );
968976
}
969977

@@ -987,11 +995,11 @@ Abc_Ntk_t * Abc_NtkReadFromFile( char * pFileName )
987995
if ( nSize == 0 )
988996
return NULL;
989997
FILE * pFile = fopen( pFileName, "rb" );
990-
int * pArray = ABC_ALLOC( int, nSize );
998+
char * pArray = ABC_ALLOC( char, nSize );
991999
int nSize2 = fread( pArray, sizeof(char), nSize, pFile );
9921000
assert( nSize2 == nSize );
9931001
fclose( pFile );
994-
Abc_Ntk_t * pNtk = Abc_NtkFromMiniMapping( pArray );
1002+
Abc_Ntk_t * pNtk = Abc_NtkFromMiniMapping( (int*)pArray );
9951003
ABC_FREE( pArray );
9961004
return pNtk;
9971005
}
@@ -1032,8 +1040,8 @@ void Abc_NtkPrintMiniMapping( int * pArray )
10321040
printf( "The first %d object IDs (from 0 to %d) are reserved for the CIs.\n", nCis, nCis - 1 );
10331041
for ( i = 0; i < nNodes; i++ )
10341042
{
1035-
printf( "Node %d has fanins {", nCis + i );
10361043
nLeaves = pArray[Pos++];
1044+
printf( "Node %d has %d fanins {", nCis + i, nLeaves );
10371045
for ( k = 0; k < nLeaves; k++ )
10381046
printf( " %d", pArray[Pos++] );
10391047
printf( " }\n" );
@@ -1047,6 +1055,18 @@ void Abc_NtkPrintMiniMapping( int * pArray )
10471055
pBuffer += strlen(pName) + 1;
10481056
printf( "Node %d has gate \"%s\"\n", nCis + i, pName );
10491057
}
1058+
for ( i = 0; i < nCis; i++ )
1059+
{
1060+
pName = pBuffer;
1061+
pBuffer += strlen(pName) + 1;
1062+
printf( "CI %d has name \"%s\"\n", i, pName );
1063+
}
1064+
for ( i = 0; i < nCos; i++ )
1065+
{
1066+
pName = pBuffer;
1067+
pBuffer += strlen(pName) + 1;
1068+
printf( "CO %d has name \"%s\"\n", i, pName );
1069+
}
10501070
}
10511071

10521072
/**Function*************************************************************

src/base/abci/abcPart.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,8 +1335,6 @@ int Abc_NtkStochProcess1( void * p )
13351335
Vec_Ptr_t * Abc_NtkStochProcess( Vec_Ptr_t * vWins, char * pScript, int nProcs, int TimeSecs, int fVerbose )
13361336
{
13371337
if ( nProcs <= 2 ) {
1338-
if ( fVerbose )
1339-
printf( "Running non-concurrent synthesis.\n" ), fflush(stdout);
13401338
Abc_NtkStochSynthesis( vWins, pScript );
13411339
return NULL;
13421340
}
@@ -1352,8 +1350,6 @@ Vec_Ptr_t * Abc_NtkStochProcess( Vec_Ptr_t * vWins, char * pScript, int nProcs,
13521350
pData[i].TimeOut = TimeSecs;
13531351
Vec_PtrPush( vData, pData+i );
13541352
}
1355-
if ( fVerbose )
1356-
printf( "Running concurrent synthesis with %d processes.\n", nProcs ), fflush(stdout);
13571353
Util_ProcessThreads( Abc_NtkStochProcess1, vData, nProcs, TimeSecs, fVerbose );
13581354
// replace old AIGs by new AIGs
13591355
Vec_PtrForEachEntry( Abc_Ntk_t *, vWins, pNtk, i ) {
@@ -1850,8 +1846,14 @@ void Abc_NtkStochMap( int nSuppMax, int nIters, int TimeOut, int Seed, int fVerb
18501846
Abc_Random(1);
18511847
for ( i = 0; i < 10+Seed; i++ )
18521848
Abc_Random(0);
1853-
if ( fVerbose )
1854-
printf( "Running %d iterations of script \"%s\".\n", nIters, pScript );
1849+
if ( fVerbose ) {
1850+
printf( "Running %d iterations of the script \"%s\"", nIters, pScript );
1851+
if ( nProcs > 2 )
1852+
printf( " using %d concurrent threads.\n", nProcs-1 );
1853+
else
1854+
printf( " without concurrency.\n" );
1855+
fflush(stdout);
1856+
}
18551857
Vec_Ptr_t * vIns = NULL, * vOuts = NULL, * vNodes = NULL;
18561858
for ( i = 0; i < nIters; i++ )
18571859
{

0 commit comments

Comments
 (0)