Clean up --en_cov and --en_wave in sim.py

Since these are boolean flags "enable this, please", we use argparse's
support for them.

Command line change:

  Before: --en_cov=0
  After:

  Before: --en_cov=1
  After:  --en_cov

and similar for en_wave
This commit is contained in:
Rupert Swarbrick 2020-03-03 11:33:19 +00:00 committed by Rupert Swarbrick
parent d934a4485b
commit 04b5cb2d46
2 changed files with 9 additions and 10 deletions

View file

@ -311,6 +311,9 @@ compile-vars-prereq = $(call vars-prereq,comp,compiling TB,$(compile-var-deps))
$(call dump-vars-match,$(compile-var-deps),comp)
cov-arg := $(if $(call equal,$(COV),1),--en_cov,)
wave-arg := $(if $(call equal,$(WAVE),1),--en_wave,)
$(OUT)/rtl_sim/.compile.stamp: \
$(compile-vars-prereq) $(all-verilog) $(risc-dv-files) | $(OUT)/rtl_sim
@python3 ./sim.py \
@ -318,9 +321,7 @@ $(OUT)/rtl_sim/.compile.stamp: \
--riscv_dv_root=${GEN_DIR} \
--steps=compile \
${COMMON_OPTS} \
--simulator="${SIMULATOR}" \
--en_cov=${COV} \
--en_wave=${WAVES} \
--simulator="${SIMULATOR}" $(cov-arg) $(wave-arg) \
--cmp_opts="${COMPILE_OPTS}"
$(call dump-vars,$(OUT)/rtl_sim/.compile-vars.mk,comp,$(compile-var-deps))
@touch $@
@ -354,9 +355,7 @@ $(metadata)/rtl_sim.run.stamp: \
--riscv_dv_root=${GEN_DIR} \
--steps=sim \
${TEST_OPTS} \
--simulator="${SIMULATOR}" \
--en_cov ${COV} \
--en_wave ${WAVES} \
--simulator="${SIMULATOR}" $(cov-arg) $(wave-arg) \
--lsf_cmd="${LSF_CMD}" \
--sim_opts="+signature_addr=${SIGNATURE_ADDR}" \
${SIM_OPTS}

View file

@ -320,9 +320,9 @@ def main():
help="Compile options for the generator")
parser.add_argument("--sim_opts", type=str, default="",
help="Simulation options for the generator")
parser.add_argument("--en_cov", type=str, default=0,
parser.add_argument("--en_cov", action='store_true',
help="Enable coverage dump")
parser.add_argument("--en_wave", type=str, default=0,
parser.add_argument("--en_wave", action='store_true',
help="Enable waveform dump")
parser.add_argument("--steps", type=str, default="all",
help="Run steps: compile,sim,compare")
@ -350,8 +350,8 @@ def main():
matched_list = []
if steps['compile'] or steps['sim']:
enables = {
'cov_opts': True if args.en_cov == '1' else False,
'wave_opts': True if args.en_wave == '1' else False
'cov_opts': args.en_cov,
'wave_opts': args.en_wave
}
compile_cmds, sim_cmd = get_simulator_cmd(args.simulator,
args.simulator_yaml, enables)