Commit graph

361 commits

Author SHA1 Message Date
Rupert Swarbrick
210634586d Fix last verilator warning for ibex_simple_system; add waiver
If you just build simple_system a fusesoc line like

  fusesoc --cores-root=. run --target=sim --setup \
          --build lowrisc:ibex:ibex_simple_system

then the change to ibex_simple_system.sv suffices, but if you
explicitly set a parameter in fusesoc like this:

  fusesoc --cores-root=. run --target=sim --setup \
          --build lowrisc:ibex:ibex_simple_system \
		  --RV32M=1

then it overrides the default parameter with a literal 1. We declare
the parameter as an 'int', so I guess that's quite a reasonable
behaviour from fusesoc. Anyway, this check only triggers when a 1-bit
parameter is set with a literal 1, so should be safe. (If you do
something buggy like setting it to 2, it will still moan at you). This
patch adds a waiver file in examples/simple_system that silences the
warning.

This patch also makes the equivalent change to riscv_compliance,
adding a waiver file in dv/riscv_compliance/lint and fixing up the
default parameters.
2020-03-03 11:35:07 +00:00
Rupert Swarbrick
53ecd9770d Simplify the logic in check_ibex_uvm_log
Also fix a minor nit: if something had gone really weird and we saw
a pass message followed by a fail message, the previous code would
have treated the test as a pass. Now it is treated as a failure.
2020-03-03 09:04:34 +00:00
Rupert Swarbrick
88a1859616 Make ibex_log_to_trace_csv.py PEP8 compliant
This is mostly just re-indentation and being explicit about what we're
importing from what module, which allows Python lint tools (flake8 and
similar) to spot when there's a typo in a variable name or similar.
2020-03-03 09:04:34 +00:00
Rupert Swarbrick
d260dea927 Simplify usage of ibex_log_to_trace_csv.py
The previous version died with a confusing error if you ran it with no
arguments (because the compulsory input and output file paths are
specified as --option arguments).

I've left the arguments optional, but they now default to
stdin/stdout (which means you can now use this script in a pipe).

I've also reformatted the code I touched to look a little more like
PEP8 Python.
2020-03-03 09:04:34 +00:00
Rupert Swarbrick
d20281ca1b Allow ibex_log_to_trace_csv.py to run from other directories
The updated sys.path was wrong because it was based on current
directory, rather than __file__.
2020-03-03 09:04:34 +00:00
Rupert Swarbrick
7df14341ef Avoid unneccessary rebuilding in dv/uvm/core_ibex/Makefile
Before this patch, running the Makefile's default target deleted
everything and then ran the whole flow. This sometimes does
unnecessary work (if I've just changed the design, there's no need to
rebuild and re-run the instruction generator). It also definitely
won't work with Make's -j flag, since it depends on the targets being
built in order.

This patch keeps the same stages in the Makefile, but makes each stage
generate a stamp file, adding dependencies between the stages. This
way, you can make a small change to the design and re-run the
simulation without having to generate the random inputs again.

This doesn't make much difference if you're running lots of tests with
no LSF (since VCS is very slow, its runtime for simulation completely
dominates), but it can make a significant difference if you're
debugging a single test, have made a change to the design and want to
re-run.

One significant change is that running 'make' doesn't automatically
delete existing files any more. To make this possible (and useful!),
we generate random data and test results in a directory keyed by the
seed. For example

  make SEED=123

will generate results in out/seed-123/regr.log (rather than
out/regr.log as before).

To make sure we rebuild things properly if you change something like
the number of iterations or the tests to run, we dump some variables
describing the mode in which we were running. If these don't match the
nnext time around, we'll rebuild stuff if necessary.

Advanced (or hurried) users of the existing Makefile might have done
things like change the design and then run

  make SEED=123 compile rtl_sim

Now, the rtl_sim target depends on its logical dependencies. On the
plus side, this means that you won't accidentally simulate out-of-date
code. On the minus side, cunning tricks to avoid having to re-run
stuff after touching a design file won't work. (If you're feeling
really determined to do something like that, it's still possible with
make -t).

