@@ -35189,7 +35189,7 @@ int Abc_CommandAbc9WriteVer( Abc_Frame_t * pAbc, int argc, char ** argv )
3518935189 return 1;
3519035190 }
3519135191 // Check if we should write LUT-based Verilog
35192- if ( fUseLuts || (Gia_ManHasMapping(pAbc->pGia) && !fUseGates) )
35192+ if ( fUseLuts )
3519335193 {
3519435194 if ( !Gia_ManHasMapping(pAbc->pGia) )
3519535195 {
@@ -35232,7 +35232,6 @@ int Abc_CommandAbc9WriteVer( Abc_Frame_t * pAbc, int argc, char ** argv )
3523235232 Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
3523335233 Abc_Print( -2, "\t-h : print the command usage\n");
3523435234 Abc_Print( -2, "\t<file> : the file name\n");
35235- Abc_Print( -2, "\tNote: When AIG is mapped and -l is not specified, LUT-based output is automatically used.\n");
3523635235 return 1;
3523735236}
3523835237
@@ -42601,7 +42600,7 @@ int Abc_CommandAbc9EquivFilter( Abc_Frame_t * pAbc, int argc, char ** argv )
4260142600 SeeAlso []
4260242601
4260342602***********************************************************************/
42604- static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pTopModule, int * pAbc_ReadAigerOrVerilogFileStatus )
42603+ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pTopModule, char * pDefines, int * pAbc_ReadAigerOrVerilogFileStatus )
4260542604{
4260642605 FILE * pFile;
4260742606 Gia_Man_t * pGia;
@@ -42637,7 +42636,8 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pTopModu
4263742636 // Save the original filename before changing it
4263842637 pOrigFileName = pFileName;
4263942638 snprintf( pCommand, sizeof(pCommand),
42640- "yosys -qp \"read_verilog %s%s; hierarchy %s%s; flatten; proc; opt; async2sync; opt; setundef -undriven -zero; techmap; memory -nomap; memory_map; dffunmap; opt_clean; opt_expr; aigmap; write_aiger -symbols _temp_.aig\"",
42639+ "yosys -qp \"read_verilog %s%s %s%s; hierarchy %s%s; flatten; proc; opt; async2sync; opt; setundef -undriven -zero; techmap; memory -nomap; memory_map; dffunmap; opt_clean; opt_expr; aigmap; write_aiger -symbols _temp_.aig\"",
42640+ pDefines ? "-D" : "", pDefines ? pDefines : "",
4264142641 fSystemVerilog ? "-sv " : "", pFileName, pTopModule ? "-top " : "-auto-top", pTopModule ? pTopModule : "" );
4264242642#if defined(__wasm)
4264342643 RetValue = 1;
@@ -42685,12 +42685,12 @@ int Abc_CommandAbc9Cec( Abc_Frame_t * pAbc, int argc, char ** argv )
4268542685 extern void Cec_ManPrintCexSummary( Gia_Man_t * p, Abc_Cex_t * pCex, Cec_ParCec_t * pPars );
4268642686 Cec_ParCec_t ParsCec, * pPars = &ParsCec;
4268742687 Gia_Man_t * pGias[2] = {NULL, NULL}, * pMiter;
42688- char ** pArgvNew, * pTopModule = NULL;
42688+ char ** pArgvNew, * pTopModule = NULL, * pDefines = NULL ;
4268942689 int c, nArgcNew, fUseSim = 0, fUseNewX = 0, fUseNewY = 0, fMiter = 0, fDualOutput = 0, fDumpMiter = 0, fSavedSpec = 0;
4269042690 int Abc_ReadAigerOrVerilogFileStatus = 0;
4269142691 Cec_ManCecSetDefaultParams( pPars );
4269242692 Extra_UtilGetoptReset();
42693- while ( ( c = Extra_UtilGetopt( argc, argv, "CTMnmdbasxytvwh " ) ) != EOF )
42693+ while ( ( c = Extra_UtilGetopt( argc, argv, "CTMDnmdbasxytvwh " ) ) != EOF )
4269442694 {
4269542695 switch ( c )
4269642696 {
@@ -42725,6 +42725,15 @@ int Abc_CommandAbc9Cec( Abc_Frame_t * pAbc, int argc, char ** argv )
4272542725 pTopModule = argv[globalUtilOptind];
4272642726 globalUtilOptind++;
4272742727 break;
42728+ case 'D':
42729+ if ( globalUtilOptind >= argc )
42730+ {
42731+ Abc_Print( -1, "Command line switch \"-D\" should be followed by defines.\n" );
42732+ goto usage;
42733+ }
42734+ pDefines = argv[globalUtilOptind];
42735+ globalUtilOptind++;
42736+ break;
4272842737 case 'n':
4272942738 pPars->fNaive ^= 1;
4273042739 break;
@@ -42846,7 +42855,7 @@ int Abc_CommandAbc9Cec( Abc_Frame_t * pAbc, int argc, char ** argv )
4284642855 int n;
4284742856 for ( n = 0; n < 2; n++ )
4284842857 {
42849- pGias[n] = Abc_ReadAigerOrVerilogFile( pFileNames[n], pTopModule, &Abc_ReadAigerOrVerilogFileStatus );
42858+ pGias[n] = Abc_ReadAigerOrVerilogFile( pFileNames[n], pTopModule, pDefines, &Abc_ReadAigerOrVerilogFileStatus );
4285042859 if ( pGias[n] == NULL )
4285142860 return Abc_ReadAigerOrVerilogFileStatus;
4285242861 }
@@ -42882,7 +42891,7 @@ int Abc_CommandAbc9Cec( Abc_Frame_t * pAbc, int argc, char ** argv )
4288242891 }
4288342892 FileName = pAbc->pGia->pSpec;
4288442893 }
42885- pGias[1] = Abc_ReadAigerOrVerilogFile( FileName, pTopModule, &Abc_ReadAigerOrVerilogFileStatus );
42894+ pGias[1] = Abc_ReadAigerOrVerilogFile( FileName, pTopModule, pDefines, &Abc_ReadAigerOrVerilogFileStatus );
4288642895 if ( pGias[1] == NULL )
4288742896 return Abc_ReadAigerOrVerilogFileStatus;
4288842897 }
@@ -42994,11 +43003,12 @@ int Abc_CommandAbc9Cec( Abc_Frame_t * pAbc, int argc, char ** argv )
4299443003 return 0;
4299543004
4299643005usage:
42997- Abc_Print( -2, "usage: &cec [-CT num] [-M str] [-nmdbasxytvwh]\n" );
43006+ Abc_Print( -2, "usage: &cec [-CT num] [-M str] [-D str] [- nmdbasxytvwh]\n" );
4299843007 Abc_Print( -2, "\t new combinational equivalence checker\n" );
4299943008 Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit );
4300043009 Abc_Print( -2, "\t-T num : approximate runtime limit in seconds [default = %d]\n", pPars->TimeLimit );
43001- Abc_Print( -2, "\t-M str : top module name if Verilog file(s) are used [default = %d]\n", pPars->TimeLimit );
43010+ Abc_Print( -2, "\t-M str : top module name if Verilog file(s) are used [default = \"not used\"]\n" );
43011+ Abc_Print( -2, "\t-D str : defines to be used by Yosys for Verilog files [default = \"not used\"]\n" );
4300243012 Abc_Print( -2, "\t-n : toggle using naive SAT-based checking [default = %s]\n", pPars->fNaive? "yes":"no");
4300343013 Abc_Print( -2, "\t-m : toggle miter vs. two circuits [default = %s]\n", fMiter? "miter":"two circuits");
4300443014 Abc_Print( -2, "\t-d : toggle using dual output miter [default = %s]\n", fDualOutput? "yes":"no");
0 commit comments