Commit fb5d4a66 by Alan Mishchenko

Adding switch '-b' in 'read_pla'.

parent 120a30c2
...@@ -25897,7 +25897,7 @@ int Abc_CommandAbc9Get( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -25897,7 +25897,7 @@ int Abc_CommandAbc9Get( Abc_Frame_t * pAbc, int argc, char ** argv )
Vec_FltFreeP( &pGia->vInArrs ); Vec_FltFreeP( &pGia->vInArrs );
Vec_FltFreeP( &pGia->vOutReqs ); Vec_FltFreeP( &pGia->vOutReqs );
pGia->vInArrs = Vec_FltAllocArray( Abc_NtkGetCiArrivalFloats(pNtk), Abc_NtkCiNum(pNtk) ); pGia->vInArrs = Vec_FltAllocArray( Abc_NtkGetCiArrivalFloats(pNtk), Abc_NtkCiNum(pNtk) );
pGia->vOutReqs = Vec_FltAllocArray( Abc_NtkGetCiArrivalFloats(pNtk), Abc_NtkCoNum(pNtk) ); pGia->vOutReqs = Vec_FltAllocArray( Abc_NtkGetCoRequiredFloats(pNtk), Abc_NtkCoNum(pNtk) );
} }
Abc_FrameUpdateGia( pAbc, pGia ); Abc_FrameUpdateGia( pAbc, pGia );
return 0; return 0;
...@@ -903,20 +903,19 @@ int IoCommandReadPla( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -903,20 +903,19 @@ int IoCommandReadPla( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
Abc_Ntk_t * pNtk; Abc_Ntk_t * pNtk;
char * pFileName; char * pFileName;
int fCheck; int c, fZeros = 0, fBoth = 0, fCheck = 1;
int fZeros;
int c;
fZeros = 0;
fCheck = 1;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "zch" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "zbch" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
case 'z': case 'z':
fZeros ^= 1; fZeros ^= 1;
break; break;
case 'b':
fBoth ^= 1;
break;
case 'c': case 'c':
fCheck ^= 1; fCheck ^= 1;
break; break;
...@@ -931,10 +930,10 @@ int IoCommandReadPla( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -931,10 +930,10 @@ int IoCommandReadPla( Abc_Frame_t * pAbc, int argc, char ** argv )
// get the input file name // get the input file name
pFileName = argv[globalUtilOptind]; pFileName = argv[globalUtilOptind];
// read the file using the corresponding file reader // read the file using the corresponding file reader
if ( fZeros ) if ( fZeros || fBoth )
{ {
Abc_Ntk_t * pTemp; Abc_Ntk_t * pTemp;
pNtk = Io_ReadPla( pFileName, fZeros, fCheck ); pNtk = Io_ReadPla( pFileName, fZeros, fBoth, fCheck );
if ( pNtk == NULL ) if ( pNtk == NULL )
{ {
printf( "Reading PLA file has failed.\n" ); printf( "Reading PLA file has failed.\n" );
...@@ -953,9 +952,10 @@ int IoCommandReadPla( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -953,9 +952,10 @@ int IoCommandReadPla( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
fprintf( pAbc->Err, "usage: read_pla [-zch] <file>\n" ); fprintf( pAbc->Err, "usage: read_pla [-zbch] <file>\n" );
fprintf( pAbc->Err, "\t reads the network in PLA\n" ); fprintf( pAbc->Err, "\t reads the network in PLA\n" );
fprintf( pAbc->Err, "\t-z : toggle reading on-set and off-set [default = %s]\n", fZeros? "off-set":"on-set" ); fprintf( pAbc->Err, "\t-z : toggle reading on-set and off-set [default = %s]\n", fZeros? "off-set":"on-set" );
fprintf( pAbc->Err, "\t-b : toggle reading both on-set and off-set as on-set [default = %s]\n", fBoth? "off-set":"on-set" );
fprintf( pAbc->Err, "\t-c : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" ); fprintf( pAbc->Err, "\t-c : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
fprintf( pAbc->Err, "\t-h : prints the command summary\n" ); fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
fprintf( pAbc->Err, "\tfile : the name of a file to read\n" ); fprintf( pAbc->Err, "\tfile : the name of a file to read\n" );
......
...@@ -93,7 +93,7 @@ extern Abc_Ntk_t * Io_ReadEdif( char * pFileName, int fCheck ); ...@@ -93,7 +93,7 @@ extern Abc_Ntk_t * Io_ReadEdif( char * pFileName, int fCheck );
/*=== abcReadEqn.c ============================================================*/ /*=== abcReadEqn.c ============================================================*/
extern Abc_Ntk_t * Io_ReadEqn( char * pFileName, int fCheck ); extern Abc_Ntk_t * Io_ReadEqn( char * pFileName, int fCheck );
/*=== abcReadPla.c ============================================================*/ /*=== abcReadPla.c ============================================================*/
extern Abc_Ntk_t * Io_ReadPla( char * pFileName, int fZeros, int fCheck ); extern Abc_Ntk_t * Io_ReadPla( char * pFileName, int fZeros, int fBoth, int fCheck );
/*=== abcReadVerilog.c ========================================================*/ /*=== abcReadVerilog.c ========================================================*/
extern Abc_Ntk_t * Io_ReadVerilog( char * pFileName, int fCheck ); extern Abc_Ntk_t * Io_ReadVerilog( char * pFileName, int fCheck );
/*=== abcWriteAiger.c =========================================================*/ /*=== abcWriteAiger.c =========================================================*/
......
...@@ -28,7 +28,7 @@ ABC_NAMESPACE_IMPL_START ...@@ -28,7 +28,7 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS /// /// DECLARATIONS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
static Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros ); static Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros, int fBoth );
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS /// /// FUNCTION DEFINITIONS ///
...@@ -326,7 +326,7 @@ void Io_ReadPlaCubePreprocess( Vec_Str_t * vSop, int iCover, int fVerbose ) ...@@ -326,7 +326,7 @@ void Io_ReadPlaCubePreprocess( Vec_Str_t * vSop, int iCover, int fVerbose )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Abc_Ntk_t * Io_ReadPla( char * pFileName, int fZeros, int fCheck ) Abc_Ntk_t * Io_ReadPla( char * pFileName, int fZeros, int fBoth, int fCheck )
{ {
Extra_FileReader_t * p; Extra_FileReader_t * p;
Abc_Ntk_t * pNtk; Abc_Ntk_t * pNtk;
...@@ -338,7 +338,7 @@ Abc_Ntk_t * Io_ReadPla( char * pFileName, int fZeros, int fCheck ) ...@@ -338,7 +338,7 @@ Abc_Ntk_t * Io_ReadPla( char * pFileName, int fZeros, int fCheck )
return NULL; return NULL;
// read the network // read the network
pNtk = Io_ReadPlaNetwork( p, fZeros ); pNtk = Io_ReadPlaNetwork( p, fZeros, fBoth );
Extra_FileReaderFree( p ); Extra_FileReaderFree( p );
if ( pNtk == NULL ) if ( pNtk == NULL )
return NULL; return NULL;
...@@ -363,7 +363,7 @@ Abc_Ntk_t * Io_ReadPla( char * pFileName, int fZeros, int fCheck ) ...@@ -363,7 +363,7 @@ Abc_Ntk_t * Io_ReadPla( char * pFileName, int fZeros, int fCheck )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros ) Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros, int fBoth )
{ {
ProgressBar * pProgress; ProgressBar * pProgress;
Vec_Ptr_t * vTokens; Vec_Ptr_t * vTokens;
...@@ -390,6 +390,10 @@ Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros ) ...@@ -390,6 +390,10 @@ Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros )
if ( strncmp( (char *)vTokens->pArray[0], ".e", 2 ) == 0 ) if ( strncmp( (char *)vTokens->pArray[0], ".e", 2 ) == 0 )
break; break;
// if it is type directive, ignore it for now
if ( strncmp( (char *)vTokens->pArray[0], ".type", 5 ) == 0 )
continue;
// if it is the model name, get the name // if it is the model name, get the name
if ( strcmp( (char *)vTokens->pArray[0], ".model" ) == 0 ) if ( strcmp( (char *)vTokens->pArray[0], ".model" ) == 0 )
{ {
...@@ -510,7 +514,18 @@ Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros ) ...@@ -510,7 +514,18 @@ Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros )
ABC_FREE( ppSops ); ABC_FREE( ppSops );
return NULL; return NULL;
} }
if ( fZeros ) if ( fBoth )
{
for ( i = 0; i < nOutputs; i++ )
{
if ( pCubeOut[i] == '0' || pCubeOut[i] == '1' )
{
Vec_StrPrintStr( ppSops[i], pCubeIn );
Vec_StrPrintStr( ppSops[i], " 1\n" );
}
}
}
else if ( fZeros )
{ {
for ( i = 0; i < nOutputs; i++ ) for ( i = 0; i < nOutputs; i++ )
{ {
......
...@@ -144,7 +144,7 @@ Abc_Ntk_t * Io_ReadNetlist( char * pFileName, Io_FileType_t FileType, int fCheck ...@@ -144,7 +144,7 @@ Abc_Ntk_t * Io_ReadNetlist( char * pFileName, Io_FileType_t FileType, int fCheck
else if ( FileType == IO_FILE_EQN ) else if ( FileType == IO_FILE_EQN )
pNtk = Io_ReadEqn( pFileName, fCheck ); pNtk = Io_ReadEqn( pFileName, fCheck );
else if ( FileType == IO_FILE_PLA ) else if ( FileType == IO_FILE_PLA )
pNtk = Io_ReadPla( pFileName, 0, fCheck ); pNtk = Io_ReadPla( pFileName, 0, 0, fCheck );
else if ( FileType == IO_FILE_VERILOG ) else if ( FileType == IO_FILE_VERILOG )
pNtk = Io_ReadVerilog( pFileName, fCheck ); pNtk = Io_ReadVerilog( pFileName, fCheck );
else else
......
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