@@ -446,7 +446,7 @@ def input_from_verilog(verilog, clock_name='clk', toplevel=None, leave_in_dir=No
446
446
447
447
Note: This function is essentially a wrapper for `input_from_blif()`, with the added convenience
448
448
of turning the Verilog into BLIF for import for you. This function passes a set of commands to
449
- Yosys as a script that is normally produces BLIF files that can be successuflly imported into
449
+ Yosys as a script that normally produces BLIF files that can be successuflly imported into
450
450
PyRTL via `input_from_blif()`. If the Yosys conversion fails here, we recommend you create your
451
451
own custom Yosys script to try and produce BLIF yourself. Then you can import BLIF directly via
452
452
`input_from_blif()`.
@@ -469,15 +469,6 @@ def input_from_verilog(verilog, clock_name='clk', toplevel=None, leave_in_dir=No
469
469
else :
470
470
raise PyrtlError ('input_from_verilog expecting either open file or string' )
471
471
472
- if toplevel is None :
473
- module_lines = [line
474
- for line in verilog_string .split ('\n ' )
475
- if ('module ' in line ) and ('endmodule' not in line )]
476
- if module_lines :
477
- toplevel = re .match (r'\s*module\s+([^;(]*)' , module_lines [0 ]).group (1 ).strip ()
478
- if toplevel is None :
479
- raise PyrtlError ('No module found in verilog file' )
480
-
481
472
block = working_block (block )
482
473
483
474
# Create a temporary Verilog file
@@ -493,15 +484,15 @@ def input_from_verilog(verilog, clock_name='clk', toplevel=None, leave_in_dir=No
493
484
yosys_arg_template = (
494
485
"-p "
495
486
"read_verilog %s; "
496
- "hierarchy -check -top %s; "
497
- "proc; opt; memory; opt; fsm; opt; "
498
- "techmap; opt; "
487
+ "synth %s; "
499
488
"setundef -zero -undriven; "
500
489
"opt; "
501
490
"write_blif %s; "
502
491
)
503
492
504
- yosys_arg = yosys_arg_template % (tmp_verilog_path , toplevel , tmp_blif_path )
493
+ yosys_arg = yosys_arg_template % (tmp_verilog_path ,
494
+ ('-top ' + toplevel ) if toplevel is not None else '-auto-top' ,
495
+ tmp_blif_path )
505
496
506
497
try :
507
498
os .close (temp_vd )
0 commit comments