librecores / riscv-sodor

educational microarchitectures for risc-v isa
Other
65 stars 21 forks source link

make run-emulator-debug fails, even though run-emulator works #9

Open apaj opened 5 years ago

apaj commented 5 years ago

Hi, everything is running smoothly until I try to do make run-emulator-debug. That results in the following:

running basedir/Makefile: make run-emulator-debug

make -C emulator/rv32_1stage/ run-debug
make[1]: Entering directory '/home/apaj/riscv-sodor/emulator/rv32_1stage'
make[1]: *** No rule to make target 'run-asm-tests-debug', needed by 'run-debug'.  Stop.
make[1]: Leaving directory '/home/apaj/riscv-sodor/emulator/rv32_1stage'
Makefile:97: recipe for target 'emulator/rv32_1stage/generated-src-debug/timestamp' failed
make: *** [emulator/rv32_1stage/generated-src-debug/timestamp] Error 2

At this webpage, I found this text:

When run in debug mode, all processors will generate .vcd information (viewable by your favorite waveform viewer). All processors can also spit out cycle-by-cycle log information. Although already done for you by the build system, to generate .vcd files, see emulator/common/Makefile.include to add the "-v${vcdfilename}" flag to the emulator-debug binary.

When I open Makefile.include, I do see this part:

output:
        mkdir -p $@

$(addprefix output/, $(global_asm_vcd)): output/%.vcd: $(global_tstdir)/% emulator-debug
        mkdir -p output
        ./emulator-debug -v$@ +max-cycles=$(asm_test_timeout) +verbose +loadmem=$< 2> /dev/null

...

$(addprefix output/, $(global_bmarks_vcd)): output/%.riscv.vcd: $(global_bmarkdir)/%.riscv emulator-debug
        mkdir -p output
        ./emulator-debug -v$@ +max-cycles=$(bmark_timeout) +verbose +loadmem=$< 2> /dev/null

but, unfortunately, I have to admit I don't really see how to add -v if it's already there...

Could someone please advise?

Thanks, Aleksandar

abignail commented 3 years ago

/emulator/commom/Makefile.include

1.line 55, completion the line:

CHISEL_ARGS_DEBUG := -td emulator/${MK_TARGET_PROC}/generated-src-debug

2.line 72: add a new line (compare with 'generated-src' above line 72 ):

generated-src-debug/Top.v: $(srcDir)/src/${MK_TARGETPROC}/.scala $(srcDir)/src/common/_.scala cd $(buildDir) && $(SBT) "project ${MK_TARGET_PROC}" "run $(CHISEL_ARGS_DEBUG)"

(before the cd is a Tab)

3.line 87: emulator-debug: generated-src/Top.v to:

emulator-debug: generated-src-debug/Top.v

4.line 191: add two new line, the rules for 'run-asm-tests-debug' and 'run-bmarks-test-debug':

run-asm-tests-debug: $(addprefix output/, $(addsuffix .vcd, $(global_asmtests))) @echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /{3}(.{8}){3}(.)/' $(patsubst %.vpd,%.out,$^); echo; run-bmarks-test-debug: $(addprefix output/, $(addsuffix .riscv.vcd, $(globalbmarks))) @echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /{3}(.{8}){3}(.)/' $(patsubst %.vpd,%.out,$^); echo;

(before the @Echos is a Tab)

BTW, you can download it here, https://gitee.com/abignail/riscv-sodor/blob/master/emulator/common/Makefile.include