Commit graph

688 commits

Author SHA1 Message Date
Greg Chadwick
5fe158e222 [dv] Fix csr_description file
This adds a couple of missing fields to cpuctrl and comments out mcause.
mcause will be added back once RISC-V DV has been updated to support
WARL fields properly.
2022-07-26 09:22:00 +01:00
Greg Chadwick
c2a7af870a [dv] Pass end_signature_addr to generate test step
The CSR test generation needs to know end_signature_addr. Previously
this wasn't being passed to the test generator so CSR tests just looped
forever.
2022-07-26 09:22:00 +01:00
Harry Callahan
83ac7a94d2 Don't check MCAUSE[31] in debug_mode to identify sync/async trap
Interrupts are disabled in Debug Mode (Sdext 4.1.2), and simultaneously
registers, including MCAUSE, are not updated by exceptions (Sdext 4.1.3),
so reading MCAUSE[31] after an exception (eg. invalid instruction) in
debug_mode may still report the previous cause (which could be an interrupt).
2022-07-25 22:27:47 +01:00
Harry Callahan
8beddf5e8a Rework spike_cosim::step() to handle exception on 1st ISR instr
Seperate concerns so the flow of stepping spike and checking against
the ibex RVFI data is clearer. One 'step' of either system produces
different amounts of progress, and this conditional-checking-and-stepping
is needed to tie up the flows.
2022-07-25 22:27:47 +01:00
Canberk Topal
1e613cc7f4 [cosim,dv] Add support to set mcount registers
Extends RVFI connections further to include 30 mhpmcounterX registers.
Sets them up before every cosim step to let Spike know their real values.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-07-25 08:51:31 +01:00
Canberk Topal
a6c182e7be [dv,test] Fix race condition to catch ecall
We already have a clocking block inside dut_if. This commit uses it
to avoid a race condition that happens when `instr_valid_i` goes high
while `ecall_insn_i` goes low.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-07-22 19:26:40 +03:00
Canberk Topal
d84cd116c2 [dv,test] Enable FENCE.I instruction generation
Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-07-22 19:26:40 +03:00
Canberk Topal
ec7706cc9f [dv,fcov] Fix collecting non-waking IRQs in WFI
We were not being able to hit the bin because in order to do that
we needed to have a posedge clk when the condition happened. Now,
we are latching the condition to register it after we wake up from
sleep.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-07-22 19:26:40 +03:00
Canberk Topal
dfca76f386 [dv,fcov] Implement Misaligned Mem Error coverage
Adds some signal to the load store unit to catch when we have the
fetch error signals from both first and second part of the misaligned
load/store access cases.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-07-21 01:02:15 +03:00
Greg Chadwick
1ea89a423b [dv] Fix traps in simple system cosim
Previously any traps seen on RVFI were skipped over. This was old
behaviour. With the latest cosim setup traps must be passed to the
`step` function.
2022-07-19 16:44:53 +01:00
Harry Callahan
42d92c7c9b Create riscv_assorted_traps_interrupts_debug_test
Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
2022-07-15 14:09:36 +01:00
Harry Callahan
5bba52713f Fix randomize bug, add assertion for cnt != 0 2022-07-15 12:45:42 +01:00
Harry Callahan
806989a745 Commenting UVM testbench code, tidy formatting, minor refactoring
- Adds comments for quicker explanation of test and library functionality
- Refactor types and naming of control knob signals for clarity
- Move constraints from MEMBER to CLASS for more flexibility
- Add missing license header

Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
2022-07-15 12:45:42 +01:00
Marno van der Maas
3459d7f8df [lint] Remove whitespace from non-vendored source files
Signed-off-by: Marno van der Maas <mvdmaas+git@lowrisc.org>
2022-07-14 15:59:34 +01:00
Canberk Topal
7ba6667f32 [dv] Check privilege after DRET
Timing fix for dret_test and modelling controller behaviour for FLUSH transition.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-07-12 18:02:02 +03:00
Greg Chadwick
ab510f8acf [dv/doc] Tweaks/fixes to functional coverage
This fixes up some minor issues in the functional coverage plan and
implemented cover points
2022-07-11 12:10:55 +01:00
Canberk Topal
5c49fad9a2 [fcov] Adding debug related functional coverage
Includes coverpoints for:

