diff --git a/fud/fud/stages/verilator/stage.py b/fud/fud/stages/verilator/stage.py index f008b719a4..f4be6a1f2f 100644 --- a/fud/fud/stages/verilator/stage.py +++ b/fud/fud/stages/verilator/stage.py @@ -167,7 +167,7 @@ def json_to_dat(tmp_dir: SourceType.Directory, json_path: SourceType.Path): testbench_sv, "--binary", "--top-module", - "TOP", # The wrapper module name from `tb.sv`. + "toplevel", # The wrapper module name from `tb.sv`. "--Mdir", "{tmpdir_name}", "-fno-inline", @@ -192,7 +192,7 @@ def simulate(tmpdir: SourceType.Directory) -> SourceType.Stream: cycle_limit = config["stages", self.name, "cycle_limit"] return shell( [ - f"{tmpdir.name}/VTOP", + f"{tmpdir.name}/Vtoplevel", f"+DATA={tmpdir.name}", f"+CYCLE_LIMIT={str(cycle_limit)}", f"+OUT={tmpdir.name}/output.vcd", diff --git a/fud/icarus/tb.sv b/fud/icarus/tb.sv index c1631bef6a..79bdd99cd2 100644 --- a/fud/icarus/tb.sv +++ b/fud/icarus/tb.sv @@ -1,4 +1,4 @@ -module TOP; +module toplevel; // Signals for the main module. logic go, done, clk, reset; diff --git a/fud2/rsrc/tb.sv b/fud2/rsrc/tb.sv index c1631bef6a..79bdd99cd2 100644 --- a/fud2/rsrc/tb.sv +++ b/fud2/rsrc/tb.sv @@ -1,4 +1,4 @@ -module TOP; +module toplevel; // Signals for the main module. logic go, done, clk, reset; diff --git a/fud2/scripts/icarus.rhai b/fud2/scripts/icarus.rhai index a0c3be7c66..18aed9c642 100644 --- a/fud2/scripts/icarus.rhai +++ b/fud2/scripts/icarus.rhai @@ -7,11 +7,11 @@ fn icarus_setup(e) { e.var_("iverilog", "iverilog"); e.rule( "icarus-compile-standalone-tb", - "$iverilog -g2012 -o $out tb.sv $in", + "$iverilog -g2012 -s toplevel -o $out tb.sv $in", ); e.rule( "icarus-compile-custom-tb", - "$iverilog -g2012 -o $out tb.sv memories.sv $in", + "$iverilog -g2012 -s toplevel -o $out tb.sv memories.sv $in", ); } diff --git a/fud2/scripts/verilator.rhai b/fud2/scripts/verilator.rhai index 891b9f93ba..d41cff84ff 100644 --- a/fud2/scripts/verilator.rhai +++ b/fud2/scripts/verilator.rhai @@ -8,11 +8,11 @@ fn verilator_setup(e) { e.config_var_or("cycle-limit", "sim.cycle_limit", "500000000"); e.rule( "verilator-compile-standalone-tb", - "$verilator $in tb.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir", + "$verilator $in tb.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir", ); e.rule( "verilator-compile-custom-tb", - "$verilator $in tb.sv memories.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir", + "$verilator $in tb.sv memories.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir", ); e.rule("cp", "cp $in $out"); } @@ -20,7 +20,7 @@ fn verilator_setup(e) { export const verilator_build = verilator_build; fn verilator_build(e, input, output, standalone_tb) { let out_dir = "verilator-out"; - let sim_bin = `${out_dir}/VTOP`; + let sim_bin = `${out_dir}/Vtoplevel`; if standalone_tb { e.build_cmd( [sim_bin], diff --git a/fud2/src/lib.rs b/fud2/src/lib.rs index 704b9b60f3..ca7065a469 100644 --- a/fud2/src/lib.rs +++ b/fud2/src/lib.rs @@ -272,11 +272,11 @@ pub fn build_driver(bld: &mut DriverBuilder) { e.config_var_or("cycle-limit", "sim.cycle_limit", "500000000")?; e.rule( "verilator-compile-standalone-tb", - "$verilator $in tb.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir", + "$verilator $in tb.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir", )?; e.rule( "verilator-compile-custom-tb", - "$verilator $in tb.sv memories.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir", + "$verilator $in tb.sv memories.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir", )?; e.rule("cp", "cp $in $out")?; Ok(()) @@ -288,7 +288,7 @@ pub fn build_driver(bld: &mut DriverBuilder) { standalone_testbench: bool, ) -> EmitResult { let out_dir = "verilator-out"; - let sim_bin = format!("{}/VTOP", out_dir); + let sim_bin = format!("{}/Vtoplevel", out_dir); if standalone_testbench { e.build_cmd( &[&sim_bin], diff --git a/fud2/tests/snapshots/tests__test@calyx_through_icarus_to_dat.snap b/fud2/tests/snapshots/tests__test@calyx_through_icarus_to_dat.snap index 2a1a35ed98..56cd7ebad5 100644 --- a/fud2/tests/snapshots/tests__test@calyx_through_icarus_to_dat.snap +++ b/fud2/tests/snapshots/tests__test@calyx_through_icarus_to_dat.snap @@ -34,9 +34,9 @@ build tb.sv: get-rsrc iverilog = iverilog rule icarus-compile-standalone-tb - command = $iverilog -g2012 -o $out tb.sv $in + command = $iverilog -g2012 -s toplevel -o $out tb.sv $in rule icarus-compile-custom-tb - command = $iverilog -g2012 -o $out tb.sv memories.sv $in + command = $iverilog -g2012 -s toplevel -o $out tb.sv memories.sv $in build verilog-noverify.sv: calyx _from_stdin_calyx.futil backend = verilog diff --git a/fud2/tests/snapshots/tests__test@calyx_through_icarus_to_vcd.snap b/fud2/tests/snapshots/tests__test@calyx_through_icarus_to_vcd.snap index 85827059d6..3d0b116ef9 100644 --- a/fud2/tests/snapshots/tests__test@calyx_through_icarus_to_vcd.snap +++ b/fud2/tests/snapshots/tests__test@calyx_through_icarus_to_vcd.snap @@ -34,9 +34,9 @@ build tb.sv: get-rsrc iverilog = iverilog rule icarus-compile-standalone-tb - command = $iverilog -g2012 -o $out tb.sv $in + command = $iverilog -g2012 -s toplevel -o $out tb.sv $in rule icarus-compile-custom-tb - command = $iverilog -g2012 -o $out tb.sv memories.sv $in + command = $iverilog -g2012 -s toplevel -o $out tb.sv memories.sv $in build verilog-noverify.sv: calyx _from_stdin_calyx.futil backend = verilog diff --git a/fud2/tests/snapshots/tests__test@calyx_through_verilator_to_dat.snap b/fud2/tests/snapshots/tests__test@calyx_through_verilator_to_dat.snap index 184bb8a24f..3adf6da679 100644 --- a/fud2/tests/snapshots/tests__test@calyx_through_verilator_to_dat.snap +++ b/fud2/tests/snapshots/tests__test@calyx_through_verilator_to_dat.snap @@ -35,17 +35,17 @@ build tb.sv: get-rsrc verilator = verilator cycle-limit = 500000000 rule verilator-compile-standalone-tb - command = $verilator $in tb.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir + command = $verilator $in tb.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir rule verilator-compile-custom-tb - command = $verilator $in tb.sv memories.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir + command = $verilator $in tb.sv memories.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir rule cp command = cp $in $out build verilog.sv: calyx _from_stdin_calyx.futil backend = verilog -build verilator-out/VTOP: verilator-compile-standalone-tb verilog.sv | tb.sv +build verilator-out/Vtoplevel: verilator-compile-standalone-tb verilog.sv | tb.sv out-dir = verilator-out -build sim.exe: cp verilator-out/VTOP +build sim.exe: cp verilator-out/Vtoplevel build sim.log: sim-run sim.exe $datadir bin = sim.exe args = +NOTRACE=1 diff --git a/fud2/tests/snapshots/tests__test@calyx_through_verilator_to_vcd.snap b/fud2/tests/snapshots/tests__test@calyx_through_verilator_to_vcd.snap index 07ab0b6544..4b47721931 100644 --- a/fud2/tests/snapshots/tests__test@calyx_through_verilator_to_vcd.snap +++ b/fud2/tests/snapshots/tests__test@calyx_through_verilator_to_vcd.snap @@ -35,17 +35,17 @@ build tb.sv: get-rsrc verilator = verilator cycle-limit = 500000000 rule verilator-compile-standalone-tb - command = $verilator $in tb.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir + command = $verilator $in tb.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir rule verilator-compile-custom-tb - command = $verilator $in tb.sv memories.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir + command = $verilator $in tb.sv memories.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir rule cp command = cp $in $out build verilog.sv: calyx _from_stdin_calyx.futil backend = verilog -build verilator-out/VTOP: verilator-compile-standalone-tb verilog.sv | tb.sv +build verilator-out/Vtoplevel: verilator-compile-standalone-tb verilog.sv | tb.sv out-dir = verilator-out -build sim.exe: cp verilator-out/VTOP +build sim.exe: cp verilator-out/Vtoplevel build sim.log _to_stdout_vcd.vcd: sim-run sim.exe $datadir bin = sim.exe args = +NOTRACE=0 +OUT=_to_stdout_vcd.vcd diff --git a/fud2/tests/snapshots/tests__test@calyx_verilator_dat.snap b/fud2/tests/snapshots/tests__test@calyx_verilator_dat.snap index 184bb8a24f..3adf6da679 100644 --- a/fud2/tests/snapshots/tests__test@calyx_verilator_dat.snap +++ b/fud2/tests/snapshots/tests__test@calyx_verilator_dat.snap @@ -35,17 +35,17 @@ build tb.sv: get-rsrc verilator = verilator cycle-limit = 500000000 rule verilator-compile-standalone-tb - command = $verilator $in tb.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir + command = $verilator $in tb.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir rule verilator-compile-custom-tb - command = $verilator $in tb.sv memories.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir + command = $verilator $in tb.sv memories.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir rule cp command = cp $in $out build verilog.sv: calyx _from_stdin_calyx.futil backend = verilog -build verilator-out/VTOP: verilator-compile-standalone-tb verilog.sv | tb.sv +build verilator-out/Vtoplevel: verilator-compile-standalone-tb verilog.sv | tb.sv out-dir = verilator-out -build sim.exe: cp verilator-out/VTOP +build sim.exe: cp verilator-out/Vtoplevel build sim.log: sim-run sim.exe $datadir bin = sim.exe args = +NOTRACE=1 diff --git a/fud2/tests/snapshots/tests__test@calyx_verilator_vcd.snap b/fud2/tests/snapshots/tests__test@calyx_verilator_vcd.snap index 07ab0b6544..4b47721931 100644 --- a/fud2/tests/snapshots/tests__test@calyx_verilator_vcd.snap +++ b/fud2/tests/snapshots/tests__test@calyx_verilator_vcd.snap @@ -35,17 +35,17 @@ build tb.sv: get-rsrc verilator = verilator cycle-limit = 500000000 rule verilator-compile-standalone-tb - command = $verilator $in tb.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir + command = $verilator $in tb.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir rule verilator-compile-custom-tb - command = $verilator $in tb.sv memories.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir + command = $verilator $in tb.sv memories.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir rule cp command = cp $in $out build verilog.sv: calyx _from_stdin_calyx.futil backend = verilog -build verilator-out/VTOP: verilator-compile-standalone-tb verilog.sv | tb.sv +build verilator-out/Vtoplevel: verilator-compile-standalone-tb verilog.sv | tb.sv out-dir = verilator-out -build sim.exe: cp verilator-out/VTOP +build sim.exe: cp verilator-out/Vtoplevel build sim.log _to_stdout_vcd.vcd: sim-run sim.exe $datadir bin = sim.exe args = +NOTRACE=0 +OUT=_to_stdout_vcd.vcd diff --git a/fud2/tests/snapshots/tests__test@plan_icarus-refmem.snap b/fud2/tests/snapshots/tests__test@plan_icarus-refmem.snap index e136366e25..ba31c80b12 100644 --- a/fud2/tests/snapshots/tests__test@plan_icarus-refmem.snap +++ b/fud2/tests/snapshots/tests__test@plan_icarus-refmem.snap @@ -21,9 +21,9 @@ cycle-limit = 500000000 iverilog = iverilog rule icarus-compile-standalone-tb - command = $iverilog -g2012 -o $out tb.sv $in + command = $iverilog -g2012 -s toplevel -o $out tb.sv $in rule icarus-compile-custom-tb - command = $iverilog -g2012 -o $out tb.sv memories.sv $in + command = $iverilog -g2012 -s toplevel -o $out tb.sv memories.sv $in build /output.ext: icarus-compile-custom-tb /input.ext | tb.sv memories.sv diff --git a/fud2/tests/snapshots/tests__test@plan_icarus.snap b/fud2/tests/snapshots/tests__test@plan_icarus.snap index b24cc2196e..47e4f5dd7d 100644 --- a/fud2/tests/snapshots/tests__test@plan_icarus.snap +++ b/fud2/tests/snapshots/tests__test@plan_icarus.snap @@ -23,9 +23,9 @@ build tb.sv: get-rsrc iverilog = iverilog rule icarus-compile-standalone-tb - command = $iverilog -g2012 -o $out tb.sv $in + command = $iverilog -g2012 -s toplevel -o $out tb.sv $in rule icarus-compile-custom-tb - command = $iverilog -g2012 -o $out tb.sv memories.sv $in + command = $iverilog -g2012 -s toplevel -o $out tb.sv memories.sv $in build /output.ext: icarus-compile-standalone-tb /input.ext | tb.sv diff --git a/fud2/tests/snapshots/tests__test@plan_verilator-refmem.snap b/fud2/tests/snapshots/tests__test@plan_verilator-refmem.snap index e217d36c24..ca265ce0fb 100644 --- a/fud2/tests/snapshots/tests__test@plan_verilator-refmem.snap +++ b/fud2/tests/snapshots/tests__test@plan_verilator-refmem.snap @@ -33,14 +33,14 @@ rule dummy verilator = verilator cycle-limit = 500000000 rule verilator-compile-standalone-tb - command = $verilator $in tb.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir + command = $verilator $in tb.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir rule verilator-compile-custom-tb - command = $verilator $in tb.sv memories.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir + command = $verilator $in tb.sv memories.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir rule cp command = cp $in $out -build verilator-out/VTOP: verilator-compile-custom-tb /input.ext | tb.sv memories.sv +build verilator-out/Vtoplevel: verilator-compile-custom-tb /input.ext | tb.sv memories.sv out-dir = verilator-out -build /output.ext: cp verilator-out/VTOP +build /output.ext: cp verilator-out/Vtoplevel default /output.ext diff --git a/fud2/tests/snapshots/tests__test@plan_verilator.snap b/fud2/tests/snapshots/tests__test@plan_verilator.snap index ff6bf736ce..8ac0616ea4 100644 --- a/fud2/tests/snapshots/tests__test@plan_verilator.snap +++ b/fud2/tests/snapshots/tests__test@plan_verilator.snap @@ -24,14 +24,14 @@ build tb.sv: get-rsrc verilator = verilator cycle-limit = 500000000 rule verilator-compile-standalone-tb - command = $verilator $in tb.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir + command = $verilator $in tb.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir rule verilator-compile-custom-tb - command = $verilator $in tb.sv memories.sv --trace --binary --top-module TOP -fno-inline -Mdir $out-dir + command = $verilator $in tb.sv memories.sv --trace --binary --top-module toplevel -fno-inline -Mdir $out-dir rule cp command = cp $in $out -build verilator-out/VTOP: verilator-compile-standalone-tb /input.ext | tb.sv +build verilator-out/Vtoplevel: verilator-compile-standalone-tb /input.ext | tb.sv out-dir = verilator-out -build /output.ext: cp verilator-out/VTOP +build /output.ext: cp verilator-out/Vtoplevel default /output.ext diff --git a/tests/correctness/systolic/pe/array-1.systolic.jq b/tests/correctness/systolic/pe/array-1.systolic.jq index 368314975b..d17b33b0d9 100644 --- a/tests/correctness/systolic/pe/array-1.systolic.jq +++ b/tests/correctness/systolic/pe/array-1.systolic.jq @@ -1,4 +1,4 @@ -.TOP.TOP.main.systolic_array_component | ({ +.TOP.toplevel.main.systolic_array_component | ({ "cycles":.clk | add, "pe_00": .pe_0_0.acc.out | unique, }) diff --git a/tests/correctness/systolic/pe/array-2.systolic.jq b/tests/correctness/systolic/pe/array-2.systolic.jq index abbe179ed6..f90c7a72ca 100644 --- a/tests/correctness/systolic/pe/array-2.systolic.jq +++ b/tests/correctness/systolic/pe/array-2.systolic.jq @@ -1,4 +1,4 @@ -.TOP.TOP.main.systolic_array_component | ({ +.TOP.toplevel.main.systolic_array_component | ({ "cycles":.clk | add, "pe_00": .pe_0_0.acc.out | unique, "pe_01": .pe_0_1.acc.out | unique, diff --git a/tests/correctness/systolic/pe/array-3.systolic.jq b/tests/correctness/systolic/pe/array-3.systolic.jq index d79ac69789..f350302192 100644 --- a/tests/correctness/systolic/pe/array-3.systolic.jq +++ b/tests/correctness/systolic/pe/array-3.systolic.jq @@ -1,4 +1,4 @@ -.TOP.TOP.main.systolic_array_component | ({ +.TOP.toplevel.main.systolic_array_component | ({ "cycles":.clk | add, "pe_00": .pe_0_0.acc.out | unique, diff --git a/tests/errors/runtime/multiple-drivers.expect b/tests/errors/runtime/multiple-drivers.expect index 121cb1a8f3..e5ca4aeedf 100644 --- a/tests/errors/runtime/multiple-drivers.expect +++ b/tests/errors/runtime/multiple-drivers.expect @@ -1,2 +1,2 @@ -[70] %Error: Assertion failed in TOP.main: Multiple assignment to port `r.in'. +[70] %Error: Assertion failed in TOP.toplevel.main: Multiple assignment to port `r.in'. %Error: Verilog $stop diff --git a/tools/firrtl/custom_tb_template.sv b/tools/firrtl/custom_tb_template.sv index fa24e707f2..bfd8bc0e3d 100644 --- a/tools/firrtl/custom_tb_template.sv +++ b/tools/firrtl/custom_tb_template.sv @@ -1,4 +1,4 @@ -module TOP; +module toplevel; // Signals for the main module. logic go, done, clk, reset;