Skip to content

add top module and search path for parmys #2365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions vtr_flow/misc/yosys/synthesis.tcl
Original file line number Diff line number Diff line change
@@ -20,10 +20,10 @@ if {$env(PARSER) == "surelog" } {
puts "Using Yosys read_systemverilog command"
plugin -i systemverilog
yosys -import
read_systemverilog -debug XXX
read_systemverilog -I"SEARCHPATH" -debug XXX
} elseif {$env(PARSER) == "default" } {
puts "Using Yosys read_verilog command"
read_verilog -sv -nolatches XXX
read_verilog -I"SEARCHPATH" -sv -nolatches XXX
} else {
error "Invalid PARSER"
}
@@ -33,7 +33,7 @@ scc -select
select -assert-none %
select -clear

hierarchy -check -auto-top -purge_lib
hierarchy -check TOPMODULE -purge_lib

opt_expr
opt_clean
@@ -76,6 +76,6 @@ opt -fast -noff

tee -o /dev/stdout stat

hierarchy -check -auto-top -purge_lib
hierarchy -check TOPMODULE -purge_lib

write_blif -true + vcc -false + gnd -undef + unconn -blackbox ZZZ
23 changes: 23 additions & 0 deletions vtr_flow/scripts/python_libs/vtr/parmys/parmys.py
Original file line number Diff line number Diff line change
@@ -52,6 +52,8 @@ def init_script_file(
circuit_list,
output_netlist,
architecture_file_path,
include_dir='.',
top_module='-auto-top'
):
"""initializing the raw yosys script file"""
# specify the input files type
@@ -68,6 +70,8 @@ def init_script_file(
"TTT": str(vtr.paths.yosys_tcl_path),
"ZZZ": output_netlist,
"QQQ": architecture_file_path,
"SEARCHPATH": include_dir,
"TOPMODULE": top_module,
},
)

@@ -205,11 +209,30 @@ def run(
# Create a list showing all (.v) and (.vh) files
circuit_list = create_circuits_list(circuit_file, include_files)

# parse search directory
if ('searchpath' in parmys_args):
if (parmys_args['searchpath'] is not None) and (parmys_args['searchpath'] != ''):
include_dir = parmys_args['searchpath']
del parmys_args['searchpath']
else:
include_dir = '.'

# parse top module
# NOTE: the default value is '-auto-top'
if ('topmodule' in parmys_args):
if (parmys_args['topmodule'] is not None) and (parmys_args['topmodule'] != ''):
top_module = '-top ' + parmys_args['topmodule']
del parmys_args['topmodule']
else:
top_module = '-auto-top'

init_script_file(
yosys_script_full_path,
circuit_list,
output_netlist.name,
architecture_file_path,
include_dir,
top_module
)

odin_base_config = str(vtr.paths.odin_cfg_path)
19 changes: 16 additions & 3 deletions vtr_flow/scripts/run_vtr_flow.py
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
import socket
from datetime import datetime
from collections import OrderedDict

import os
# pylint: disable=wrong-import-position, import-error
sys.path.insert(0, str(Path(__file__).resolve().parent / "python_libs"))
import vtr
@@ -186,7 +186,7 @@ def vtr_command_argparser(prog=None):

house_keeping.add_argument(
"-temp_dir",
default=None,
default=os.getcwd() + "/temp",
help="Directory to run the flow in (will be created if non-existant).",
)

@@ -369,6 +369,18 @@ def vtr_command_argparser(prog=None):
+ "system-verilog]. The script used the Yosys conventional Verilog"
+ " parser if this argument is not specified.",
)
parmys.add_argument(
"-top",
default=None,
dest="topmodule",
help="Specify the name of the module in the design that should be considered as top",
)
parmys.add_argument(
'-search',
default=os.getcwd(),
dest='searchpath',
help='search path for verilog files'
)
#
# VPR arguments
#
@@ -725,7 +737,8 @@ def process_parmys_args(args):
"""
parmys_args = OrderedDict()
parmys_args["parser"] = args.parser

parmys_args["topmodule"] = args.topmodule
parmys_args['searchpath'] = args.searchpath
return parmys_args