52#define MAX_LINE 1000000
56 char * pBuffer, * pFileName2 =
"_temp__.rtlil";
57 FILE * pFile = fopen( pFileName,
"rb" );
61 printf(
"Cannot open file \"%s\" for reading.\n", pFileName );
64 pFile2 = fopen( pFileName2,
"wb" );
68 printf(
"Cannot open file \"%s\" for writing.\n", pFileName2 );
72 while ( fgets( pBuffer,
MAX_LINE, pFile ) != NULL )
73 if ( !
strstr(pBuffer,
"attribute \\src") )
74 fputs( pBuffer, pFile2 );
82 char * pBuffer, * pFileName2 =
"_temp__.v";
83 FILE * pFile = fopen( pFileName,
"rb" );
87 printf(
"Cannot open file \"%s\" for reading.\n", pFileName );
90 pFile2 = fopen( pFileName2,
"wb" );
94 printf(
"Cannot open file \"%s\" for writing.\n", pFileName2 );
98 while ( fgets( pBuffer,
MAX_LINE, pFile ) != NULL )
99 if ( !
strstr(pBuffer,
"//") )
100 fputs( pBuffer, pFile2 );
108 char * pYosysName = NULL;
109 char * pYosysNameWin =
"yosys.exe";
110 char * pYosysNameUnix =
"yosys";
116 pYosysName = pYosysNameWin;
118 pYosysName = pYosysNameUnix;
128 if (
system( pCommand ) == -1 )
130 fprintf( stdout,
"Cannot execute \"%s\".\n", pCommand );
133 if ( (pFile = fopen(pFileTemp,
"r")) == NULL )
135 fprintf( stdout,
"Cannot open intermediate file \"%s\".\n", pFileTemp );
146 char * pFileTemp =
"_temp_.rtlil";
147 int fSVlog =
strstr(pFileName,
".sv") != NULL;
148 if (
strstr(pFileName,
".rtl") )
150 sprintf( Command,
"%s -qp \"read_verilog %s%s %s%s; hierarchy %s%s; %sproc; write_rtlil %s\"",
152 pDefines ?
"-D" :
"",
153 pDefines ? pDefines :
"",
154 fSVlog ?
"-sv " :
"",
156 pTopModule ?
"-top " :
"",
157 pTopModule ? pTopModule :
"",
158 fCollapse ?
"flatten; ":
"",
161 printf(
"%s\n", Command );
167 printf(
"Dumped the design into file \"%s\".\n", pFileTemp );
178 char * pFileTemp =
"_temp_.aig";
179 int fRtlil =
strstr(pFileName,
".rtl") != NULL;
180 int fSVlog =
strstr(pFileName,
".sv") != NULL;
181 sprintf( Command,
"%s -qp \"%s %s%s %s%s; hierarchy %s%s; flatten; proc; %saigmap; write_aiger %s\"",
183 fRtlil ?
"read_rtlil" :
"read_verilog",
184 pDefines ?
"-D" :
"",
185 pDefines ? pDefines :
"",
186 fSVlog ?
"-sv " :
"",
188 pTopModule ?
"-top " :
"-auto-top",
189 pTopModule ? pTopModule :
"",
190 fTechMap ? (fLibInDir ?
"techmap -map techmap.v; setundef -zero; " :
"techmap; setundef -zero; ") :
"", pFileTemp );
192 printf(
"%s\n", Command );
198 printf(
"Converting to AIG has failed.\n" );
202 pGia->
pName = pTopModule ? Abc_UtilStrsav(pTopModule) :
210 Gia_ObjFlipFaninC0( pObj );
218 char * pFileTemp =
"_temp_.blif";
219 int fSVlog =
strstr(pFileName,
".sv") != NULL;
220 sprintf( Command,
"%s -qp \"read_liberty -lib %s; read %s %s%s %s; hierarchy %s%s; flatten; proc; write_blif %s%s -impltf -gates %s\"",
223 fSVlog ?
"-sv " :
"-vlog95",
224 pDefines ?
"-D" :
"",
225 pDefines ? pDefines :
"",
227 pTopModule ?
"-top " :
"-auto-top",
228 pTopModule ? pTopModule :
"",
229 pTopModule ?
"-top " :
"",
230 pTopModule ? pTopModule :
"",
233 printf(
"%s\n", Command );
236 sprintf( Command,
"read_lib %s", pLibrary );
239 fprintf( stdout,
"Cannot execute ABC command \"%s\".\n", Command );
246 printf(
"Reading mapped BLIF from file \"%s\" has failed.\n", pFileTemp );
251 pNtk->
pName = Abc_UtilStrsav(pTopModule);
struct Abc_Ntk_t_ Abc_Ntk_t
#define ABC_ALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
ABC_DLL char * Abc_FrameReadFlag(char *pFlag)
ABC_DLL Abc_Frame_t * Abc_FrameReadGlobalFrame()
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
#define MAX_LINE
DECLARATIONS ///.
#define Gia_ManForEachPo(p, pObj, i)
Gia_Man_t * Gia_AigerRead(char *pFileName, int fGiaSimple, int fSkipStrash, int fCheck)
struct Gia_Obj_t_ Gia_Obj_t
struct Gia_Man_t_ Gia_Man_t
Abc_Ntk_t * Io_Read(char *pFileName, Io_FileType_t FileType, int fCheck, int fBarBufs)
Abc_Ntk_t * Wln_ReadMappedSystemVerilog(char *pFileName, char *pTopModule, char *pDefines, char *pLibrary, int fVerbose)
void Rtl_NtkCleanFile(char *pFileName)
char * Wln_GetYosysName()
int Wln_ConvertToRtl(char *pCommand, char *pFileTemp)
Gia_Man_t * Wln_BlastSystemVerilog(char *pFileName, char *pTopModule, char *pDefines, int fSkipStrash, int fInvert, int fTechMap, int fLibInDir, int fVerbose)
Rtl_Lib_t * Wln_ReadSystemVerilog(char *pFileName, char *pTopModule, char *pDefines, int fCollapse, int fVerbose)
void Rtl_NtkCleanFile2(char *pFileName)
struct Rtl_Lib_t_ Rtl_Lib_t
Rtl_Lib_t * Rtl_LibReadFile(char *pFileName, char *pFileSpec)