sim: rename top module to dut and use --top-module parameter (needed for picorv32...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 23 Jan 2018 09:28:16 +0000 (10:28 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 23 Jan 2018 09:28:16 +0000 (10:28 +0100)
litex/build/sim/core/Makefile
litex/build/sim/verilator.py

index 0388cdda05a970b244a6a8407015e01a3ede8fe8..782ac46b3024a494e8f60fcbafdf1ad0a967a0c0 100644 (file)
@@ -24,7 +24,7 @@ $(OBJS_SIM): %.o: $(SRC_DIR)/%.c
 
 .PHONY: sim
 sim: mkdir $(OBJS_SIM)
-       verilator -Wno-fatal -O3 --cc dut.v --exe \
+       verilator -Wno-fatal -O3 --cc dut.v --top-module dut --exe \
                $(SRCS_SIM_CPP) $(OBJS_SIM) \
                -CFLAGS "$(CFLAGS) -I$(SRC_DIR)" \
                -LDFLAGS "$(LDFLAGS)" \
index 312d51e3fe38b7ea8b3b28467905bc191f12c380..a2e39b47adb138b1f33e62e4ec7ce00a5eb10cc7 100644 (file)
@@ -136,7 +136,7 @@ sudo obj_dir/Vdut
 
 
 class SimVerilatorToolchain:
-    def build(self, platform, fragment, build_dir="build", build_name="top",
+    def build(self, platform, fragment, build_dir="build", build_name="dut",
             toolchain_path=None, serial="console", run=True, verbose=True,
             sim_config=None):
         os.makedirs(build_dir, exist_ok=True)
@@ -146,9 +146,9 @@ class SimVerilatorToolchain:
             fragment = fragment.get_fragment()
         platform.finalize(fragment)
 
-        v_output = platform.get_verilog(fragment)
+        v_output = platform.get_verilog(fragment, name=build_name)
         named_sc, named_pc = platform.resolve_signals(v_output.ns)
-        v_output.write("dut.v")
+        v_output.write(build_name + ".v")
 
         include_paths = []
         for source in platform.sources: