diff --git a/dv/uvm/core_ibex/Makefile b/dv/uvm/core_ibex/Makefile index 8d9541ec..7e6710f0 100644 --- a/dv/uvm/core_ibex/Makefile +++ b/dv/uvm/core_ibex/Makefile @@ -85,12 +85,6 @@ RUN-DIR := $(OUT-DIR)run # get printed when VERBOSE. verb = $(if $(filter-out 0,$(VERBOSE)),,@) -# Convert VERBOSE, COV, WAVE and COSIM to "store_true" arguments -verb-arg := $(if $(filter-out 0,$(VERBOSE)),--verbose,) -cov-arg := $(if $(call equal,$(COV),1),--en_cov,) -wave-arg := $(if $(call equal,$(WAVES),1),--en_wave,) -cosim-arg := $(if $(call equal,$(COSIM),1),--en_cosim,) - SHELL=/bin/bash export PRJ_DIR := $(realpath ../../..) @@ -175,6 +169,12 @@ FORCE: # Call it as $(call vars-prereq,X,TGT,VS) vars-prereq = $(if $(call vars-differ,$(call strip,$(1)),$(2),$(3)),FORCE,) +# Convert VERBOSE, COV, WAVE and COSIM to "store_true" arguments +verb-arg := $(if $(filter-out 0,$(VERBOSE)),--verbose,) +cov-arg := $(if $(call equal,$(COV),1),--en_cov,) +wave-arg := $(if $(call equal,$(WAVES),1),--en_wave,) +cosim-arg := $(if $(call equal,$(COSIM),1),--en_cosim,) + ############################################################################### # Get a list of tests and seeds # @@ -355,11 +355,12 @@ $(BUILD-DIR)/tb/.compile.stamp: \ $(tb-compile-vars-prereq) $(all-verilog) $(risc-dv-files) \ scripts/compile-tb.py yaml/rtl_simulation.yaml \ | $(BUILD-DIR) - $(verb)scripts/compile-tb.py \ - $(verb-arg) \ - --ibex-config $(IBEX_CONFIG) \ - --output=$(BUILD-DIR)/tb \ - --simulator=$(SIMULATOR) \ + $(verb)scripts/compile-tb.py \ + $(verb-arg) \ + --ibex-config $(IBEX_CONFIG) \ + --output=$(BUILD-DIR)/tb \ + --shared-cov-dir=$(RUN-DIR)/shared_cov \ + --simulator=$(SIMULATOR) \ $(cov-arg) $(wave-arg) $(cosim-arg) $(call dump-vars,$(tb-compile-vars-path),comp,$(tb-compile-var-deps)) @touch $@ @@ -376,14 +377,15 @@ $(rtl-sim-logs): \ $(RUN-DIR)/%/rtl.log: \ $(BUILD-DIR)/tb/.compile.stamp $(RUN-DIR)/%/test.bin scripts/run-rtl.py @echo Running RTL simulation at $@ - $(verb)scripts/run-rtl.py \ - --ibex-config $(IBEX_CONFIG) \ - --simulator $(SIMULATOR) \ - $(cov-arg) $(wave-arg) \ - --signature-addr $(SIGNATURE_ADDR) \ - --test-dot-seed $* \ - --binary $(RUN-DIR)/$*/test.bin \ - --rtl-sim-dir $(BUILD-DIR)/tb \ + $(verb)scripts/run-rtl.py \ + --ibex-config $(IBEX_CONFIG) \ + --simulator $(SIMULATOR) \ + --shared-cov-dir=$(RUN-DIR)/shared_cov \ + $(cov-arg) $(wave-arg) \ + --signature-addr $(SIGNATURE_ADDR) \ + --test-dot-seed $* \ + --binary $(RUN-DIR)/$*/test.bin \ + --rtl-sim-dir $(BUILD-DIR)/tb \ --out-dir $(@D) .PHONY: rtl_sim_run diff --git a/dv/uvm/core_ibex/scripts/compile-tb.py b/dv/uvm/core_ibex/scripts/compile-tb.py index 1f984bd2..c0e27516 100755 --- a/dv/uvm/core_ibex/scripts/compile-tb.py +++ b/dv/uvm/core_ibex/scripts/compile-tb.py @@ -19,6 +19,7 @@ def main() -> int: parser.add_argument('--ibex-config', required=True) parser.add_argument('--output', required=True) + parser.add_argument('--shared-cov-dir', required=True) parser.add_argument('--simulator', required=True) parser.add_argument('--en_cov', action='store_true') parser.add_argument('--en_wave', action='store_true') @@ -47,6 +48,7 @@ def main() -> int: { 'core_ibex': core_ibex, 'out': args.output, + 'shared_cov_dir': args.shared_cov_dir, 'cmp_opts': get_compile_opts(args.ibex_config, args.simulator) }) diff --git a/dv/uvm/core_ibex/scripts/merge-cov.py b/dv/uvm/core_ibex/scripts/merge-cov.py index 76d60886..fd2dd681 100755 --- a/dv/uvm/core_ibex/scripts/merge-cov.py +++ b/dv/uvm/core_ibex/scripts/merge-cov.py @@ -30,10 +30,10 @@ def find_cov_dirs(start_dir: str, simulator: str) -> Set[str]: if file.endswith(".ucd") and simulator == 'xlm': logging.info("Found coverage database (ucd) at %s" % path) cov_dirs.add(path) - if vdb_dir_name in dirs and simulator == 'vcs': - vdb_path = os.path.join(path, vdb_dir_name) - logging.info("Found coverage database (vdb) at %s" % vdb_path) - cov_dirs.add(vdb_path) + if vdb_dir_name in dirs and simulator == 'vcs': + vdb_path = os.path.join(path, vdb_dir_name) + logging.info("Found coverage database (vdb) at %s" % vdb_path) + cov_dirs.add(vdb_path) return cov_dirs @@ -74,10 +74,12 @@ def merge_cov_xlm(cov_dir: str, verbose: bool, cov_dirs: Set[str]) -> int: # that handles them) xlm_cov_dirs['cov_db_dirs'] = ' '.join(cov_dir_parents) - xlm_env = os.environ | xlm_cov_dirs + xlm_env = os.environ.copy() + xlm_env.update(xlm_cov_dirs) # First do the merge imc_cmd = ["imc", "-64bit", "-licqueue"] + os.makedirs(merge_dir, exist_ok=True) cov_merge_tcl = os.path.join(xcelium_scripts, "cov_merge.tcl") merge_ret = run_one(verbose, imc_cmd + ["-exec", cov_merge_tcl, diff --git a/dv/uvm/core_ibex/scripts/run-rtl.py b/dv/uvm/core_ibex/scripts/run-rtl.py index a07cedbf..2bc2c346 100755 --- a/dv/uvm/core_ibex/scripts/run-rtl.py +++ b/dv/uvm/core_ibex/scripts/run-rtl.py @@ -55,6 +55,7 @@ def get_test_sim_cmd(base_cmd, test, binary, seed, sim_dir): def main() -> int: parser = argparse.ArgumentParser() parser.add_argument('--ibex-config', required=True) + parser.add_argument('--shared-cov-dir', required=True) parser.add_argument('--simulator', required=True) parser.add_argument("--en_cov", action='store_true') parser.add_argument("--en_wave", action='store_true') @@ -85,6 +86,7 @@ def main() -> int: sim_cmd = subst_vars(base_cmd, { 'out': args.rtl_sim_dir, + 'shared_cov_dir': args.shared_cov_dir, 'sim_opts': sim_opts, 'cwd': _CORE_IBEX, }) diff --git a/dv/uvm/core_ibex/yaml/rtl_simulation.yaml b/dv/uvm/core_ibex/yaml/rtl_simulation.yaml index 98f70aa4..2748ee50 100644 --- a/dv/uvm/core_ibex/yaml/rtl_simulation.yaml +++ b/dv/uvm/core_ibex/yaml/rtl_simulation.yaml @@ -39,7 +39,7 @@ -cm_tgl structarr -cm_report noinitial -cm_seqnoconst - -cm_dir /test.vdb + -cm_dir /test.vdb -cm_hier cover.cfg wave_opts: > -debug_access+all -ucli -do vcs.tcl @@ -61,10 +61,10 @@ +cosim_log_file=/spike_cosim.log cov_opts: > -cm line+tgl+assert+fsm+branch - -cm_dir /test.vdb + -cm_dir /test.vdb -cm_log /dev/null -assert nopostproc - -cm_name test__ + -cm_name test__ +enable_ibex_fcov=1 wave_opts: > -ucli -do /vcs.tcl @@ -186,9 +186,9 @@ cov_opts: > - -covmodeldir /coverage/default/. - -covworkdir /coverage - -covscope default + -covmodeldir /coverage + -covworkdir + -covscope coverage -covtest . +enable_ibex_fcov=1 wave_opts: >