Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/migen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 36f4b68dd8d3
Choose a base ref
...
head repository: m-labs/migen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a56fce045bf5
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Mar 2, 2015

  1. mibuild/sim/verilator: remove verilator_root, use -Wno-fatal and add …

    …verbose option (verbose disabled by default)
    enjoy-digital committed Mar 2, 2015
    Copy the full SHA
    29c5bb8 View commit details
  2. Copy the full SHA
    a56fce0 View commit details
Showing with 11 additions and 8 deletions.
  1. +11 −8 mibuild/sim/verilator.py
19 changes: 11 additions & 8 deletions mibuild/sim/verilator.py
Original file line number Diff line number Diff line change
@@ -49,25 +49,28 @@ def io_name(ressource, subsignal=None):
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+" "

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 @@ def build(self, soc, build_dir="build", build_name="top", run=True, trace=True,
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)