Commit 99ddb640 by Alan Mishchenko

Adding support of reading and writing designs using a new internal format.

parent c8008383
...@@ -807,6 +807,10 @@ SOURCE=.\src\base\wlc\wlcJson.c ...@@ -807,6 +807,10 @@ SOURCE=.\src\base\wlc\wlcJson.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\base\wlc\wlcNdr.c
# End Source File
# Begin Source File
SOURCE=.\src\base\wlc\wlcNtk.c SOURCE=.\src\base\wlc\wlcNtk.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -379,7 +379,7 @@ static inline void Ndr_ModuleWriteVerilog( char * pFileName, void * pModule, cha ...@@ -379,7 +379,7 @@ static inline void Ndr_ModuleWriteVerilog( char * pFileName, void * pModule, cha
} }
fprintf( pFile, "\nendmodule\n\n" ); fprintf( pFile, "\nendmodule\n\n" );
fclose( pFile ); if ( pFileName ) fclose( pFile );
} }
...@@ -507,6 +507,7 @@ static inline void Ndr_ModuleTest() ...@@ -507,6 +507,7 @@ static inline void Ndr_ModuleTest()
// write Verilog for verification // write Verilog for verification
Ndr_ModuleWriteVerilog( NULL, pModule, ppNames ); Ndr_ModuleWriteVerilog( NULL, pModule, ppNames );
Ndr_ModuleWrite( "add4.ndr", pModule );
Ndr_ModuleDelete( pModule ); Ndr_ModuleDelete( pModule );
} }
......
...@@ -6,6 +6,7 @@ SRC += src/base/wlc/wlcAbs.c \ ...@@ -6,6 +6,7 @@ SRC += src/base/wlc/wlcAbs.c \
src/base/wlc/wlcCom.c \ src/base/wlc/wlcCom.c \
src/base/wlc/wlcGraft.c \ src/base/wlc/wlcGraft.c \
src/base/wlc/wlcJson.c \ src/base/wlc/wlcJson.c \
src/base/wlc/wlcNdr.c \
src/base/wlc/wlcNtk.c \ src/base/wlc/wlcNtk.c \
src/base/wlc/wlcReadSmt.c \ src/base/wlc/wlcReadSmt.c \
src/base/wlc/wlcReadVer.c \ src/base/wlc/wlcReadVer.c \
......
...@@ -328,6 +328,9 @@ extern int Wlc_NtkAbsCore2( Wlc_Ntk_t * p, Wlc_Par_t * pPars ); ...@@ -328,6 +328,9 @@ extern int Wlc_NtkAbsCore2( Wlc_Ntk_t * p, Wlc_Par_t * pPars );
extern Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int iOutput, int nRange, int fGiaSimple, int fAddOutputs, int fBooth, int fNoCleanup, int fCreateMiter, int fDecMuxes ); extern Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds, int iOutput, int nRange, int fGiaSimple, int fAddOutputs, int fBooth, int fNoCleanup, int fCreateMiter, int fDecMuxes );
/*=== wlcCom.c ========================================================*/ /*=== wlcCom.c ========================================================*/
extern void Wlc_SetNtk( Abc_Frame_t * pAbc, Wlc_Ntk_t * pNtk ); extern void Wlc_SetNtk( Abc_Frame_t * pAbc, Wlc_Ntk_t * pNtk );
/*=== wlcNdr.c ========================================================*/
extern Wlc_Ntk_t * Wlc_ReadNdr( char * pFileName );
extern void Wlc_WriteNdr( Wlc_Ntk_t * pNtk, char * pFileName );
/*=== wlcNtk.c ========================================================*/ /*=== wlcNtk.c ========================================================*/
extern void Wlc_ManSetDefaultParams( Wlc_Par_t * pPars ); extern void Wlc_ManSetDefaultParams( Wlc_Par_t * pPars );
extern char * Wlc_ObjTypeName( Wlc_Obj_t * p ); extern char * Wlc_ObjTypeName( Wlc_Obj_t * p );
......
...@@ -176,7 +176,7 @@ int Abc_CommandReadWlc( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -176,7 +176,7 @@ int Abc_CommandReadWlc( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( (pFile = fopen( pFileName, "r" )) == NULL ) if ( (pFile = fopen( pFileName, "r" )) == NULL )
{ {
Abc_Print( 1, "Cannot open input file \"%s\". ", pFileName ); Abc_Print( 1, "Cannot open input file \"%s\". ", pFileName );
if ( (pFileName = Extra_FileGetSimilarName( pFileName, ".v", ".smt", ".smt2", NULL, NULL )) ) if ( (pFileName = Extra_FileGetSimilarName( pFileName, ".v", ".smt", ".smt2", ".ndr", NULL )) )
Abc_Print( 1, "Did you mean \"%s\"?", pFileName ); Abc_Print( 1, "Did you mean \"%s\"?", pFileName );
Abc_Print( 1, "\n" ); Abc_Print( 1, "\n" );
return 0; return 0;
...@@ -188,6 +188,8 @@ int Abc_CommandReadWlc( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -188,6 +188,8 @@ int Abc_CommandReadWlc( Abc_Frame_t * pAbc, int argc, char ** argv )
pNtk = Wlc_ReadVer( pFileName, NULL ); pNtk = Wlc_ReadVer( pFileName, NULL );
else if ( !strcmp( Extra_FileNameExtension(pFileName), "smt" ) || !strcmp( Extra_FileNameExtension(pFileName), "smt2" ) ) else if ( !strcmp( Extra_FileNameExtension(pFileName), "smt" ) || !strcmp( Extra_FileNameExtension(pFileName), "smt2" ) )
pNtk = Wlc_ReadSmt( pFileName, fOldParser, fPrintTree ); pNtk = Wlc_ReadSmt( pFileName, fOldParser, fPrintTree );
else if ( !strcmp( Extra_FileNameExtension(pFileName), "ndr" ) )
pNtk = Wlc_ReadNdr( pFileName );
else else
{ {
printf( "Abc_CommandReadWlc(): Unknown file extension.\n" ); printf( "Abc_CommandReadWlc(): Unknown file extension.\n" );
...@@ -261,7 +263,9 @@ int Abc_CommandWriteWlc( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -261,7 +263,9 @@ int Abc_CommandWriteWlc( Abc_Frame_t * pAbc, int argc, char ** argv )
printf( "Output file name should be given on the command line.\n" ); printf( "Output file name should be given on the command line.\n" );
return 0; return 0;
} }
if ( fSplitNodes ) if ( !strcmp( Extra_FileNameExtension(pFileName), "ndr" ) )
Wlc_WriteNdr( pNtk, pFileName );
else if ( fSplitNodes )
{ {
pNtk = Wlc_NtkDupSingleNodes( pNtk ); pNtk = Wlc_NtkDupSingleNodes( pNtk );
Wlc_WriteVer( pNtk, pFileName, fAddCos, fNoFlops ); Wlc_WriteVer( pNtk, pFileName, fAddCos, fNoFlops );
...@@ -1205,8 +1209,9 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -1205,8 +1209,9 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
//Wlc_AbcUpdateNtk( pAbc, pNtk ); //Wlc_AbcUpdateNtk( pAbc, pNtk );
//Wlc_GenerateSmtStdout( pAbc ); //Wlc_GenerateSmtStdout( pAbc );
//Wlc_NtkSimulateTest( (Wlc_Ntk_t *)pAbc->pAbcWlc ); //Wlc_NtkSimulateTest( (Wlc_Ntk_t *)pAbc->pAbcWlc );
pNtk = Wlc_NtkDupSingleNodes( pNtk ); //pNtk = Wlc_NtkDupSingleNodes( pNtk );
Wlc_AbcUpdateNtk( pAbc, pNtk ); //Wlc_AbcUpdateNtk( pAbc, pNtk );
//Wlc_ReadNdrTest( pNtk );
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: %%test [-vh]\n" ); Abc_Print( -2, "usage: %%test [-vh]\n" );
......
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