- Hardware trigger point matches
- Debug simple step entrance in controller
- Seeing different insns while single stepping

Also updates on coverage plan to fill up missing mentions of
coverpoints/crosses

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-06-29 16:02:53 +03:00
Harry Callahan
81590d86c2 Fix multi-line string formatting in $sformatf for uvm_fatal macro
Before the change the indentation of the second line would be printed as spaces
in the fatal message.
2022-06-09 16:34:08 +01:00
Harry Callahan
15230d2c86 Subprocess timeout feature
Sometimes spike does not terminate when you might expect.
This is a bit of a hack to get CI dailies to fail in a reasonable time.
2022-06-09 16:33:56 +01:00
Pirmin Vogel
f71b23ddf8 Update google_riscv-dv to google/riscv-dv@0b2b3d6
Update code from upstream repository https://github.com/google/riscv-
dv to revision 0b2b3d65ce8fdff4de8974d1f328a90d6c1db5dd

* [epmp] Add support for mseccfg CSR (Pirmin Vogel)

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2022-06-09 09:00:42 +02:00
Rupert Swarbrick
9b68b5ef14 [dv,core_ibex] Allow instructions near the top of initialised IMEM
If you call the read() function on the memory model with an
uninitialised word, it generates a UVM error.

This is reasonable for data memory (where we never want to read
something without an architectural value) but is not reasonable for
IMEM, where Ibex runs ahead. Squash the error in this case, but force
bad integrity for the fetch to make sure we see something explode.
2022-06-01 14:02:45 +01:00
Canberk Topal
c253bd76a9 [dv] PMP related functional coverage points
Adding MSECCFG CSR related functionality also some write checks etc.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-06-01 13:25:09 +01:00
Pirmin Vogel
e1f614887e Update spike_cosim.cc to be able to build against newer Spike versions
This works with versions ibex-cosim-v0.2 and ibex-cosim-v0.3. The latter
version is required to support the mseccfg CSR added with ePMP.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2022-06-01 00:50:49 +02:00
Canberk Topal
57d810e7fe [fcov] Implementing interrupts section of covplan
Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-05-30 15:56:05 +01:00
Canberk Topal
3b2e792a53 [fcov] Cross for Decoded Insn and Controller FSM
Bins are defined specifically for interested cases implied in coverage
plan.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-05-25 13:37:30 +01:00
Canberk Topal
1ad55daf96 [dv] Randomize mstatus.mprv properly
Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-05-25 13:37:30 +01:00
Canberk Topal
c2f5fea8a9 [fcov] MPRV with Load/Store and RAW Hazard
Added in functional coverage interface

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-05-25 13:37:30 +01:00
Canberk Topal
51bcae432b [rtl] PMP Logic Refactoring
This makes use of functions in a way that enables us to use `priv_lvl`
dependent logic in the DV environment.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-05-25 13:37:30 +01:00
Canberk Topal
04ce927a74 [fcov] Add various coverage points
Mostly related to WFI, but also double fault and icache enable

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-05-25 13:37:30 +01:00
Canberk Topal
f21b6545ac [fcov] CSR related coverage points
Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-05-25 13:37:30 +01:00
Canberk Topal
11002708ea xlm support for PMP coverage groups
Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-05-25 13:37:30 +01:00
Harry Callahan
c5567e8f66 Change makefile default simulator for core_ibex dv to xcelium 2022-05-23 17:24:12 +01:00
Rupert Swarbrick
6efb4b1597 Dump riscv-dv generation messages to a log file
I was previously just dumping them to /dev/null because the
code always worked but... predictably I was wrong! Write them
somewhere more useful for debug.
2022-05-19 17:34:41 +01:00
Rupert Swarbrick
efd289dc17 [core_ibex] Disable waves by default
This seems like something you'd want to enable explicitly, to avoid
filling up a disk on a big run.
2022-05-17 12:04:26 +01:00
Rupert Swarbrick
09d2dd2306 Update ISA strings from Xbitmanip to XZb*
This allows us to model stuff more closely. This depends on Spike
version ibex-cosim-v0.2 (which is rebased onto a master branch commit
supporting these more specific ISA strings).
2022-05-13 09:47:00 +01:00
Harry Callahan
832259401e Add warning when cosim is disabled by a plusarg
May aid in debugging
2022-05-12 11:01:36 +01:00
Harry Callahan
ef3549a2d3 Add pre_abort callback to cosim scoreboard for proper cleanup 2022-05-12 11:01:36 +01:00
Greg Chadwick
a0adf60d0b [dv] Fix bitmanip test building 2022-05-12 10:42:15 +01:00
Harry Callahan
0c38b203dd Run core_ibex dv with cosim by default 2022-05-11 15:46:46 +01:00
Harry Callahan
36129a2cb1 Modify existing comparison scripts to process cosim trace
Don't yet tear out the old logfile-comparision code, add a new path for the
cosim flow.

