Commit 7bcd5ac9 by Alan Mishchenko

Changes to incorporate AIG parsing in memory and user-specified PI/PO/FF numbers.

parent 0aefe77e
......@@ -138,8 +138,9 @@ struct Gia_Man_t_
int nTravIdsAlloc; // the number of trav IDs allocated
Vec_Ptr_t * vNamesIn; // the input names
Vec_Ptr_t * vNamesOut; // the output names
Vec_Int_t * vCiNumsOrig; // original names of the CIs
Vec_Int_t * vCoNumsOrig; // original names of the COs
Vec_Int_t * vUserPiIds; // numbers assigned to PIs by the user
Vec_Int_t * vUserPoIds; // numbers assigned to POs by the user
Vec_Int_t * vUserFfIds; // numbers assigned to FFs by the user
Vec_Vec_t * vClockDoms; // clock domains
Vec_Flt_t * vTiming; // arrival/required/slack
void * pManTime; // the timing manager
......@@ -596,6 +597,7 @@ static inline int Gia_ObjLutFanin( Gia_Man_t * p, int Id, int i ) { re
/*=== giaAiger.c ===========================================================*/
extern int Gia_FileSize( char * pFileName );
extern Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fCheck );
extern Gia_Man_t * Gia_ReadAiger( char * pFileName, int fCheck );
extern void Gia_WriteAiger( Gia_Man_t * p, char * pFileName, int fWriteSymbols, int fCompact );
extern void Gia_DumpAiger( Gia_Man_t * p, char * pFilePrefix, int iFileNum, int nFileNumDigits );
......
......@@ -138,8 +138,8 @@ Gia_Man_t * Gia_ManCexAbstraction( Gia_Man_t * p, Vec_Int_t * vFlops )
pNew = Saig_ManDeriveAbstraction( pTemp = pNew, vFlops );
Aig_ManStop( pTemp );
pGia = Gia_ManFromAig( pNew );
pGia->vCiNumsOrig = pNew->vCiNumsOrig;
pNew->vCiNumsOrig = NULL;
// pGia->vCiNumsOrig = pNew->vCiNumsOrig;
// pNew->vCiNumsOrig = NULL;
Aig_ManStop( pNew );
return pGia;
......
......@@ -77,8 +77,9 @@ void Gia_ManStop( Gia_Man_t * p )
Vec_FltFreeP( &p->vTiming );
Vec_VecFreeP( &p->vClockDoms );
Vec_IntFreeP( &p->vLutConfigs );
Vec_IntFreeP( &p->vCiNumsOrig );
Vec_IntFreeP( &p->vCoNumsOrig );
Vec_IntFreeP( &p->vUserPiIds );
Vec_IntFreeP( &p->vUserPoIds );
Vec_IntFreeP( &p->vUserFfIds );
Vec_IntFreeP( &p->vFlopClasses );
Vec_IntFreeP( &p->vLevels );
Vec_IntFreeP( &p->vTruths );
......
......@@ -318,6 +318,69 @@ Vec_Int_t * Abc_ManExpandCex( Gia_Man_t * pGia, Vec_Int_t * vCex )
/**Function*************************************************************
Synopsis [Procedure to convert the AIG from text into binary form.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static unsigned textToBin(char* text, unsigned long text_sz)
{
char* dst = text;
const char* src = text;
unsigned sz, i;
sscanf(src, "%lu ", &sz);
while(*src++ != ' ');
for ( i = 0; i < sz; i += 3 )
{
dst[0] = (char)( (unsigned)src[0] - '0') | (((unsigned)src[1] - '0') << 6);
dst[1] = (char)(((unsigned)src[1] - '0') >> 2) | (((unsigned)src[2] - '0') << 4);
dst[2] = (char)(((unsigned)src[2] - '0') >> 4) | (((unsigned)src[3] - '0') << 2);
src += 4;
dst += 3;
}
return sz;
}
/**Function*************************************************************
Synopsis [Derives AIG from the text string in the file.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t * Abc_ManReadAig( char * pFileName, char * pToken )
{
Gia_Man_t * pGia = NULL;
unsigned nBinaryPart;
Vec_Str_t * vStr;
char * pStr;
vStr = Abc_ManReadFile( pFileName );
if ( vStr == NULL )
return NULL;
pStr = Vec_StrArray( vStr );
pStr = strstr( pStr, pToken );
if ( pStr != NULL )
{
pStr += strlen(pToken);
nBinaryPart = textToBin( pStr, strlen(pStr) );
pGia = Gia_ReadAigerFromMemory( pStr, nBinaryPart, 0 );
}
Vec_StrFree( vStr );
return pGia;
}
/**Function*************************************************************
Synopsis []
Description []
......@@ -349,9 +412,26 @@ int Cmd_CommandAbcPlugIn( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1;
}
*/
if ( pAbc->pGia == NULL )
{
Abc_Print( -1, "Current AIG does not exist (try command &ps).\n" );
if (argc == 2 && strcmp(argv[1], "-h") == 0)
{
// Run command to produce help string:
vCommand = Vec_StrAlloc( 100 );
pFileNameBinary = Abc_GetBinaryName( pAbc, argc, argv );
Vec_StrAppend( vCommand, pFileNameBinary );
Vec_StrAppend( vCommand, " -abc " );
Vec_StrAppend( vCommand, argv[0] );
Vec_StrAppend( vCommand, " -h" );
Vec_StrPush( vCommand, 0 );
Util_SignalSystem( Vec_StrArray(vCommand) );
Vec_StrFree( vCommand );
}
else
{
Abc_Print( -1, "Current AIG does not exist (try command &ps).\n" );
}
return 1;
}
......@@ -508,6 +588,8 @@ int Cmd_CommandAbcPlugIn( Abc_Frame_t * pAbc, int argc, char ** argv )
}
Vec_IntFreeP( &vCex );
}
// derive AIG if present
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment