diff --git a/demo/helloworld/Makefile b/demo/helloworld/Makefile index c1901a9..ff618cc 100644 --- a/demo/helloworld/Makefile +++ b/demo/helloworld/Makefile @@ -12,6 +12,7 @@ TESTDIR = ${PWD} BUILD_DIR = ${TESTDIR}/build SWERV_CONFIG = ${TESTDIR}/swerv.config RV_DESIGN = ${RV_ROOT}/design +RV_SOC = ${RV_ROOT}/soc TEST = hello_world @@ -25,8 +26,7 @@ LINK = $(TESTDIR)/link.ld OFILES = $(TEST).o OUTFILES = $(TEST).out -VPATH = $(BUILD_DIR) $(TESTDIR) -TESTFILES = $(TESTDIR)/tb_top.sv $(TESTDIR)/ahb_sif.sv +SOCFILES = $(RV_SOC)/soc_top.sv $(RV_SOC)/ahb_sif.sv defines = $(BUILD_DIR)/common_defines.vh ${RV_DESIGN}/include/swerv_types.sv includes = -I${RV_DESIGN}/include -I${RV_DESIGN}/lib -I${BUILD_DIR} @@ -49,21 +49,22 @@ ${BUILD_DIR}/defines.h : ##################### Verilog Builds ##################################### -verilator-build: ${TESTFILES} ${BUILD_DIR}/defines.h test_tb_top.cpp +verilator-build: ${SOCFILES} ${BUILD_DIR}/defines.h test_soc_top.cpp echo '`undef ASSERT_ON' >> ${BUILD_DIR}/common_defines.vh $(VERILATOR) --cc -CFLAGS ${CFLAGS} $(defines) $(includes) \ -Wno-UNOPTFLAT \ -I${TESTDIR} \ + -I${RV_SOC} \ -f ${TESTDIR}/flist \ - ${TESTFILES} \ - --top-module tb_top -exe test_tb_top.cpp --autoflush $(VERILATOR_DEBUG) - cp ${TESTDIR}/test_tb_top.cpp obj_dir - $(MAKE) -j -C obj_dir/ -f Vtb_top.mk $(VERILATOR_MAKE_FLAGS) + ${SOCFILES} \ + --top-module soc_top -exe test_soc_top.cpp --autoflush $(VERILATOR_DEBUG) + cp ${TESTDIR}/test_soc_top.cpp obj_dir + $(MAKE) -j -C obj_dir/ -f Vsoc_top.mk $(VERILATOR_MAKE_FLAGS) ##################### Simulation Runs ##################################### verilator: program.hex verilator-build - cd build && ../obj_dir/Vtb_top ${DEBUG_PLUS} + cd build && ../obj_dir/Vsoc_top ${DEBUG_PLUS} ##################### Test Build ##################################### diff --git a/demo/helloworld/swerv.config b/demo/helloworld/swerv.config index 25de140..b4d944a 100755 --- a/demo/helloworld/swerv.config +++ b/demo/helloworld/swerv.config @@ -854,7 +854,7 @@ our %config = (#{{{ "pic_meigwclr_count" => $pic_total_int }, "testbench" => { - "TOP" => "tb_top", + "TOP" => "soc_top", "RV_TOP" => "`TOP.rvtop", "CPU_TOP" => "`RV_TOP.swerv", "clock_period" => "100", diff --git a/demo/helloworld/test_tb_top.cpp b/demo/helloworld/test_soc_top.cpp similarity index 91% rename from demo/helloworld/test_tb_top.cpp rename to demo/helloworld/test_soc_top.cpp index 899caf1..4295f0b 100644 --- a/demo/helloworld/test_tb_top.cpp +++ b/demo/helloworld/test_soc_top.cpp @@ -17,7 +17,7 @@ #include #include #include -#include "Vtb_top.h" +#include "Vsoc_top.h" #include "verilated.h" #include "verilated_vcd_c.h" @@ -34,7 +34,7 @@ int main(int argc, char** argv) { Verilated::commandArgs(argc, argv); - Vtb_top* tb = new Vtb_top; + Vsoc_top* soc = new Vsoc_top; // init trace dump VerilatedVcdC* tfp = NULL; @@ -42,7 +42,7 @@ int main(int argc, char** argv) { #if VM_TRACE Verilated::traceEverOn(true); tfp = new VerilatedVcdC; - tb->trace (tfp, 24); + soc->trace (tfp, 24); tfp->open ("sim.vcd"); #endif // Simulate @@ -51,8 +51,8 @@ int main(int argc, char** argv) { tfp->dump (main_time); #endif main_time += 5; - tb->core_clk = !tb->core_clk; - tb->eval(); + soc->core_clk = !soc->core_clk; + soc->eval(); } #if VM_TRACE diff --git a/demo/helloworld/ahb_sif.sv b/soc/ahb_sif.sv similarity index 100% rename from demo/helloworld/ahb_sif.sv rename to soc/ahb_sif.sv diff --git a/demo/helloworld/axi_lsu_dma_bridge.sv b/soc/axi_lsu_dma_bridge.sv similarity index 100% rename from demo/helloworld/axi_lsu_dma_bridge.sv rename to soc/axi_lsu_dma_bridge.sv diff --git a/demo/helloworld/dasm.svi b/soc/dasm.svi similarity index 100% rename from demo/helloworld/dasm.svi rename to soc/dasm.svi diff --git a/demo/helloworld/tb_top.sv b/soc/soc_top.sv similarity index 99% rename from demo/helloworld/tb_top.sv rename to soc/soc_top.sv index 6500a68..8c8c4f5 100644 --- a/demo/helloworld/tb_top.sv +++ b/soc/soc_top.sv @@ -14,9 +14,9 @@ // limitations under the License. // `ifdef VERILATOR -module tb_top ( input bit core_clk); +module soc_top ( input bit core_clk); `else -module tb_top; +module soc_top; bit core_clk; `endif logic rst_l; @@ -373,7 +373,7 @@ module tb_top; end if(`DEC.dec_nonblock_load_wen) begin $fwrite (el, "%10d : %10d%22s=%h ; nbL\n", cycleCnt, 0, abi_reg[`DEC.dec_nonblock_load_waddr], `DEC.lsu_nonblock_load_data); - tb_top.gpr[0][`DEC.dec_nonblock_load_waddr] = `DEC.lsu_nonblock_load_data; + soc_top.gpr[0][`DEC.dec_nonblock_load_waddr] = `DEC.lsu_nonblock_load_data; end end