The seed-specific stamp files and dumped Make variables go into
$(OUT-SEED)/.metadata directory, rather than $(OUT-SEED)/instr_gen or
$(OUT-SEED)/rtl_sim. This is because of a review comment (to avoid
extra clutter in the output directories).
2020-03-03 09:04:21 +00:00
Greg Chadwick
5a208a044b [dv] Increase timeouts to fix failures 2020-03-02 09:34:09 +00:00
udinator
8f24ce120a
[dv] fix qrun compile warnings (#639)
Signed-off-by: Udi <udij@google.com>
2020-02-29 15:16:24 -08:00
Rupert Swarbrick
629c0cbab1 Make sim.py less chatty when just compiling the testbench
The process_regression_list function from riscv-dv is really chatty.
When we're just compiling the testbench, we don't actually need to
figure out what tests we're running, since we'll never run them
anyway. So don't call it.
2020-02-29 12:13:15 +00:00
udinator
eee026abec
[dv] remove usage of 0x from sim flow (#638)
Signed-off-by: Udi <udij@google.com>
2020-02-28 17:03:29 -08:00
udinator
d8b9737039
update riscv_core_setting (#633)
Signed-off-by: Udi <udij@google.com>
2020-02-28 17:02:07 -08:00
Rupert Swarbrick
ade643001b
Dump to VPD in dv/uvm if Verdi is not available (#630)
If VERDI_HOME is not set, calling fsdbDumpfile makes VCS hang with an
error message. This patch checks whether we think FSDB dumping is
actually going to work and, if not, dumps with the default VCD+
format (also called VPD) instead.
2020-02-28 09:46:13 +00:00
udinator
24315515f6
Reorganize ibex dv files (#618)
Signed-off-by: Udi <udij@google.com>
2020-02-20 15:56:40 -08:00
udinator
0af48120ba
VCS compile fix (#616)
Signed-off-by: Udi <udij@google.com>
2020-02-20 15:12:50 -08:00
udinator
fc2fb22a7d
[dv] add command line PMP option configurability (#599)
Signed-off-by: Udi <udij@google.com>
2020-02-10 09:24:06 -08:00
udinator
c914ec5e6a
update testlist typo (#593)
Signed-off-by: Udi <udij@google.com>
2020-02-07 11:27:53 -08:00
udinator
d4cb1a30ae
[dv] enable PMP (#588)
Signed-off-by: Udi <udij@google.com>
2020-02-06 11:54:56 -08:00
Pirmin Vogel
2a42c23eaf [rtl] Decouple mip and mie CSRs
This commit modifies the `mip` CSR to not depend on the `mie` CSR. While
the values of both these CSRs are combined to decide whether an
interrupt shall be handled, the RISC-V spec does not state that the
content of of `mip` should depend on `mie`. This commit better aligns
Ibex with other open-source RISC-V cores.

This resolves lowRISC/ibex#567 reported by @pfmooney.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-02-04 16:15:38 +01:00
Tobias Wölfel
6708ba62ac Extend riscv-compliance description
Include all tests in the description which can be executed for Ibex and
riscv-compliance.
2020-02-04 14:56:40 +00:00
Luís Marques
ed8bcc0d33 [verilator] Fix ELF loading
In `VerilatorMemUtil::WriteElfToMem`, the verilator memory is written
with the ELF segment data, 4 bytes at a time . If the segment size isn't
a multiple of 4 (e.g. when using the RISC-V C extension) the last word
wouldn't be written. This patch rounds the size up to a multiple of 4,
solving that issue.
2020-02-03 08:32:13 +00:00
Greg Chadwick
639964514c [RTL] Added seperate ALU for branch target
On branches now compute target same cycle as the condition.  This
removes a stall cycle from all taken conditional branches.
2020-01-31 09:32:20 +00:00
udinator
32a69899a9
[dv] Fix a missed Riviera compile warning (#576)
Signed-off-by: Udi <udij@google.com>
2020-01-30 09:22:45 -08:00
Daniel Mlynek
6d26025019 [DV] Add support for Riviera
Add support to call Riviera for our DV code. Tested with Riviera
2019.10.
2020-01-30 09:27:14 +00:00
Daniel Mlynek
b90b1aa683 Work around Riviera 2019.10 issue
This is a Riviera issue and will be fixed in a next release. Add a
workaround in the meantime.

Riviera issue reference: DZI370
2020-01-30 09:27:14 +00:00
Daniel Mlynek
885ac78583 [DV] Use const instead of parameter
Riviera do not support parameters of dynamic/associate/queue array types.
The SV standard does not say explicitly that such code is legal.
IMHO this code is at least controversial as dynamic nature of such array
types are against static nature of parameters. It would be better to change
this "implemented_csr" from parameter to const.
2020-01-30 09:27:14 +00:00
udinator
2e258c8521
Riviera compile warnings (#572)
* [dv] fix compilation +incdir option

Signed-off-by: Udi <udij@google.com>

* [dv] Fix missing enum cast issues in Riviera compile

Signed-off-by: Udi <udij@google.com>
2020-01-28 15:32:21 -08:00
Daniel Mlynek
9a80025498 Specify boot address in decimal
Riviera cannot parse the file list if it contains a single quotation
mark (TCL parsing is used).
2020-01-28 14:46:48 +00:00
udinator
43752a6c19
[DV] Test debug requests during interrupt handler execution (#565)
Signed-off-by: Udi <udij@google.com>
2020-01-23 16:21:57 -08:00
udinator
f339f6b96b
[DV] Test nested interrupts (#560)
Signed-off-by: Udi <udij@google.com>
2020-01-23 15:11:54 -08:00
udinator
9d7b07f0f7
[DV] Add test to assert interrupts during debug execution (#524) 2020-01-16 11:43:44 -08:00
udinator
80067b077c
[DV] Add riscv-dv target for ML (#556)
Signed-off-by: Udi <udij@google.com>
2020-01-14 14:11:57 -08:00
udinator
0c55214380
Enable coverage collection and merging for Incisive sims (#552)
Signed-off-by: Udi <udij@google.com>
2020-01-10 16:46:33 -08:00
udinator
b318b96964
[DV] update ibex log parsing to match new riscv-dv csv format (#547)
Signed-off-by: Udi <udij@google.com>
2020-01-09 14:46:50 -08:00
Pirmin Vogel
25e0390733 [dv] Add performance monitor counters to CS register TB
This commit adds the performance monitor counters to the CS register
testbench. Mismatches in `mcycle(h)` are currently being ignored as the
cycle counter is expected to increment with every clock cycle (unless
deactivated).

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-01-06 14:21:01 +01:00
Pirmin Vogel
15ec62a356 [dv] Add WARL register class to CS register TB
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-01-06 14:21:01 +01:00
Tobias Wölfel
17d69d1cd6 [DV] Continue argument parsing
In case one of the arguments is '-h' the parsing of the arguments is
aborted and only `PrintHelp()` of *verilator_sim_ctrl.cc* is executed.
Do not abort at this point in order to forward the arguments to the
registered extensions. This allows to execute the respective
`PrintHelp()` function and print the help message. For example
`VerilatorMemUtil` needs to parse the arguments in order to print the
help message.
The execution of the simulation is still terminated as `exit_app` is set
and then evaluated after parsing of the registered extensions.
2020-01-02 14:15:53 +01:00
Bryan Cantrill
6885c9e937 [verilator] Fix ELF processing
As described in https://github.com/lowRISC/opentitan/issues/1245,
the Ibex Verliator ELF processing does not exactly follow the algorithm
for the "binary" target of objcopy (which it is intended to mimic).
In particular, sections as denoted by program headers are laid down
strictly sequentially, ignoring their specified p_paddr -- and
resulting in a corrupted in-memory image for ELF images that have
unordered program headers.
2019-12-31 17:05:23 +01:00
Philipp Wagner
7fe01cc283 SimCtrlExtension: Add a default destructor
This base class needs a default destructor for potential future extensions.

Signed-off-by: Philipp Wagner <phw@lowrisc.org>
2019-12-24 10:08:59 +01:00
Tom Roberts
0a2ca9a399 [verilator] Modify verilator examples for memutils
- Memory loading utilities are split out into a separate class
- Relates to #317
2019-12-23 21:35:30 +01:00
Tom Roberts
e45e314686 [verilator] Separate out memory loading utilities
- Split memory utils out of VerilatorSimCtrl
- Allows VerilatorSimCtrl to be used in systems not requiring memory loading
- Fixes #317
2019-12-23 21:35:30 +01:00
Pirmin Vogel
0778008f33 [rtl] Remove X assignments, add SVAs for selector signals
This commit replaces all X assignments in the RTL with defined
values. In addition, SystemVerilog Assertions are added to catch
invalid signal values in simulation. A new file containing the
corresponding assertion macros is added as well.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-12-20 10:09:09 +01:00
udinator
a28bcfa485
[DV] Fix TB read responses (#531)
Signed-off-by: Udi <udij@google.com>
2019-12-18 10:53:29 -08:00
udinator
7fef1b5afc
[DV] fix incorrect irq_seq handle name (#525)
Signed-off-by: Udi <udij@google.com>
2019-12-16 16:18:47 -08:00
udinator
74e8c3fec6
[DV] update MISA csr yaml description (#513) 2019-12-16 13:39:00 -08:00
udinator
5d66a865cd
[DV] Enable sending multiple interrupts at once (#519) 2019-12-16 13:15:12 -08:00
udinator
c246a2aeb9
[DV] update override to riscv_asm_program gen in Makefile (#520) 2019-12-16 13:13:59 -08:00
Greg Chadwick
328aabb548 [RTL] Only restore from mstack in nmi mode
Fixes #492
2019-12-16 19:51:22 +00:00
udinator
8568e6b3b5 [DV] add support_unaligned_load_store setting (#521)
Signed-off-by: Udi <udij@google.com>
2019-12-13 13:44:18 -08:00
udinator
f23b3f39fa
[DV] Fix xRET wait checks (#515)
Signed-off-by: Udi <udij@google.com>
2019-12-12 11:28:16 -08:00
Tom Roberts
088cd11593 [dbg] Add minimal hardware breakpoint support
- Add the minimum amount of trigger system to support GDB hbreak
- Only a single trigger is implemented
- Only instruction address matching
- Only break into debug mode (no native debug)
- Fixes #382

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2019-12-11 15:02:06 +00:00