Merge pull request #91 from ucb-bar/rebar-dev-renaming-help

rename output | helper rules to run binaries
This commit is contained in:
Abraham Gonzalez
2019-05-21 10:44:48 -07:00
committed by GitHub
5 changed files with 43 additions and 8 deletions

View File

@@ -50,6 +50,16 @@ build an alternate configuration.
make PROJECT=yourproject CONFIG=YourConfig
./simulator-yourproject-YourConfig ...
Additionally, you can use a helper make rule to run your simulation binary. The output will be in the "verisim"
directory under the file names: `<binary-name>.<type of project/config/etc it ran on>.*`
# first make your verisim rtl simulator binary
make SUB_PROJECT=example
# then run the binary (with no vcd generation)
make SUB_PROJECT=example BINARY=<my-riscv-binary> run-binary
# then run the binary (with vcd generation)
make SUB_PROJECT=example BINARY=<my-riscv-binary> run-binary-debug
## Submodules and Subdirectories
The submodules and subdirectories for the project template are organized as

View File

@@ -67,6 +67,12 @@ $(SMEMS_FILE) $(SMEMS_FIR): $(SMEMS_CONF)
.PHONY: verilog
verilog: $(sim_vsrcs)
#########################################################################################
# helper rules to run simulator
#########################################################################################
run-binary: $(sim)
$(sim) $(PERMISSIVE_ON) $(SIM_FLAGS) $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out
#########################################################################################
# run assembly/benchmarks rules
#########################################################################################
@@ -75,10 +81,10 @@ $(output_dir)/%: $(RISCV)/riscv64-unknown-elf/share/riscv-tests/isa/%
ln -sf $< $@
$(output_dir)/%.run: $(output_dir)/% $(sim)
$(sim) +max-cycles=$(timeout_cycles) $< && touch $@
$(sim) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(PERMISSIVE_OFF) $< && touch $@
$(output_dir)/%.out: $(output_dir)/% $(sim)
$(sim) $(PERMISSIVEON) +verbose +max-cycles=$(timeout_cycles) $(PERMISSIVEOFF) $< 3>&1 1>&2 2>&3 | spike-dasm > $@
$(sim) $(PERMISSIVE_ON) +verbose +max-cycles=$(timeout_cycles) $(PERMISSIVE_OFF) $< 3>&1 1>&2 2>&3 | spike-dasm > $@
#########################################################################################
# include build/project specific makefrags made from the generator

View File

@@ -25,8 +25,8 @@ sim_prefix = simulator
sim = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)
sim_debug = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)-debug
PERMISSIVEON=
PERMISSIVEOFF=
PERMISSIVE_ON=
PERMISSIVE_OFF=
.PHONY: default debug
default: $(sim)
@@ -80,6 +80,12 @@ $(sim): $(model_mk)
$(sim_debug): $(model_mk_debug)
$(MAKE) VM_PARALLEL_BUILDS=1 -C $(build_dir)/$(long_name).debug -f V$(VLOG_MODEL).mk
#########################################################################################
# helper rules to run simulator with debug
#########################################################################################
run-binary-debug: $(sim_debug)
$(sim_debug) $(SIM_FLAGS) -v$(sim_out_name).vcd $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out
#########################################################################################
# create a verisim vpd rule
#########################################################################################

View File

@@ -25,8 +25,8 @@ sim_prefix = simv
sim = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)
sim_debug = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)-debug
PERMISSIVEON=+permissive
PERMISSIVEOFF=+permissive-off
PERMISSIVE_ON=+permissive
PERMISSIVE_OFF=+permissive-off
.PHONY: default debug
default: $(sim)
@@ -86,11 +86,17 @@ $(sim_debug) : $(sim_vsrcs) $(sim_dotf)
rm -rf csrc && $(VCS) $(VCS_OPTS) -o $@ \
+define+DEBUG -debug_pp
#########################################################################################
# helper rules to run simulator with debug
#########################################################################################
run-binary-debug: $(sim_debug)
$(sim_debug) $(PERMISSIVE_ON) $(SIM_FLAGS) +vcdplusfile=$(sim_out_name).vpd $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out
#########################################################################################
# create a vcs vpd rule
#########################################################################################
$(output_dir)/%.vpd: $(output_dir)/% $(sim_debug)
$(sim_debug) +vcdplusfile=$@ +max-cycles=$(timeout_cycles) $<
$(sim_debug) $(PERMISSIVE_ON) +vcdplusfile=$@ +max-cycles=$(timeout_cycles) $(PERMISSIVE_OFF) $<
#########################################################################################
# general cleanup rule

View File

@@ -138,7 +138,14 @@ SBT ?= java $(JAVA_ARGS) -jar $(ROCKETCHIP_DIR)/sbt-launch.jar ++$(SCALA_VERSION
#########################################################################################
# output directory for tests
#########################################################################################
output_dir=$(sim_dir)/output
output_dir=$(sim_dir)/output/$(long_name)
#########################################################################################
# helper variables to run binaries
#########################################################################################
BINARY ?=
SIM_FLAGS ?= +verbose
sim_out_name = $(notdir $(basename $(BINARY))).$(long_name)
#########################################################################################
# build output directory for compilation