[dv] add Xcelium and VCS proprietary files
- Synopsys and Cadence have given us the green signal to make their
tool-proprietary sources to be available on a public GitHub repo
diff --git a/hw/dv/tools/Makefile b/hw/dv/tools/Makefile
index 5da5e1b..94772e4 100644
--- a/hw/dv/tools/Makefile
+++ b/hw/dv/tools/Makefile
@@ -90,11 +90,9 @@
# add tool specific mk file
ifeq (${SIMULATOR},vcs)
- include ${VCS_PRIV_DIR}/vcs.mk
-else ifeq (${SIMULATOR},incisive)
- include ${INCISIVE_PRIV_DIR}/incisive.mk
+ include ${MAKE_ROOT}/vcs/vcs.mk
else ifeq (${SIMULATOR},xcelium)
- include ${XCELIUM_PRIV_DIR}/xcelium.mk
+ include ${MAKE_ROOT}/xcelium/xcelium.mk
# else add other tool specific mk files
endif
diff --git a/hw/dv/tools/README.md b/hw/dv/tools/README.md
index 77e1d6c..4b25797 100644
--- a/hw/dv/tools/README.md
+++ b/hw/dv/tools/README.md
@@ -14,7 +14,8 @@
- fusesoc.mk
- modes.mk
- rules.mk
- - $VCS_PRIV_DIR/vcs.mk
+ - vcs/vcs.mk # if SIMULATOR=vcs
+ - xcelium/xcelium.mk # if SIMULATOR=xcelium
```
### Test Makefile
@@ -39,10 +40,10 @@
Make variable | Description | Overridable (O) or Appendable (A) |
--------------|-------------|-----------------------------------|
DV_DIR | This is the top level DV directory for the IP containing the Test Makefile. | |
-DUT_TOP | This is the top level dut module under test. This is used in common `vcs.tcl` file placed in the $VCS_PRIV_DIR directory. | |
-TB_TOP | This is the top level tb module under test. This is used in common `vcs.tcl` file placed in the $VCS_PRIV_DIR directory. | |
+DUT_TOP | This is the top level dut module under test. This is used in `{vcs, xcelium}_fsdb.tcl` file. | |
+TB_TOP | This is the top level tb module under test. This is used in `{vcs, xcelium}_fsdb.tcl` file. | |
FUSESOC_CORE | This is the testbench fusesoc .core name that contains the simulation target. This .core file is typically placed in the same directory as the test Makefile. | |
-COMPILE_KEY | Users need to define COMPILE_KEY sets for building Test Makefile, CL with a unique sets of compile time options. This is to be done in the Test Makefile in this way: <br>ifeq (${COMPILE_KEY},foo) <br> BUILD_OPTS += +define+FOO <br>endif<br> There is a 'default' compile key already added which implies no additional compile time options are required. Within each test specification, the COMPILE_KEY can be overridden to use the specific compile key. <br>ifeq (${TEST_NAME},foo_test)<br> COMPILE_KEY = foo )<br> # other test opts <br>endif | O (Within tests, & command line) |
+COMPILE_KEY | Users need to define COMPILE_KEY sets for building Test Makefile, CL with a unique sets of compile time options. This is to be done in the Test Makefile in this way: <br>`ifeq ($(COMPILE_KEY),foo)`<br>  `BUILD_OPTS += +define+FOO` <br>`endif`<br> There is a 'default' compile key already added which implies no additional compile time options are required. Within each test specification, the COMPILE_KEY can be overridden to use the specific compile key. <br>`ifeq ($(TEST_NAME),foo_test)`<br>  `COMPILE_KEY = foo` <br>  `# other test opts` <br>`endif` | O (Within tests, & command line) |
UVM_TEST | SV UVM test class to create in the test. This is set to the 'base_test' by default and is overridden in the test specifications if needed. | O (Test Makefile) |
UVM_TEST_SEQ | SV UVM test sequence to create in the test. This is set to the 'base_test' by default and is overridden in the test specifications if needed. | O (Test Makefile) |
TEST_NAME | Name of the test to run. These are specified in the test Makefile. By default, it is set to run the sanity test (simply calling 'make' will run this test). | O (command line only) |
@@ -50,7 +51,7 @@
BUILD_OPTS | Options to pass for build. | A (Test Makefile :: COMPILE_KEY specifications only) |
CL_BUILD_OPTS | Pass additional build options on the command line. | A (command line only) |
RUN_OPTS | Options to pass for run. | A (Test Makefile :: test specifications only) |
-CL_RUN_OPTS | Pass additional run options on the command line. | A (command line only |)
+CL_RUN_OPTS | Pass additional run options on the command line. | A (command line only) |
WAVES | Enable wave dumps (fsdb). Set to 0 by default; override with WAVES=1. | O |
SIMPROFILE | Turn on sim profiling (time option by default). Set to 0 by default; override with SIMPROFILE=1. | O |
COV | Turn on coverage collection. Set to 0 by default; override with COV=1. | O |
@@ -93,37 +94,46 @@
are completely agnostic to the tools used. It sequences the build and run set
of targets.
-### vcs.mk
-#### VCS tool specific options
-The top level Makefile uses `SIMULATOR` variable (which is set to vcs by
+### Simulator mk ({vcs, xcelium}.mk)
+#### Simulator tool specific options
+The top level Makefile uses `SIMULATOR` variable (which is set to `vcs` by
default) to enable tool specific options. If support for new tools need to be
added, then those tool specific mk files need to be supplied. It sets the
following mandatory variables - `SIMCC` & `SIMX`. It also exports additional
tool specific variables to the sub shell when the recipes are executed. This
-file has been placed in the $VCS_PRIV_DIR directory, which is outside of this
-OpenTitan repo. The reason for that is it contains sensitive tool specific
-options that cannot be exposed. The private repo specific to VCS tools (TBD)
-needs to be cloned and the path to the directory containing this file needs
-to be set with `VCS_PRIV_DIR` environment variable prior to invoking the
-simulation.
+file has been placed in the respective tool directory.
### Simulation targets
+* **build**: Compile and elaborate the testbench
+* **gen_sv_flist**: Generate the full file list which will be used by the
+ simulator to build the simulation executable
+* **run**: Run the test (the simulation executable needs to be built already)
+* **env/\<ip\>_reg_block.sv**: Generate the RAL model only
+* **sw_build**: Only compile the C SW test
### Building and running tests
All of the below command examples are to be run from the 'dv' directory
containing the Test Makefile.
##### Run the following command to build and run tests:
-```make TEST_NAME=[test-name] [overrides]```
+```console
+$ make TEST_NAME=[test-name] [overrides]
+```
##### To only buld the simv:
-```make build TEST_NAME=[test-name] [overrides]```
+```console
+$ make build TEST_NAME=[test-name] [overrides]
+```
##### To run the sim after build is complete:
-```make run TEST_NAME=[test-name] [overrides]```
+```console
+$ make run TEST_NAME=[test-name] [overrides]
+```
##### To build and run the sanity test:
-```make```
+```console
+$ make
+```
This will work provided user has specified a set a 'default' value to the
`TEST_NAME` Make variable.
@@ -131,16 +141,24 @@
###### Build and run a test:
This builds the 'default' compile key and runs the 'uart_sanity' test
-```make TEST_NAME=uart_sanity```
+```console
+$ make TEST_NAME=uart_sanity
+```
###### Run with specific seed:
-```make TEST_NAME=<test-name> SEED=123423334```
+```console
+$ make TEST_NAME=<test-name> SEED=123423334
+```
###### Dump waves:
-```make TEST_NAME=<test-name> SEED=123423334 WAVES=1```
+```console
+$ make TEST_NAME=<test-name> SEED=123423334 WAVES=1
+```
###### Run with coverage option enabled:
-```make TEST_NAME=<test-name> COV=1```
+```console
+$ make TEST_NAME=<test-name> COV=1
+```
The options.mk file lists several tool options passed to the build and run steps
for enabling coverage collection. One of the options is adding a hier file (with
@@ -150,29 +168,57 @@
(or with another name), it can be placed anywhere as the user desires and user can
add the following line to the Test Makefile:
-```CM_HIER := <path-to-hier-file```
+```gnumake
+CM_HIER := <path-to-hier-file
+```
###### Enable sim profiling:
-```make TEST_NAME=<test-name> SIMPROFILE=1```
+```console
+$ make TEST_NAME=<test-name> SIMPROFILE=1
+```
###### Override UVM verbosity:
-```make TEST_NAME=<test-name> WAVES=1 UVM_VERBOSITY=UVM_DEBUG```
+```console
+$ make TEST_NAME=<test-name> WAVES=1 UVM_VERBOSITY=UVM_DEBUG
+```
-###### Build only:
-This will build the 'default' compile key
-```make build```
+###### Build only (This will build the 'default' compile key):
+```console
+$ make build
+```
###### Build 'foo' compile key instead:
-```make build COMPILE_KEY=foo```
+```console
+$ make build COMPILE_KEY=foo
+```
###### Build with 'FOO' preprocessor flag:
-```make build CL_BUILD_OPTS+=+define+FOO```
+```console
+$ make build CL_BUILD_OPTS+=+define+FOO
+```
###### Run with 'FOO' runtime plusarg:
-```make TEST_NAME=<test-name> CL_RUN_OPTS+=+FOO```
+```console
+$ make TEST_NAME=<test-name> CL_RUN_OPTS+=+FOO
+```
-###### Run only:
-This assumes the simv executable for the specified compile key is available in
-the default directory and will use it to run the test
+###### Run test with Xcelium:
+```
+$ make TEST_NAME=<test-name> SIMULATOR=xcelium
+```
-```make run TEST_NAME=<test-name> SEED=123423334 WAVES=1```
+###### Run test with Xcelium and dump WAVES in fsdb:
+```console
+$ make TEST_NAME=<test-name> SIMULATOR=xcelium WAVES=1
+```
+
+###### Run test with Xcelium and dump WAVES in shm:
+```console
+$ make TEST_NAME=<test-name> SIMULATOR=xcelium WAVES=1 DUMP=shm
+```
+
+###### Run only (This assumes the sim executable for the specified compile key is available):
+
+```console
+$ make run TEST_NAME=<test-name> SEED=123423334 WAVES=1
+```
diff --git a/hw/dv/tools/modes.mk b/hw/dv/tools/modes.mk
index c515fa0..c359b4c 100644
--- a/hw/dv/tools/modes.mk
+++ b/hw/dv/tools/modes.mk
@@ -19,15 +19,19 @@
# Enable UVM trace options
UVM_TRACE ?= 0
ifeq (${UVM_TRACE},1)
- RUN_OPTS += +UVM_PHASE_TRACE
- RUN_OPTS += +UVM_CONFIG_DB_TRACE
- RUN_OPTS += +UVM_OBJECTION_TRACE
+ RUN_OPTS += +UVM_PHASE_TRACE
+ RUN_OPTS += +UVM_CONFIG_DB_TRACE
+ RUN_OPTS += +UVM_OBJECTION_TRACE
endif
-
# Options for generating waves / debugging.
-WAVES ?= 0
+WAVES ?= 0
+DUMP ?= fsdb
+DUMP_FILE ?= waves.${DUMP}
export WAVES
+export DUMP
+export DUMP_FILE
+
ifeq (${WAVES},1)
ifeq (${SIMULATOR},vcs)
VCS_WAVES = 1
@@ -39,6 +43,8 @@
ifeq (${SIMPROFILE},1)
ifeq (${SIMULATOR},vcs)
VCS_SIMPROFILE = 1
+ else ifeq (${SIMULATOR},xcelium)
+ XCELIUM_SIMPROFILE = 1
endif
endif
@@ -47,5 +53,7 @@
ifeq (${COV},1)
ifeq (${SIMULATOR},vcs)
VCS_COV = 1
+ else ifeq (${SIMULATOR},xcelium)
+ XCELIUM_COV = 1
endif
endif
diff --git a/hw/dv/tools/vcs/cover.cfg b/hw/dv/tools/vcs/cover.cfg
new file mode 100644
index 0000000..875dd0f
--- /dev/null
+++ b/hw/dv/tools/vcs/cover.cfg
@@ -0,0 +1,5 @@
++tree tb.dut
+begin tgl(portsonly)
+ -tree tb
+ +tree tb.dut 1
+end
diff --git a/hw/dv/tools/vcs/vcs.mk b/hw/dv/tools/vcs/vcs.mk
new file mode 100644
index 0000000..689b553
--- /dev/null
+++ b/hw/dv/tools/vcs/vcs.mk
@@ -0,0 +1,98 @@
+####################################################################################################
+## Copyright lowRISC contributors. ##
+## Licensed under the Apache License, Version 2.0, see LICENSE for details. ##
+## SPDX-License-Identifier: Apache-2.0 ##
+####################################################################################################
+## Makefile option groups that can be enabled by test Makefile / command line. ##
+## These are generic set of option groups that apply to all testbenches. ##
+####################################################################################################
+# Simulator too specific options
+# Mandatory items to set (these are used by rules.mk):
+# SIMCC - Simulator compiler used to build / elaborate the bench
+# SIMX - Simulator executable used to run the tests
+
+SIMCC := vcs
+SIMX ?= ${BUILD_DIR}/simv
+SIM_SETUP ?= ${MAKE_ROOT}/vcs/vcs_fsdb.tcl
+
+# set standard build options
+BUILD_OPTS += -sverilog -full64 -licqueue -lca -timescale=1ns/1ps -kdb
+BUILD_OPTS += -ntb_opts uvm-1.2
+BUILD_OPTS += -Mdir=${BUILD_DIR}/simv.csrc
+BUILD_OPTS += -l ${BUILD_LOG}
+BUILD_OPTS += -o ${SIMX}
+BUILD_OPTS += -f ${SV_FLIST}
+BUILD_OPTS += +incdir+${BUILD_DIR}
+BUILD_OPTS += -debug_access+pp
+BUILD_OPTS += +warn=noLCA_FEATURES_ENABLED
+BUILD_OPTS += +warn=noLCA_FEATURES_WARN_OPTION
+BUILD_OPTS += +warn=noUII-L
+# turn on warnings if functions are called with return value ignored
+BUILD_OPTS += +warn=SV-NFIVC
+# option below is required for $error / $fatal system calls
+BUILD_OPTS += -assert svaext
+
+# set standard run options
+RUN_OPTS += -licqueue -lca
+RUN_OPTS += -ucli -do ${SIM_SETUP}
+RUN_OPTS += +ntb_random_seed=${SEED}
+RUN_OPTS += +UVM_VERBOSITY=${UVM_VERBOSITY}
+RUN_OPTS += +UVM_TESTNAME=${UVM_TEST}
+RUN_OPTS += +UVM_TEST_SEQ=${UVM_TEST_SEQ}
+RUN_OPTS += -l ${RUN_LOG}
+RUN_OPTS += +warn=noLCA_FEATURES_ENABLED
+
+#########################
+## Tool Specific Modes ##
+#########################
+
+# Enable simulation profiling
+VCS_SIMPROFILE ?= 0
+ifeq (${VCS_SIMPROFILE},1)
+ BUILD_OPTS += -simprofile
+ RUN_OPTS += -simprofile time
+endif
+
+# Enable waves
+VCS_WAVES ?= 0
+ifeq (${VCS_WAVES},1)
+ BUILD_OPTS += -debug_access+all
+endif
+
+# Enable coverage
+VCS_COV ?= 0
+ifeq (${VCS_COV},1)
+ COV_METRICS ?= line+cond+fsm+tgl+branch+assert
+ BUILD_OPTS += -cm ${COV_METRICS}
+ CM_HIER ?= ${MAKE_ROOT}/vcs/cover.cfg
+ # Add -cm_hier switch if ${CM_HIER} file exists
+ BUILD_OPTS += $(shell if [ -f ${CM_HIER} ]; then echo "-cm_hier ${CM_HIER}"; fi)
+ # Cover all continuous assignments
+ BUILD_OPTS += -cm_line contassign
+ # Dump toggle coverage on mdas, array of structs and on ports only
+ BUILD_OPTS += -cm_tgl mda+structarr+portsonly
+ # Ignore initial blocks for coverage
+ BUILD_OPTS += -cm_report noinitial
+ # Filter unreachable/statically constant blocks
+ BUILD_OPTS += -cm_noconst
+ # Don't count coverage that's coming from zero-time glitches
+ BUILD_OPTS += -cm_glitch 0
+ # Ignore warnings about not applying cm_glitch to path and FSM
+ BUILD_OPTS += "+warn=noVCM-OPTIGN"
+ # Coverage database output location
+ BUILD_OPTS += -cm_dir ${BUILD_DIR}/cov.vdb
+
+ RUN_OPTS += -cm ${COV_METRICS}
+ # Same directory as build
+ RUN_OPTS += -cm_dir ${BUILD_DIR}/cov.vdb
+ # Don't output cm.log which can be quite large
+ RUN_OPTS += -cm_log /dev/null
+ # Provide a name to the coverage collected for this test
+ RUN_OPTS += -cm_name ${TEST_NAME}_${RUN_LOC}_${SEED}
+ # Don't dump all the coverage assertion attempts at the end of simulation
+ RUN_OPTS += -assert nopostproc
+endif
+
+# env variables to be exported for VCS
+export VCS_ARCH_OVERRIDE := linux
+export VCS_LIC_EXPIRE_WARNING := 1
diff --git a/hw/dv/tools/vcs/vcs_fsdb.tcl b/hw/dv/tools/vcs/vcs_fsdb.tcl
new file mode 100644
index 0000000..2a5af6d
--- /dev/null
+++ b/hw/dv/tools/vcs/vcs_fsdb.tcl
@@ -0,0 +1,35 @@
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+
+# TCL file invoked from VCS's simv at run-time using this: -ucli -do <this file>
+
+# Syntax: fsdbDumpvars [depth] [instance] [option]*
+##############################################################################
+# Option Description
+##############################################################################
+# +mda Dumps memory and MDA signals in all scopes.
+# +packedmda Dumps packed signals
+# +struct Dumps structs
+# +skip_cell_instance=mode Enables or disables cell dumping
+# +strength Enables strength dumping
+# +parameter Dumps parameters
+# +power Dumps power-related signals
+# +trace_process Dumps VHDL processes
+# +no_functions Disables dumping of functions
+# +sva Dumps assertions
+# +Reg_Only Dumps only reg type signals
+# +IO_Only Dumps only IO port signals
+# +by_file=<filename> File to specify objects to add
+# +all Dumps memories, MDA signals, structs, unions,power, and packed structs
+
+if {[info exists ::env(WAVES)]} {
+ if {$::env(WAVES) == 1} {
+ fsdbDumpfile $::env(DUMP_FILE)
+ fsdbDumpvars 0 $::env(TB_TOP) +all
+ fsdbDumpSVA 0 $::env(TB_TOP)
+ }
+}
+
+run
+quit
diff --git a/hw/dv/tools/xcelium/xcelium.mk b/hw/dv/tools/xcelium/xcelium.mk
new file mode 100644
index 0000000..c82617b
--- /dev/null
+++ b/hw/dv/tools/xcelium/xcelium.mk
@@ -0,0 +1,51 @@
+####################################################################################################
+## Copyright lowRISC contributors. ##
+## Licensed under the Apache License, Version 2.0, see LICENSE for details. ##
+## SPDX-License-Identifier: Apache-2.0 ##
+####################################################################################################
+## Makefile option groups that can be enabled by test Makefile / command line. ##
+## These are generic set of option groups that apply to all testbenches. ##
+####################################################################################################
+# Simulator too specific options
+# Mandatory items to set (these are used by rules.mk):
+# SIMCC - Simulator compiler used to build / elaborate the bench
+# SIMX - Simulator executable used to run the tests
+
+SIMCC := xrun -elaborate
+SIMX ?= xrun
+SIM_SETUP ?= ${MAKE_ROOT}/xcelium/xcelium_$(DUMP).tcl
+
+# max number of errors before the run is stopped
+ERROR_MAX := 50
+# set standard build options
+BUILD_OPTS += -l ${BUILD_LOG}
+BUILD_OPTS += -access +r
+BUILD_OPTS += -messages
+BUILD_OPTS += -errormax ${ERROR_MAX}
+BUILD_OPTS += -sv
+BUILD_OPTS += -timescale 1ns/1ps
+BUILD_OPTS += +incdir+${UVM_HOME}/src
+BUILD_OPTS += ${UVM_HOME}/src/uvm.sv
+BUILD_OPTS += -f ${SV_FLIST}
+
+# set standard run options
+RUN_OPTS += -input ${SIM_SETUP}
+RUN_OPTS += +SVSEED=${SEED}
+RUN_OPTS += +UVM_VERBOSITY=${UVM_VERBOSITY}
+RUN_OPTS += +UVM_TESTNAME=${UVM_TEST}
+RUN_OPTS += +UVM_TEST_SEQ=${UVM_TEST_SEQ}
+RUN_OPTS += -l ${RUN_LOG}
+RUN_OPTS += -xmlibdirname ${SV_FLIST_GEN_DIR}/xcelium.d -R
+
+#########################
+## Tool Specific Modes ##
+#########################
+# Enable simulation profiling
+XCELIUM_SIMPROFILE ?= 0
+ifeq (${XCELIUM_SIMPROFILE},1)
+endif
+
+# Enable coverage
+XCELIUM_COV ?= 0
+ifeq (${XCELIUM_COV},1)
+endif
diff --git a/hw/dv/tools/xcelium/xcelium_fsdb.tcl b/hw/dv/tools/xcelium/xcelium_fsdb.tcl
new file mode 100644
index 0000000..7f699cb
--- /dev/null
+++ b/hw/dv/tools/xcelium/xcelium_fsdb.tcl
@@ -0,0 +1,33 @@
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+
+# Syntax: fsdbDumpvars [depth] [instance] [option]*
+##############################################################################
+# Option Description
+##############################################################################
+# +mda Dumps memory and MDA signals in all scopes.
+# +packedmda Dumps packed signals
+# +struct Dumps structs
+# +skip_cell_instance=mode Enables or disables cell dumping
+# +strength Enables strength dumping
+# +parameter Dumps parameters
+# +power Dumps power-related signals
+# +trace_process Dumps VHDL processes
+# +no_functions Disables dumping of functions
+# +sva Dumps assertions
+# +Reg_Only Dumps only reg type signals
+# +IO_Only Dumps only IO port signals
+# +by_file=<filename> File to specify objects to add
+# +all Dumps memories, MDA signals, structs, unions,power, and packed structs
+
+if {[info exists ::env(WAVES)]} {
+ if {$::env(WAVES) == 1} {
+ call fsdbDumpfile $::env(DUMP_FILE)
+ call fsdbDumpvars 0 $::env(TB_TOP) +all
+ call fsdbDumpSVA 0 $::env(TB_TOP)
+ }
+}
+
+run
+quit
diff --git a/hw/dv/tools/xcelium/xcelium_shm.tcl b/hw/dv/tools/xcelium/xcelium_shm.tcl
new file mode 100644
index 0000000..24eef75
--- /dev/null
+++ b/hw/dv/tools/xcelium/xcelium_shm.tcl
@@ -0,0 +1,13 @@
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+
+if {[info exists ::env(WAVES)]} {
+ if {$::env(WAVES) == 1} {
+ database -open -default -shm $::env(DUMP_FILE)
+ probe -all -depth all -shm
+ }
+}
+
+run
+quit