This uses the existing riscv-dv functions to parse the cosim logfile, as it is
fundamentally still generated by spike so should be checked for errors.
2022-05-11 15:46:46 +01:00
Harry Callahan
e34bb4d92f Construct compile-tb cmds to link against ISS for cosim
This is a continuation of PR's #1613 and #1575 work.

If cosim in enabled, we need to pass the appropriate flags to the eda tool for
it to link against the precompiled ISS when building the testbench.
This commit assembles the appropriate flags using pkg-config to query the
SPIKE_ISS build, then uses the scripts_lib.subst_vars() method to populate the
templated commands in the yaml.

The eda tools have different requirements for consuming the flags, so massage
them into the appropriate shape on the python side.
2022-04-29 11:13:21 +01:00
Harry Callahan
345dd6644b Fix variable-checking in makefile 2022-04-29 11:13:21 +01:00
Harry Callahan
d4c945622e Replace concatenation with mask operations
Make Xcelium happy
Add leading zero for readability (Addresses PR comment)
2022-04-29 11:13:21 +01:00
Rupert Swarbrick
42ce56b6b6 [dv] Simplify instructions for how to use Spike with cosim
This depends on Spike version ibex-cosim-v0.2 (which exposes the
various library headers with pkg-config, making configuration much
easier).
2022-04-29 11:13:21 +01:00
Canberk Topal
394a0d2160 Updating parameters for OpenTitan option
Updated the parameters with respect to top_earlgrey.hjson in OpenTitan
repository. For other builds, kept the previously undeclared parameters
as their default values.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-04-28 15:14:42 +01:00
Rupert Swarbrick
2f28987916 Remove some unused variables from core_ibex Makefile 2022-04-28 13:52:07 +01:00
Rupert Swarbrick
26f824b907 Infer PMP config from Ibex config in core_ibex scripts 2022-04-28 13:52:07 +01:00
Rupert Swarbrick
f6f84b0b06 Read config data in 2 steps in core_ibex scripts
No functional change, but this means we can look at the configuration
object to do other stuff without having to reload things.
2022-04-28 13:52:07 +01:00
Rupert Swarbrick
ecdb1e01f6 Remove ISA, ISA_ISS from Makefile
Move their calculation into the Python scripts, which means that we
don't have to make sure everything is kept in sync.
2022-04-27 16:33:49 +01:00
Rupert Swarbrick
b63ab3b120 Strengthen types in ibex_config.py
This should make it easier for other scripts to use
parse_config().
2022-04-27 16:33:49 +01:00