mirror of https://github.com/YosysHQ/abc.git
Adding STG generation (&era -d) and STG encoding (&read_stg <file>).
This commit is contained in:
parent
99a9718355
commit
59fe3268a7
|
|
@ -3555,6 +3555,10 @@ SOURCE=.\src\aig\gia\giaSpeedup.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\aig\gia\giaStg.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\aig\gia\giaSupMin.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
|||
|
|
@ -966,6 +966,9 @@ extern int Gia_ManSimSimulate( Gia_Man_t * pAig, Gia_ParSim_t *
|
|||
extern float Gia_ManDelayTraceLut( Gia_Man_t * p );
|
||||
extern float Gia_ManDelayTraceLutPrint( Gia_Man_t * p, int fVerbose );
|
||||
extern Gia_Man_t * Gia_ManSpeedup( Gia_Man_t * p, int Percentage, int Degree, int fVerbose, int fVeryVerbose );
|
||||
/*=== giaStg.c ============================================================*/
|
||||
extern void Gia_ManStgPrint( FILE * pFile, Vec_Int_t * vLines, int nIns, int nOuts, int nStates );
|
||||
extern Gia_Man_t * Gia_ManStgRead( char * pFileName, int fOneHot, int fLogar );
|
||||
/*=== giaSweep.c ============================================================*/
|
||||
extern Gia_Man_t * Gia_ManFraigSweep( Gia_Man_t * p, void * pPars );
|
||||
/*=== giaSwitch.c ============================================================*/
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ struct Gia_ManEra_t_
|
|||
Gia_ObjEra_t * pStateNew; // temporary state
|
||||
int iCurState; // the current state
|
||||
Vec_Int_t * vBugTrace; // the sequence of transitions
|
||||
Vec_Int_t * vStgDump; // STG written into a file
|
||||
// hash table for states
|
||||
int nBins;
|
||||
unsigned * pBins;
|
||||
|
|
@ -102,6 +103,7 @@ Gia_ManEra_t * Gia_ManEraCreate( Gia_Man_t * pAig )
|
|||
// assign constant zero node
|
||||
pSimInfo = Gia_ManEraData( p, 0 );
|
||||
memset( pSimInfo, 0, sizeof(unsigned) * p->nWordsSim );
|
||||
p->vStgDump = Vec_IntAlloc( 1000 );
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
@ -119,6 +121,7 @@ Gia_ManEra_t * Gia_ManEraCreate( Gia_Man_t * pAig )
|
|||
void Gia_ManEraFree( Gia_ManEra_t * p )
|
||||
{
|
||||
Mem_FixedStop( p->pMemory, 0 );
|
||||
Vec_IntFree( p->vStgDump );
|
||||
Vec_PtrFree( p->vStates );
|
||||
if ( p->vBugTrace ) Vec_IntFree( p->vBugTrace );
|
||||
ABC_FREE( p->pDataSim );
|
||||
|
|
@ -195,14 +198,20 @@ int Gia_ManEraStateHash( unsigned * pState, int nWordsSim, int nTableSize )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
static inline unsigned * Gia_ManEraHashFind( Gia_ManEra_t * p, Gia_ObjEra_t * pState )
|
||||
static inline unsigned * Gia_ManEraHashFind( Gia_ManEra_t * p, Gia_ObjEra_t * pState, int * pStateNum )
|
||||
{
|
||||
Gia_ObjEra_t * pThis;
|
||||
unsigned * pPlace = p->pBins + Gia_ManEraStateHash( pState->pData, p->nWordsDat, p->nBins );
|
||||
for ( pThis = (*pPlace)? Gia_ManEraState(p, *pPlace) : NULL; pThis;
|
||||
pPlace = (unsigned *)&pThis->iNext, pThis = (*pPlace)? Gia_ManEraState(p, *pPlace) : NULL )
|
||||
if ( !memcmp( pState->pData, pThis->pData, sizeof(unsigned) * p->nWordsDat ) )
|
||||
{
|
||||
if ( pStateNum )
|
||||
*pStateNum = pThis->Num;
|
||||
return NULL;
|
||||
}
|
||||
if ( pStateNum )
|
||||
*pStateNum = -1;
|
||||
return pPlace;
|
||||
}
|
||||
|
||||
|
|
@ -238,7 +247,7 @@ void Gia_ManEraHashResize( Gia_ManEra_t * p )
|
|||
{
|
||||
assert( pThis->Num );
|
||||
pThis->iNext = 0;
|
||||
piPlace = Gia_ManEraHashFind( p, pThis );
|
||||
piPlace = Gia_ManEraHashFind( p, pThis, NULL );
|
||||
assert( *piPlace == 0 ); // should not be there
|
||||
*piPlace = pThis->Num;
|
||||
Counter++;
|
||||
|
|
@ -437,11 +446,11 @@ int Gia_ManCountDepth( Gia_ManEra_t * p )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Gia_ManAnalyzeResult( Gia_ManEra_t * p, Gia_ObjEra_t * pState, int fMiter )
|
||||
int Gia_ManAnalyzeResult( Gia_ManEra_t * p, Gia_ObjEra_t * pState, int fMiter, int fStgDump )
|
||||
{
|
||||
Gia_Obj_t * pObj;
|
||||
unsigned * pSimInfo, * piPlace;
|
||||
int i, k, iCond, nMints;
|
||||
unsigned * pSimInfo, * piPlace, uOutput = 0;
|
||||
int i, k, iCond, nMints, iNextState;
|
||||
// check if the miter is asserted
|
||||
if ( fMiter )
|
||||
{
|
||||
|
|
@ -468,9 +477,27 @@ int Gia_ManAnalyzeResult( Gia_ManEra_t * p, Gia_ObjEra_t * pState, int fMiter )
|
|||
if ( Abc_InfoHasBit(p->pStateNew->pData, i) != Abc_InfoHasBit(pSimInfo, k) )
|
||||
Abc_InfoXorBit( p->pStateNew->pData, i );
|
||||
}
|
||||
piPlace = Gia_ManEraHashFind( p, p->pStateNew );
|
||||
if ( fStgDump )
|
||||
{
|
||||
uOutput = 0;
|
||||
Gia_ManForEachPo( p->pAig, pObj, i )
|
||||
{
|
||||
pSimInfo = Gia_ManEraData( p, Gia_ObjId(p->pAig, pObj) );
|
||||
if ( Abc_InfoHasBit(pSimInfo, k) && i < 32 )
|
||||
Abc_InfoXorBit( &uOutput, i );
|
||||
}
|
||||
}
|
||||
piPlace = Gia_ManEraHashFind( p, p->pStateNew, &iNextState );
|
||||
if ( fStgDump ) Vec_IntPush( p->vStgDump, k );
|
||||
if ( fStgDump ) Vec_IntPush( p->vStgDump, pState->Num );
|
||||
if ( piPlace == NULL )
|
||||
{
|
||||
if ( fStgDump ) Vec_IntPush( p->vStgDump, iNextState );
|
||||
if ( fStgDump ) Vec_IntPush( p->vStgDump, uOutput );
|
||||
continue;
|
||||
}
|
||||
if ( fStgDump ) Vec_IntPush( p->vStgDump, p->pStateNew->Num );
|
||||
if ( fStgDump ) Vec_IntPush( p->vStgDump, uOutput );
|
||||
//printf( "Inserting %d ", Vec_PtrSize(p->vStates) );
|
||||
//Extra_PrintBinary( stdout, p->pStateNew->pData, Gia_ManRegNum(p->pAig) ); printf( "\n" );
|
||||
assert( *piPlace == 0 );
|
||||
|
|
@ -497,7 +524,7 @@ int Gia_ManAnalyzeResult( Gia_ManEra_t * p, Gia_ObjEra_t * pState, int fMiter )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Gia_ManCollectReachable( Gia_Man_t * pAig, int nStatesMax, int fMiter, int fVerbose )
|
||||
int Gia_ManCollectReachable( Gia_Man_t * pAig, int nStatesMax, int fMiter, int fDumpFile, int fVerbose )
|
||||
{
|
||||
Gia_ManEra_t * p;
|
||||
Gia_ObjEra_t * pState;
|
||||
|
|
@ -531,7 +558,7 @@ int Gia_ManCollectReachable( Gia_Man_t * pAig, int nStatesMax, int fMiter, int f
|
|||
//Extra_PrintBinary( stdout, p->pStateNew->pData, Gia_ManRegNum(p->pAig) ); printf( "\n" );
|
||||
Gia_ManInsertState( p, pState );
|
||||
Gia_ManPerformOneIter( p );
|
||||
if ( Gia_ManAnalyzeResult( p, pState, fMiter ) && fMiter )
|
||||
if ( Gia_ManAnalyzeResult( p, pState, fMiter, fDumpFile ) && fMiter )
|
||||
{
|
||||
RetValue = 0;
|
||||
printf( "Miter failed in state %d after %d transitions. ",
|
||||
|
|
@ -549,6 +576,19 @@ int Gia_ManCollectReachable( Gia_Man_t * pAig, int nStatesMax, int fMiter, int f
|
|||
}
|
||||
printf( "Reachability analysis traversed %d states with depth %d. ", p->iCurState-1, Gia_ManCountDepth(p) );
|
||||
ABC_PRT( "Time", clock() - clk );
|
||||
if ( fDumpFile )
|
||||
{
|
||||
char * pFileName = "test.stg";
|
||||
FILE * pFile = fopen( pFileName, "wb" );
|
||||
if ( pFile == NULL )
|
||||
printf( "Cannot open file \"%s\" for writing.\n", pFileName );
|
||||
else
|
||||
{
|
||||
Gia_ManStgPrint( pFile, p->vStgDump, Gia_ManPiNum(pAig), Gia_ManPoNum(pAig), p->iCurState-1 );
|
||||
fclose( pFile );
|
||||
printf( "Extracted STG was written into file \"%s\".\n", pFileName );
|
||||
}
|
||||
}
|
||||
Gia_ManEraFree( p );
|
||||
return RetValue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,247 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [gia.c]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Scalable AIG package.]
|
||||
|
||||
Synopsis []
|
||||
|
||||
Author [Alan Mishchenko]
|
||||
|
||||
Affiliation [UC Berkeley]
|
||||
|
||||
Date [Ver. 1.0. Started - June 20, 2005.]
|
||||
|
||||
Revision [$Id: gia.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include "gia.h"
|
||||
#include "misc/extra/extra.h"
|
||||
|
||||
ABC_NAMESPACE_IMPL_START
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Gia_Man_t * Gia_ManStgOneHot( Vec_Int_t * vLines, int nIns, int nOuts, int nStates )
|
||||
{
|
||||
Gia_Man_t * p;
|
||||
Vec_Int_t * vInMints, * vCurs, * vOuts, * vNexts;
|
||||
int i, b, LitC, Lit;
|
||||
assert( Vec_IntSize(vLines) % 4 == 0 );
|
||||
|
||||
// start manager
|
||||
p = Gia_ManStart( 10000 );
|
||||
p->pName = Abc_UtilStrsav( "stg" );
|
||||
for ( i = 0; i < nIns + nStates; i++ )
|
||||
Gia_ManAppendCi(p);
|
||||
|
||||
// create input minterms
|
||||
Gia_ManHashAlloc( p );
|
||||
vInMints = Vec_IntAlloc( 1 << nIns );
|
||||
for ( i = 0; i < (1 << nIns); i++ )
|
||||
{
|
||||
for ( Lit = 1, b = 0; b < nIns; b++ )
|
||||
Lit = Gia_ManHashAnd( p, Lit, Abc_Var2Lit( b+1, !((i >> b) & 1) ) );
|
||||
Vec_IntPush( vInMints, Lit );
|
||||
}
|
||||
|
||||
// create current states
|
||||
vCurs = Vec_IntAlloc( nStates );
|
||||
for ( i = 0; i < nStates; i++ )
|
||||
Vec_IntPush( vCurs, Abc_Var2Lit( 1+nIns+i, !i ) );
|
||||
|
||||
// start outputs and current states
|
||||
vOuts = Vec_IntStart( nOuts );
|
||||
vNexts = Vec_IntStart( nStates );
|
||||
|
||||
// go through the lines
|
||||
for ( i = 0; i < Vec_IntSize(vLines); )
|
||||
{
|
||||
int iMint = Vec_IntEntry(vLines, i++);
|
||||
int iCur = Vec_IntEntry(vLines, i++) - 1;
|
||||
int iNext = Vec_IntEntry(vLines, i++) - 1;
|
||||
int iOut = Vec_IntEntry(vLines, i++);
|
||||
assert( iMint >= 0 && iMint < (1<<nIns) );
|
||||
assert( iCur >= 0 && iCur < nStates );
|
||||
assert( iNext >= 0 && iNext < nStates );
|
||||
assert( iOut >= 0 && iOut < (1<<nOuts) );
|
||||
// create condition
|
||||
LitC = Gia_ManHashAnd( p, Vec_IntEntry(vInMints, iMint), Vec_IntEntry(vCurs, iCur) );
|
||||
// update next state
|
||||
Lit = Gia_ManHashOr( p, LitC, Vec_IntEntry(vNexts, iNext) );
|
||||
Vec_IntWriteEntry( vNexts, iNext, Lit );
|
||||
// update outputs
|
||||
for ( b = 0; b < nOuts; b++ )
|
||||
if ( (iOut >> b) & 1 )
|
||||
{
|
||||
Lit = Gia_ManHashOr( p, LitC, Vec_IntEntry(vOuts, b) );
|
||||
Vec_IntWriteEntry( vOuts, b, Lit );
|
||||
}
|
||||
}
|
||||
|
||||
// create POs
|
||||
Vec_IntForEachEntry( vOuts, Lit, i )
|
||||
Gia_ManAppendCo( p, Lit );
|
||||
|
||||
// create next states
|
||||
Vec_IntForEachEntry( vNexts, Lit, i )
|
||||
Gia_ManAppendCo( p, Abc_LitNotCond(Lit, !i) );
|
||||
|
||||
Gia_ManSetRegNum( p, nStates );
|
||||
Gia_ManHashStop( p );
|
||||
|
||||
Vec_IntFree( vInMints );
|
||||
Vec_IntFree( vCurs );
|
||||
Vec_IntFree( vOuts );
|
||||
Vec_IntFree( vNexts );
|
||||
|
||||
assert( !Gia_ManHasDangling(p) );
|
||||
return p;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Gia_ManStgPrint( FILE * pFile, Vec_Int_t * vLines, int nIns, int nOuts, int nStates )
|
||||
{
|
||||
int i, nDigits = Abc_Base10Log( nStates );
|
||||
assert( Vec_IntSize(vLines) % 4 == 0 );
|
||||
for ( i = 0; i < Vec_IntSize(vLines); i += 4 )
|
||||
{
|
||||
int iMint = Vec_IntEntry(vLines, i );
|
||||
int iCur = Vec_IntEntry(vLines, i+1) - 1;
|
||||
int iNext = Vec_IntEntry(vLines, i+2) - 1;
|
||||
int iOut = Vec_IntEntry(vLines, i+3);
|
||||
assert( iMint >= 0 && iMint < (1<<nIns) );
|
||||
assert( iCur >= 0 && iCur < nStates );
|
||||
assert( iNext >= 0 && iNext < nStates );
|
||||
assert( iOut >= 0 && iOut < (1<<nOuts) );
|
||||
Extra_PrintBinary( pFile, (unsigned *)Vec_IntEntryP(vLines, i), nIns );
|
||||
fprintf( pFile, " %*d", nDigits, Vec_IntEntry(vLines, i+1) );
|
||||
fprintf( pFile, " %*d ", nDigits, Vec_IntEntry(vLines, i+2) );
|
||||
Extra_PrintBinary( pFile, (unsigned *)Vec_IntEntryP(vLines, i+3), nOuts );
|
||||
fprintf( pFile, "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Vec_Int_t * Gia_ManStgReadLines( char * pFileName, int * pnIns, int * pnOuts, int * pnStates )
|
||||
{
|
||||
Vec_Int_t * vLines;
|
||||
char pBuffer[1000];
|
||||
char * pToken;
|
||||
int Number, nInputs = -1, nOutputs = -1, nStates = 1;
|
||||
FILE * pFile;
|
||||
pFile = fopen( pFileName, "rb" );
|
||||
if ( pFile == NULL )
|
||||
{
|
||||
printf( "Cannot open file \"%s\".\n", pFileName );
|
||||
return NULL;
|
||||
}
|
||||
vLines = Vec_IntAlloc( 1000 );
|
||||
while ( fgets( pBuffer, 1000, pFile ) != NULL )
|
||||
{
|
||||
// read condition
|
||||
pToken = strtok( pBuffer, " \n" );
|
||||
if ( nInputs == -1 )
|
||||
nInputs = strlen(pToken);
|
||||
else
|
||||
assert( nInputs == (int)strlen(pToken) );
|
||||
Number = Extra_ReadBinary( pToken );
|
||||
Vec_IntPush( vLines, Number );
|
||||
// read current state
|
||||
pToken = strtok( NULL, " \n" );
|
||||
Vec_IntPush( vLines, atoi(pToken) );
|
||||
nStates = Abc_MaxInt( nStates, Vec_IntEntryLast(vLines) );
|
||||
// read next state
|
||||
pToken = strtok( NULL, " \n" );
|
||||
Vec_IntPush( vLines, atoi(pToken) );
|
||||
// read output
|
||||
pToken = strtok( NULL, " \n" );
|
||||
if ( nOutputs == -1 )
|
||||
nOutputs = strlen(pToken);
|
||||
else
|
||||
assert( nOutputs == (int)strlen(pToken) );
|
||||
Number = Extra_ReadBinary( pToken );
|
||||
Vec_IntPush( vLines, Number );
|
||||
}
|
||||
fclose( pFile );
|
||||
if ( pnIns )
|
||||
*pnIns = nInputs;
|
||||
if ( pnOuts )
|
||||
*pnOuts = nOutputs;
|
||||
if ( pnStates )
|
||||
*pnStates = nStates;
|
||||
return vLines;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Gia_Man_t * Gia_ManStgRead( char * pFileName, int fOneHot, int fLogar )
|
||||
{
|
||||
Gia_Man_t * p;
|
||||
Vec_Int_t * vLines;
|
||||
int nIns, nOuts, nStates;
|
||||
vLines = Gia_ManStgReadLines( pFileName, &nIns, &nOuts, &nStates );
|
||||
if ( vLines == NULL )
|
||||
return NULL;
|
||||
p = Gia_ManStgOneHot( vLines, nIns, nOuts, nStates );
|
||||
Vec_IntFree( vLines );
|
||||
return p;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
ABC_NAMESPACE_IMPL_END
|
||||
|
||||
|
|
@ -35,6 +35,7 @@ SRC += src/aig/gia/gia.c \
|
|||
src/aig/gia/giaSim2.c \
|
||||
src/aig/gia/giaSort.c \
|
||||
src/aig/gia/giaSpeedup.c \
|
||||
src/aig/gia/giaStg.c \
|
||||
src/aig/gia/giaSupMin.c \
|
||||
src/aig/gia/giaSweep.c \
|
||||
src/aig/gia/giaSwitch.c \
|
||||
|
|
|
|||
|
|
@ -311,6 +311,7 @@ static int Abc_CommandAbc9Put ( Abc_Frame_t * pAbc, int argc, cha
|
|||
static int Abc_CommandAbc9Read ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9ReadBlif ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9ReadCBlif ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9ReadStg ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9Write ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9Ps ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9PFan ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
|
|
@ -773,6 +774,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
|
|||
Cmd_CommandAdd( pAbc, "ABC9", "&r", Abc_CommandAbc9Read, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&read_blif", Abc_CommandAbc9ReadBlif, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&read_cblif", Abc_CommandAbc9ReadCBlif, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&read_stg", Abc_CommandAbc9ReadStg, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&w", Abc_CommandAbc9Write, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&ps", Abc_CommandAbc9Ps, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&pfan", Abc_CommandAbc9PFan, 0 );
|
||||
|
|
@ -23682,6 +23684,66 @@ usage:
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_CommandAbc9ReadStg( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
{
|
||||
Gia_Man_t * pAig;
|
||||
FILE * pFile;
|
||||
char * FileName, ** pArgvNew;
|
||||
int c, nArgcNew;
|
||||
int fVerbose = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
case 'v':
|
||||
fVerbose ^= 1;
|
||||
break;
|
||||
default:
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
pArgvNew = argv + globalUtilOptind;
|
||||
nArgcNew = argc - globalUtilOptind;
|
||||
if ( nArgcNew != 1 )
|
||||
{
|
||||
Abc_Print( -1, "There is no file name.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
// get the input file name
|
||||
FileName = pArgvNew[0];
|
||||
if ( (pFile = fopen( FileName, "r" )) == NULL )
|
||||
{
|
||||
Abc_Print( -1, "Cannot open input file \"%s\". ", FileName );
|
||||
return 1;
|
||||
}
|
||||
fclose( pFile );
|
||||
|
||||
pAig = Gia_ManStgRead( FileName, 1, 0 );
|
||||
Abc_CommandUpdate9( pAbc, pAig );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
Abc_Print( -2, "usage: &read_stg [-vh] <file>\n" );
|
||||
Abc_Print( -2, "\t reads STG file and generates encoded AIG\n" );
|
||||
Abc_Print( -2, "\t-v : toggles additional verbose output [default = %s]\n", fVerbose? "yes": "no" );
|
||||
Abc_Print( -2, "\t-h : print the command usage\n");
|
||||
Abc_Print( -2, "\t<file> : the file name\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
|
@ -28158,13 +28220,14 @@ int Abc_CommandAbc9Era( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// Gia_Man_t * pTemp = NULL;
|
||||
int c, fVerbose = 0;
|
||||
int fUseCubes = 1;
|
||||
int fDumpFile = 0;
|
||||
int fMiter = 0;
|
||||
int nStatesMax = 1000000000;
|
||||
extern int Gia_ManCollectReachable( Gia_Man_t * pAig, int nStatesMax, int fMiter, int fVerbose );
|
||||
extern int Gia_ManCollectReachable( Gia_Man_t * pAig, int nStatesMax, int fMiter, int fDumpFile, int fVerbose );
|
||||
extern int Gia_ManArePerform( Gia_Man_t * pAig, int nStatesMax, int fMiter, int fVerbose );
|
||||
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "Smcvh" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "Smcdvh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
|
|
@ -28185,6 +28248,9 @@ int Abc_CommandAbc9Era( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
case 'c':
|
||||
fUseCubes ^= 1;
|
||||
break;
|
||||
case 'd':
|
||||
fDumpFile ^= 1;
|
||||
break;
|
||||
case 'v':
|
||||
fVerbose ^= 1;
|
||||
break;
|
||||
|
|
@ -28209,20 +28275,20 @@ int Abc_CommandAbc9Era( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
Abc_Print( -1, "Abc_CommandAbc9Era(): The number of PIs (%d) should be no more than 12 when cubes are not used.\n", Gia_ManPiNum(pAbc->pGia) );
|
||||
return 1;
|
||||
}
|
||||
if ( fUseCubes )
|
||||
if ( fUseCubes && !fDumpFile )
|
||||
pAbc->Status = Gia_ManArePerform( pAbc->pGia, nStatesMax, fMiter, fVerbose );
|
||||
else
|
||||
pAbc->Status = Gia_ManCollectReachable( pAbc->pGia, nStatesMax, fMiter, fVerbose );
|
||||
pAbc->Status = Gia_ManCollectReachable( pAbc->pGia, nStatesMax, fMiter, fDumpFile, fVerbose );
|
||||
Abc_FrameReplaceCex( pAbc, &pAbc->pGia->pCexSeq );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
Abc_Print( -2, "usage: &era [-S num] [-mcvh]\n" );
|
||||
// Abc_Print( -2, "usage: &era [-S num] [-mvh]\n" );
|
||||
Abc_Print( -2, "usage: &era [-S num] [-mcdvh]\n" );
|
||||
Abc_Print( -2, "\t explicit reachability analysis for small sequential AIGs\n" );
|
||||
Abc_Print( -2, "\t-S num : the max number of states (num > 0) [default = %d]\n", nStatesMax );
|
||||
Abc_Print( -2, "\t-m : stop when the miter output is 1 [default = %s]\n", fMiter? "yes": "no" );
|
||||
Abc_Print( -2, "\t-c : use state cubes instead of state minterms [default = %s]\n", fUseCubes? "yes": "no" );
|
||||
Abc_Print( -2, "\t-d : toggle dumping STG into a file [default = %s]\n", fDumpFile? "yes": "no" );
|
||||
Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" );
|
||||
Abc_Print( -2, "\t-h : print the command usage\n");
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ extern Tim_Man_t * Tim_ManLoad( Vec_Str_t * p, int fHieOnly );
|
|||
/*=== timMan.c ===========================================================*/
|
||||
extern Tim_Man_t * Tim_ManStart( int nCis, int nCos );
|
||||
extern Tim_Man_t * Tim_ManDup( Tim_Man_t * p, int fUnitDelay );
|
||||
extern Tim_Man_t * Tim_ManTrim( Tim_Man_t * p, Vec_Int_t * vBoxPres );
|
||||
extern void Tim_ManCreate( Tim_Man_t * p, void * pLib, Vec_Flt_t * vInArrs, Vec_Flt_t * vOutReqs );
|
||||
extern int Tim_ManGetArrsReqs( Tim_Man_t * p, Vec_Flt_t ** pvInArrs, Vec_Flt_t ** pvOutReqs );
|
||||
extern void Tim_ManStop( Tim_Man_t * p );
|
||||
|
|
|
|||
Loading…
Reference in New Issue