Minor rejigs to Makefile dvsim wrapper

This now allows you to specify how many seeds to run. Sadly, you can't
say "give me 10 seeds, starting at 1234" because dvsim doesn't support
that at the moment. But it does at least avoid quite such long command
lines.

Instead of:

    ../../../../vendor/lowrisc_ip/dvsim/dvsim.py \
      ibex_icache_sim_cfg.hjson \
      --scratch-root ../../../../build \
      --reseed 5 \
      -c

you can run:

    make RESEED=5 COVERAGE=1
This commit is contained in:
Rupert Swarbrick 2020-07-22 09:05:48 +01:00 committed by Rupert Swarbrick
parent e8d86ecb96
commit 84bcf4973a
2 changed files with 26 additions and 22 deletions

View file

@ -143,13 +143,17 @@ To do so, we would just need to monitor fetches in the memory agent as well as s
## Building and running tests
Tests are built and run with the [`dvsim`](https://github.com/lowRISC/ibex/tree/master/vendor/lowrisc_ip/dvsim) tool (vendored in from the OpenTitan project).
To run a basic sanity test:
To ensure output files end up in the right place without ugly command lines, this is wrapped up in a Makefile.
To run the test suite, run:
```console
$ cd dv/uvm/icache/dv
$ dvsim.py icache_sim_cfg.hjson -i ibex_icache_sanity
$ make -C dv/uvm/icache/dv
```
For more complicated use cases (enabling wave dumps, coverage, specific seeds), there are some options in the Makefile.
For very specific use cases, you'll need to run dvsim.py directly.
The easiest way to get an initial command to edit is to run `make -n`.
## Testplan
This will be generated from [`dv/uvm/icache/data/ibex_icache_testplan.hjson`](https://github.com/lowRISC/ibex/blob/master/dv/uvm/icache/data/ibex_icache_testplan.hjson), but is not automatically included in this document at the moment because we haven't got the tooling set up to do so.

View file

@ -3,8 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
# Simple wrappers around dvsim.py to avoid needing long command lines. This
# doesn't do any dependency tracking (as you might expect in a Makefile) because
# the dvsim infrastructure doesn't support it.
# doesn't do any dependency tracking (as you might expect in a Makefile).
# Set WAVES to 1 to get wave dumps
WAVES=0
@ -16,34 +15,35 @@ COVERAGE=0
# --verbosity parameter, overriding whatever was set in the hjson file.
VERBOSITY=
# Specify the seed for the test to run. If this is empty, dvsim.py will pick
# random seeds. By default, we make runs reproducible, so force the seed.
SEED=1
# The number of seeds to run for each selected test. Defaults to 1.
RESEED=1
#SIMULATOR
SIMULATOR=vcs
# Specify the seed for the test to run. If this is empty, dvsim.py
# will pick random seeds. By default, we make runs reproducible, so
# force the seed if RESEED is 1.
default-seed := 123
SEED=$(if $(filter 1,$(RESEED)),$(default-seed),)
# Specify which tests to run. Defaults to the empty string, which
# means dvsim will run its default (the "sanity" suite).
TESTS=
ibex-top := ../../../..
scratch-root := $(ibex-top)/build
dvsim-py := $(ibex-top)/vendor/lowrisc_ip/dvsim/dvsim.py
dvsim-std-args := --scratch-root $(scratch-root) --tool $(SIMULATOR)
dvsim-std-args := --scratch-root $(scratch-root)
waves-arg := $(if $(filter-out 0,$(WAVES)),--waves,)
coverage-arg := $(if $(filter-out 0,$(COVERAGE)),-c,)
verbosity-arg := $(if $(VERBOSITY),--verbosity $(VERBOSITY),)
reseed-arg := --reseed $(RESEED)
seed-arg := $(if $(SEED),--fixed-seed $(SEED),)
tests-arg := $(if $(TESTS),--items $(TESTS))
dvsim-mk-args := $(waves-arg) $(coverage-arg) $(verbosity-arg) $(seed-arg)
run-icache-dvsim := $(dvsim-py) ibex_icache_sim_cfg.hjson $(dvsim-std-args) $(dvsim-mk-args)
.PHONY: all
all: run
.PHONY: just-build
just-build:
$(run-icache-dvsim) --build-only
dvsim-mk-args := \
$(waves-arg) $(coverage-arg) $(verbosity-arg) \
$(reseed-arg) $(seed-arg) $(tests-arg)
.PHONY: run
run:
$(run-icache-dvsim)
$(dvsim-py) ibex_icache_sim_cfg.hjson $(dvsim-std-args) $(dvsim-mk-args)