summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/aig/gia/giaAiger.c113
-rw-r--r--src/aig/gia/giaDeep.c2
-rw-r--r--src/aig/gia/giaUtil.c1
-rw-r--r--src/base/acb/acbFunc.c39
4 files changed, 153 insertions, 2 deletions
diff --git a/src/aig/gia/giaAiger.c b/src/aig/gia/giaAiger.c
index 593743d5..817a15fe 100644
--- a/src/aig/gia/giaAiger.c
+++ b/src/aig/gia/giaAiger.c
@@ -176,6 +176,7 @@ Vec_Str_t * Gia_AigerWriteLiterals( Vec_Int_t * vLits )
Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fGiaSimple, int fSkipStrash, int fCheck )
{
Gia_Man_t * pNew, * pTemp;
+ Vec_Ptr_t * vNamesIn = NULL, * vNamesOut = NULL, * vNamesRegIn = NULL, * vNamesRegOut = NULL;
Vec_Int_t * vLits = NULL, * vPoTypes = NULL;
Vec_Int_t * vNodes, * vDrivers, * vInits = NULL;
int iObj, iNode0, iNode1, fHieOnly = 0;
@@ -377,6 +378,88 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fGiaSi
pCur = pSymbols;
if ( pCur < (unsigned char *)pContents + nFileSize && *pCur != 'c' )
{
+ int fReadNames = 1;
+ if ( fReadNames )
+ {
+ int fError = 0;
+ while ( !fError && pCur < (unsigned char *)pContents + nFileSize && *pCur != 'c' )
+ {
+ int iTerm;
+ char * pType = (char *)pCur;
+ char * pName = NULL;
+ // check terminal type
+ if ( *pCur != 'i' && *pCur != 'o' && *pCur != 'l' )
+ {
+ fError = 1;
+ break;
+ }
+ // get terminal number
+ iTerm = atoi( (char *)++pCur ); while ( *pCur++ != ' ' );
+ // skip spaces
+ while ( *pCur == ' ' )
+ pCur++;
+ // skip till the end of line
+ for ( pName = pCur; *pCur && *pCur != '\n'; pCur++ );
+ if ( *pCur == '\n' )
+ *pCur = 0;
+ // save the name
+ if ( *pType == 'i' )
+ {
+ if ( vNamesIn == NULL )
+ vNamesIn = Vec_PtrAlloc( nInputs + nLatches );
+ if ( Vec_PtrSize(vNamesIn) != iTerm )
+ {
+ fError = 1;
+ break;
+ }
+ Vec_PtrPush( vNamesIn, Abc_UtilStrsav(pName) );
+ }
+ else if ( *pType == 'o' )
+ {
+ if ( vNamesOut == NULL )
+ vNamesOut = Vec_PtrAlloc( nOutputs + nLatches );
+ if ( Vec_PtrSize(vNamesOut) != iTerm )
+ {
+ fError = 1;
+ break;
+ }
+ Vec_PtrPush( vNamesOut, Abc_UtilStrsav(pName) );
+ }
+ else if ( *pType == 'l' )
+ {
+ char Buffer[1000];
+ assert( strlen(pName) < 995 );
+ sprintf( Buffer, "%s_in", pName );
+ if ( vNamesRegIn == NULL )
+ vNamesRegIn = Vec_PtrAlloc( nLatches );
+ if ( vNamesRegOut == NULL )
+ vNamesRegOut = Vec_PtrAlloc( nLatches );
+ if ( Vec_PtrSize(vNamesRegIn) != iTerm )
+ {
+ fError = 1;
+ break;
+ }
+ Vec_PtrPush( vNamesRegIn, Abc_UtilStrsav(Buffer) );
+ Vec_PtrPush( vNamesRegOut, Abc_UtilStrsav(pName) );
+ }
+ else
+ {
+ fError = 1;
+ break;
+ }
+ pCur++;
+ }
+ if ( fError )
+ {
+ printf( "Error occurred when reading signal names.\n" );
+ if ( vNamesIn ) Vec_PtrFreeFree( vNamesIn ), vNamesIn = NULL;
+ if ( vNamesOut ) Vec_PtrFreeFree( vNamesOut ), vNamesOut = NULL;
+ if ( vNamesRegIn ) Vec_PtrFreeFree( vNamesRegIn ), vNamesRegIn = NULL;
+ if ( vNamesRegOut ) Vec_PtrFreeFree( vNamesRegOut ), vNamesRegOut = NULL;
+ }
+ }
+ else
+ {
int fBreakUsed = 0;
unsigned char * pCurOld = pCur;
pNew->vUserPiIds = Vec_IntStartFull( nInputs );
@@ -505,6 +588,7 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fGiaSi
}
Vec_IntFree( vPoNames );
}
+ }
}
@@ -867,6 +951,35 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fGiaSi
Abc_Print( 0, "Structural hashing enabled while reading AIGER invalidated the mapping. Consider using \"&r -s\".\n" );
Vec_IntFreeP( &pNew->vMapping );
}
+ if ( vNamesIn && Gia_ManPiNum(pNew) != Vec_PtrSize(vNamesIn) )
+ Abc_Print( 0, "The number of inputs does not match the number of input names.\n" );
+ else if ( vNamesOut && Gia_ManPoNum(pNew) != Vec_PtrSize(vNamesOut) )
+ Abc_Print( 0, "The number of output does not match the number of output names.\n" );
+ else if ( vNamesRegOut && Gia_ManRegNum(pNew) != Vec_PtrSize(vNamesRegOut) )
+ Abc_Print( 0, "The number of inputs does not match the number of flop names.\n" );
+ else if ( vNamesIn && vNamesOut )
+ {
+ pNew->vNamesIn = vNamesIn; vNamesIn = NULL;
+ pNew->vNamesOut = vNamesOut; vNamesOut = NULL;
+ if ( vNamesRegOut )
+ {
+ Vec_PtrAppend( pNew->vNamesIn, vNamesRegOut );
+ Vec_PtrClear( vNamesRegOut );
+ Vec_PtrFree( vNamesRegOut );
+ vNamesRegOut = NULL;
+ }
+ if ( vNamesRegIn )
+ {
+ Vec_PtrAppend( pNew->vNamesOut, vNamesRegIn );
+ Vec_PtrClear( vNamesRegIn );
+ Vec_PtrFree( vNamesRegIn );
+ vNamesRegIn = NULL;
+ }
+ }
+ if ( vNamesIn ) Vec_PtrFreeFree( vNamesIn );
+ if ( vNamesOut ) Vec_PtrFreeFree( vNamesOut );
+ if ( vNamesRegIn ) Vec_PtrFreeFree( vNamesRegIn );
+ if ( vNamesRegOut ) Vec_PtrFreeFree( vNamesRegOut );
return pNew;
}
diff --git a/src/aig/gia/giaDeep.c b/src/aig/gia/giaDeep.c
index eecc598a..815a546e 100644
--- a/src/aig/gia/giaDeep.c
+++ b/src/aig/gia/giaDeep.c
@@ -73,7 +73,7 @@ Gia_Man_t * Gia_ManDeepSynOne( int nNoImpr, int TimeOut, int nAnds, int Seed, in
else if ( fCom == 0 )
pComp = "; &dc2";
sprintf( Command, "&dch%s; &if -a -K %d; &mfs -e -W 20 -L 20%s%s",
- fDch ? " -f" : "", KLut, fFx ? "; &fx" : "", pComp );
+ fDch ? " -f" : "", KLut, fFx ? "; &fx; &st" : "", pComp );
if ( Abc_FrameIsBatchMode() )
{
if ( Cmd_CommandExecute(Abc_FrameGetGlobalFrame(), Command) )
diff --git a/src/aig/gia/giaUtil.c b/src/aig/gia/giaUtil.c
index 85d8b1d2..0a40e63e 100644
--- a/src/aig/gia/giaUtil.c
+++ b/src/aig/gia/giaUtil.c
@@ -2937,7 +2937,6 @@ Gia_Man_t * Gia_ManConvertSupp( Gia_Man_t * p )
***********************************************************************/
Gia_Man_t * Gia_ManTransformCond2( Gia_Man_t * p )
{
- int fOnly1 = 0;
int fVerbose = 1;
abctime clk = Abc_Clock();
Gia_Man_t * pNew, * pTemp;
diff --git a/src/base/acb/acbFunc.c b/src/base/acb/acbFunc.c
index 55918f49..a8cae33d 100644
--- a/src/base/acb/acbFunc.c
+++ b/src/base/acb/acbFunc.c
@@ -776,6 +776,31 @@ Gia_Man_t * Acb_NtkToGia( Acb_Ntk_t * p, Vec_Int_t * vSupp, Vec_Int_t * vNodes,
Gia_ManStop( pOne );
return pNew;
}
+int Acb_NtkSaveNames( Acb_Ntk_t * p, Vec_Int_t * vSupp, Vec_Int_t * vNodes, Vec_Int_t * vRoots, Vec_Int_t * vDivs, Vec_Int_t * vTargets, Gia_Man_t * pNew )
+{
+ int i, iObj;
+ assert( pNew->vNamesIn == NULL );
+
+ pNew->vNamesIn = Vec_PtrAlloc( Gia_ManCiNum(pNew) );
+ Acb_NtkForEachCiVec( vSupp, p, iObj, i )
+ Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Acb_ObjNameStr(p, iObj)) );
+ if ( vTargets )
+ Vec_IntForEachEntry( vTargets, iObj, i )
+ Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Acb_ObjNameStr(p, iObj)) );
+
+ pNew->vNamesOut = Vec_PtrAlloc( Gia_ManCoNum(pNew) );
+ Acb_NtkForEachCoDriverVec( vRoots, p, iObj, i )
+ Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Acb_ObjNameStr(p, iObj)) );
+ if ( vDivs )
+ Vec_IntForEachEntry( vDivs, iObj, i )
+ {
+ char Buffer[100];
+ assert( strlen(Acb_ObjNameStr(p, iObj)) < 90 );
+ sprintf( Buffer, "%s_%d", Acb_ObjNameStr(p, iObj), Acb_ObjWeight(p, iObj) );
+ Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
+ }
+ return 1;
+}
/**Function*************************************************************
@@ -2622,6 +2647,10 @@ int Acb_NtkEcoPerform( Acb_Ntk_t * pNtkF, Acb_Ntk_t * pNtkG, char * pFileName[4]
char * pSop = NULL;
int i;
+// int Value = Acb_NtkSaveNames( pNtkF, vSupp, vNodesF, vRoots, vDivs, &pNtkF->vTargets, pGiaF );
+// Gia_AigerWrite( pGiaF, pFileBase, 0, 0, 0 );
+// return 0;
+
if ( fVerbose )
{
printf( "The number of targets = %d.\n", nTargets );
@@ -2770,6 +2799,16 @@ int Acb_NtkEcoPerform( Acb_Ntk_t * pNtkF, Acb_Ntk_t * pNtkG, char * pFileName[4]
if ( pFileName[3] == NULL ) Acb_GenerateFilePatch( vPatch, "patch.v" );
Acb_GenerateFileOut( vInst, pFileName[0], pFileName[3] ? pFileName[3] : (char *)"out.v", vPatch );
printf( "Finished dumping resulting file \"%s\".\n\n", pFileName[3] ? pFileName[3] : "out.v" );
+/*
+ {
+ char * pFileBase = Extra_FileNameGenericAppend( pFileName[0], "_patch.v" );
+ Acb_GenerateFilePatch( vPatch, pFileBase );
+ pFileBase = Extra_FileNameGenericAppend( pFileName[0], "_out.v" );
+ Acb_GenerateFileOut( vInst, pFileName[0], pFileName[3] ? pFileName[3] : pFileBase, vPatch );
+ Acb_GenerateFileOut( vInst, pFileName[0], pFileName[3] ? pFileName[3] : "out.v", vPatch );
+ printf( "Finished dumping resulting file \"%s\".\n\n", pFileName[3] ? pFileName[3] : pFileBase );
+ }
+*/
//Gia_AigerWrite( pGiaG, "test.aig", 0, 0, 0 );
cleanup:
// cleanup