mibuild/sim/verilator: remove verilator_root, use -Wno-fatal and add verbose option (verbose disabled by default)
This commit is contained in:
parent
7d68ecbd86
commit
29c5bb8bcd
|
@ -49,7 +49,7 @@ def _build_tb(platform, template):
|
|||
f.close()
|
||||
tools.write_to_file("dut_tb.cpp", content)
|
||||
|
||||
def _build_sim(platform, build_name, include_paths, verilator_root_path, template_file, trace):
|
||||
def _build_sim(platform, build_name, include_paths, template_file, trace, verbose):
|
||||
include = ""
|
||||
for path in include_paths:
|
||||
include += "-I"+path+" "
|
||||
|
@ -57,17 +57,20 @@ def _build_sim(platform, build_name, include_paths, verilator_root_path, templat
|
|||
build_script_contents = """# Autogenerated by mibuild
|
||||
rm -rf obj_dir/
|
||||
verilator {disable_warnings} -O3 --cc dut.v --exe dut_tb.cpp {trace} {include}
|
||||
make -j -C obj_dir/ -f Vdut.mk Vdut VERILATOR_ROOT={verilator_root}
|
||||
make -j -C obj_dir/ -f Vdut.mk Vdut
|
||||
|
||||
""".format(verilator_root= os.path.join("../../", verilator_root_path), # XXX
|
||||
disable_warnings="-Wno-lint -Wno-INITIALDLY",
|
||||
""".format(
|
||||
disable_warnings="-Wno-fatal",
|
||||
trace="-trace" if trace else "",
|
||||
include=include)
|
||||
build_script_file = "build_" + build_name + ".sh"
|
||||
tools.write_to_file(build_script_file, build_script_contents, force_unix=True)
|
||||
|
||||
_build_tb(platform, os.path.join("../", template_file)) # XXX
|
||||
r = subprocess.call(["bash", build_script_file])
|
||||
if verbose:
|
||||
r = subprocess.call(["bash", build_script_file])
|
||||
else:
|
||||
r = subprocess.call(["bash", build_script_file], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
|
||||
if r != 0:
|
||||
raise OSError("Subprocess failed")
|
||||
|
||||
|
@ -81,10 +84,10 @@ def _run_sim(build_name):
|
|||
raise OSError("Subprocess failed")
|
||||
|
||||
class VerilatorPlatform(GenericPlatform):
|
||||
# XXX fix template / verilator_path
|
||||
# XXX fix template_file
|
||||
def build(self, soc, build_dir="build", build_name="top", run=True, trace=True,
|
||||
template_file="../migen/mibuild/sim/dut_tb.cpp",
|
||||
verilator_root_path="../verilator"):
|
||||
verbose=False):
|
||||
tools.mkdir_noerror(build_dir)
|
||||
os.chdir(build_dir)
|
||||
|
||||
|
@ -103,7 +106,7 @@ class VerilatorPlatform(GenericPlatform):
|
|||
if path not in include_paths:
|
||||
include_paths.append(path)
|
||||
include_paths += self.verilog_include_paths
|
||||
_build_sim(self, build_name, include_paths, verilator_root_path, template_file, trace)
|
||||
_build_sim(self, build_name, include_paths, template_file, trace, verbose)
|
||||
|
||||
if run:
|
||||
_run_sim(build_name)
|
||||
|
|
Loading…
Reference in New Issue