Drop the "tb copy" stage of running a simulation

I don't quite understand why I thought this was needed: perhaps some
holdover from riscv-dv expecting files to be a certain shape? Anyway,
no need to keep it now.
This commit is contained in:
Rupert Swarbrick 2022-04-20 08:32:39 +01:00 committed by Rupert Swarbrick
parent a628007826
commit 668856441a
2 changed files with 9 additions and 23 deletions

View file

@ -417,29 +417,14 @@ rtl_tb_compile: $(OUT-DIR)rtl_sim/.rtl.tb_compile.stamp
###############################################################################
# Run ibex RTL simulation with generated programs
#
# Because we compile a TB once rather than for each seed, we have to copy in
# that directory before we start. We make this step (rather than actually
# running the test) dependent on having the right variables. That way, we'll
# correctly delete the sim directory and re-copy it if necessary.
#
# Note that the variables we depend on are instr-gen-build-vars-prereq.
# We also depend on COV and WAVES, but these dependencies will come for free
# from the dependency on the compiled TB.
$(metadata)/.rtl.tb_compile.stamp: \
$(OUT-DIR)rtl_sim/.rtl.tb_compile.stamp \
$(instr-gen-build-vars-prereq) $(risc-dv-files)
rm -rf $(OUT-SEED)/rtl_sim
cp -r $(OUT-DIR)rtl_sim $(OUT-SEED)
@touch $@
rtl-sim-dirs := $(addprefix $(OUT-SEED)/rtl_sim/,$(tests-and-seeds))
rtl-sim-logs := $(addsuffix /sim.log,$(rtl-sim-dirs))
$(rtl-sim-logs): \
$(OUT-SEED)/rtl_sim/%/sim.log: \
$(metadata)/.rtl.tb_compile.stamp \
$(OUT-SEED)/instr_gen/%.bin \
$(OUT-SEED)/rtl_sim/%/sim.log: \
$(OUT-DIR)rtl_sim/.rtl.tb_compile.stamp \
$(OUT-SEED)/instr_gen/%.bin \
scripts/run-rtl.py
@echo Running RTL simulation at $@
$(verb)mkdir -p $(@D)
@ -449,7 +434,8 @@ $(rtl-sim-logs): \
--signature-addr $(SIGNATURE_ADDR) \
--test-dot-seed $* \
--binary $(OUT-SEED)/instr_gen/$*.bin \
--rtl-sim-dir $(OUT-SEED)/rtl_sim \
--rtl-sim-dir $(OUT-DIR)rtl_sim \
--out-dir $(OUT-SEED)/rtl_sim/$* \
--sim-opts "$(SIM_OPTS)"
.PHONY: rtl_sim_run

View file

@ -62,6 +62,7 @@ def main() -> int:
required=True)
parser.add_argument('--binary', required=True)
parser.add_argument('--rtl-sim-dir', required=True)
parser.add_argument('--out-dir', required=True)
parser.add_argument('--sim-opts')
args = parser.parse_args()
@ -89,16 +90,15 @@ def main() -> int:
})
# Specialize base_cmd for this specific test
test_sim_dir = os.path.join(args.rtl_sim_dir,
'{}.{}'.format(testname, seed))
test_cmd = get_test_sim_cmd(sim_cmd, entry,
args.binary, seed, test_sim_dir)
args.binary, seed, args.out_dir)
# Run test_cmd (it's a string, so we have to call out to the shell to do
# so). Note that we don't capture the success or failure of the subprocess:
# if something goes horribly wrong, we assume we won't have a matching
# trace.
sim_log = os.path.join(test_sim_dir, 'sim.log')
sim_log = os.path.join(args.out_dir, 'sim.log')
os.makedirs(args.out_dir, exist_ok=True)
with open(sim_log, 'wb') as sim_fd:
subprocess.run(test_cmd, shell=True, stdout=sim_fd, stderr=sim_fd)