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()
|
f.close()
|
||||||
tools.write_to_file("dut_tb.cpp", content)
|
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 = ""
|
include = ""
|
||||||
for path in include_paths:
|
for path in include_paths:
|
||||||
include += "-I"+path+" "
|
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
|
build_script_contents = """# Autogenerated by mibuild
|
||||||
rm -rf obj_dir/
|
rm -rf obj_dir/
|
||||||
verilator {disable_warnings} -O3 --cc dut.v --exe dut_tb.cpp {trace} {include}
|
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
|
""".format(
|
||||||
disable_warnings="-Wno-lint -Wno-INITIALDLY",
|
disable_warnings="-Wno-fatal",
|
||||||
trace="-trace" if trace else "",
|
trace="-trace" if trace else "",
|
||||||
include=include)
|
include=include)
|
||||||
build_script_file = "build_" + build_name + ".sh"
|
build_script_file = "build_" + build_name + ".sh"
|
||||||
tools.write_to_file(build_script_file, build_script_contents, force_unix=True)
|
tools.write_to_file(build_script_file, build_script_contents, force_unix=True)
|
||||||
|
|
||||||
_build_tb(platform, os.path.join("../", template_file)) # XXX
|
_build_tb(platform, os.path.join("../", template_file)) # XXX
|
||||||
|
if verbose:
|
||||||
r = subprocess.call(["bash", build_script_file])
|
r = subprocess.call(["bash", build_script_file])
|
||||||
|
else:
|
||||||
|
r = subprocess.call(["bash", build_script_file], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
|
||||||
if r != 0:
|
if r != 0:
|
||||||
raise OSError("Subprocess failed")
|
raise OSError("Subprocess failed")
|
||||||
|
|
||||||
|
@ -81,10 +84,10 @@ def _run_sim(build_name):
|
||||||
raise OSError("Subprocess failed")
|
raise OSError("Subprocess failed")
|
||||||
|
|
||||||
class VerilatorPlatform(GenericPlatform):
|
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,
|
def build(self, soc, build_dir="build", build_name="top", run=True, trace=True,
|
||||||
template_file="../migen/mibuild/sim/dut_tb.cpp",
|
template_file="../migen/mibuild/sim/dut_tb.cpp",
|
||||||
verilator_root_path="../verilator"):
|
verbose=False):
|
||||||
tools.mkdir_noerror(build_dir)
|
tools.mkdir_noerror(build_dir)
|
||||||
os.chdir(build_dir)
|
os.chdir(build_dir)
|
||||||
|
|
||||||
|
@ -103,7 +106,7 @@ class VerilatorPlatform(GenericPlatform):
|
||||||
if path not in include_paths:
|
if path not in include_paths:
|
||||||
include_paths.append(path)
|
include_paths.append(path)
|
||||||
include_paths += self.verilog_include_paths
|
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:
|
if run:
|
||||||
_run_sim(build_name)
|
_run_sim(build_name)
|
||||||
|
|
Loading…
Reference in New Issue