targets/sim: generate analyzer.csv

This commit is contained in:
Florent Kermarrec 2018-09-20 12:20:48 +02:00
parent cde72603a1
commit 15e584d880
2 changed files with 31 additions and 22 deletions

View File

@ -174,6 +174,7 @@ def main():
sim_config.add_module("ethernet", "eth", args={"interface": "tap0", "ip": "192.168.1.100"})
if args.with_etherbone:
sim_config.add_module('ethernet', "eth", args={"interface": "tap1", "ip": "192.168.1.101"})
soc = SimSoC(
with_sdram=args.with_sdram,
with_ethernet=args.with_ethernet,
@ -182,7 +183,10 @@ def main():
**soc_kwargs)
builder_kwargs["csr_csv"] = "csr.csv"
builder = Builder(soc, **builder_kwargs)
builder.build(sim_config=sim_config)
vns = builder.build(run=False, sim_config=sim_config)
if args.with_analyzer:
soc.analyzer.export_csv(vns, "analyzer.csv")
builder.build(build=False, sim_config=sim_config)
if __name__ == "__main__":

View File

@ -145,16 +145,19 @@ def _run_sim(build_name, as_root=False):
class SimVerilatorToolchain:
def build(self, platform, fragment, build_dir="build", build_name="dut",
toolchain_path=None, serial="console", run=True, verbose=True,
toolchain_path=None, serial="console", build=True, run=True, verbose=True,
sim_config=None):
os.makedirs(build_dir, exist_ok=True)
os.chdir(build_dir)
if build:
if not isinstance(fragment, _Fragment):
fragment = fragment.get_fragment()
platform.finalize(fragment)
v_output = platform.get_verilog(fragment, name=build_name)
v_output = platform.get_verilog(fragment,
name=build_name, dummy_signal=False, regular_comb=False, blocking_assign=True)
named_sc, named_pc = platform.resolve_signals(v_output.ns)
v_output.write(build_name + ".v")
@ -169,11 +172,13 @@ class SimVerilatorToolchain:
_generate_sim_variables(include_paths)
if sim_config:
_generate_sim_config(sim_config)
_build_sim(platform, build_name, verbose)
if run:
_run_sim(build_name, as_root=sim_config.has_module("ethernet"))
os.chdir("..")
os.chdir("../../")
if build:
return v_output.ns