Commit graph

782 commits

Author SHA1 Message Date
Harry Callahan
90daca9765 Bring back +disable_cosim to instead de-escalate fatal to info 2022-08-19 14:45:28 +01:00
Harry Callahan
d5c7b1be02 Remove the final cosim flags from core_ibex uvm environment
We are running with cosim by default now, and no longer support COSIM=0. Hence
this option and all downstream conditional paths are no longer required.
2022-08-19 14:45:28 +01:00
Harry Callahan
781f8445d8 Change method to locate ibex root to relative paths
I had used git to identify the repo root previously but this obviously does not
work with vendoring.
2022-08-19 11:45:52 +01:00
Marno van der Maas
f2f77a3cac [dv] Use lowRISC IP dir from imports instead of re-deriving it
Signed-off-by: Marno van der Maas <mvdmaas+git@lowrisc.org>
2022-08-19 11:45:52 +01:00
Marno van der Maas
6cb528f8ce [dv] Made dedicated gitignore file and add coverage files 2022-08-19 11:39:49 +01:00
Greg Chadwick
2ff233726d [dv] Add sim selection to icache make file 2022-08-18 14:51:23 +01:00
Greg Chadwick
32801e8d12 [dv] Add MCAUSE and MSTATUS to the riscv_csr_test
With the new WARL functionality for the RISCV-DV CSR test generator we
can bring back these CSRs into the test.

Fixes #1663
2022-08-18 13:16:55 +01:00
Harry Callahan
261e9eb3b9 Fix isinstance error with Union types 2022-08-16 14:41:12 +01:00
Harry Callahan
7c8465f9c5 Switch to using pathlib3x to get backported features 2022-08-16 14:41:12 +01:00
Harry Callahan
bb15ce4378 Fix using built-in types as type hints not supported before Python 3.9
This could be reverted later if the required version changes.
2022-08-16 14:41:12 +01:00
Harry Callahan
111d84f549 core_ibex dv build system refactor
As well as completely removing the existing non-cosim flow, this commit
significantly refactors the build system to be less reliant on the makefile.

While we still use the Makefile, it is relegated to only providing scheduling
and dependency calculations between the different build steps.
This is possible by moving all of the build metadata into a file on-disk, which
is populated at the start of a new regression, then read and written to by the
different scripts executing the build. Each build step only needs to be passed
the location of this metadata at the top-level, and it can then import all
the information it requires to calculate and perform the next build stage.

This allows better observability into the build, as it is trivial to add new
data to this file, which is also provided as a human-readable yaml version.
It should also allow easier integration into different build systems, as the
dependency on Make is much weaker.

The file metadata.py and test_run_result.py contain the definitions for
these metadata objects. metadata.py defines an object for the whole
regression, while test_run_result.py defines objects for each individual test
performed.

The file riscvdv_interface.py has been created to better isolate the interface
with that project.
The file setup_imports.py has been created to centralize the importing of
python modules from other projects (riscvdv/ot_lowrisc_ip etc.).
Existing python code has been tidied to better conform to PEP8 standard
formatting, and to be more python in general such as using pathlib.Path.
2022-08-16 14:41:12 +01:00
Greg Chadwick
2f8dfa9dfe [dv] Reduce riscv_pmp_full_random_test iterations
We're seeing many timeouts in this test. This is causing issues for the
nightly regression. Keep the test in so we're aware of any major issues
with it but with far fewer timeouts to help keep the regression healthy.
We'll revisit the required iterations once we've sorted out the issues
with the test.
2022-08-12 17:22:04 +01:00
Greg Chadwick
7e9eef2cf9 [cosim] Pass PMP configuration through to spike 2022-08-11 17:43:34 +01:00
Greg Chadwick
4acc27b7ab [rtl, icache] Rework invalidation logic
This refactors the invalidation control logic into an explicit state
machine. The top-level icache_invalid_o signal is also removed.
Replaced with an explicit scramble key request instead.

This has all been done to better deal with corner cases around a new
invalidation being requested whilst another is still going on.
Previously there was a bug wher an invalidation request in the final
cycle of an ongoing invalidation didn't restart the invalidation but did
rotate the scrambling key producing an ECC failure and an alert.
2022-08-11 09:21:51 +01:00
Harry Callahan
3c1502c979 Add special-case signature for test_done in riscv_csr_test
This test is generated differently to all the others, as it exclusively uses a
python script.
The easiest way to make this work with the new test_done signature address is to
detect it as a special case and pass it the new address. The handshaking is only
used for ending the test, so the original address does not matter.
2022-08-10 14:00:41 +01:00
Harry Callahan
b8c6a343cb Change test_done mechanism to use riscvdv handshake, not ecall
Use the address (signature_addr - 0x4) for a TEST_PASS handshake.
Create new mem_seq_item subscriber port for test_done functionality.

By creating a new, distinct port and subscribing to all incoming memory items,
the existing wait_for_mem_txn() can be used with minor modifications to be
able to choose the port to wait on as an argument to the task.

Because the wait_for_mem_txn() implementation currently uses get() to pop the
latest item from the item_collected queue, having two different forked processes
that both await on this queue is not possible. The simplest solution is to
create a new, seperate port which also subscribes to the sequence_items
broadcast by the mem_if monitor.

Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
2022-08-10 14:00:41 +01:00
Canberk Topal
ae76c62623 [dv,cosim] Add memory region to match UVM env
This extends our memory range to be between 0 and
0xFFFF_FFFF. This is needed because in the case of
no match between UVM memory model and spike memory
model, we see a mismatch.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-08-09 12:19:56 +03:00
Marno van der Maas
0e5bedfff3 [dv,prim] Fix build and assert errors for vendored prim changes
After vendoring the new changes to the prim IP:
- Reorder `ibex_dv.f` to reflect the dependency on `prim_assert.sv`
- Disable assertion for register file prim onehot check.

Signed-off-by: Marno van der Maas <mvdmaas+git@lowrisc.org>
2022-08-05 18:00:25 +01:00
Marno van der Maas
c4a97e05f5 [dv] Locking PMP regions in disable all regions tests 2022-08-03 15:06:03 +01:00
Marno van der Maas
a97f384759 [dv] Allowing DV to disable PMP based on Ibex config
Added a patch for riscv_core_setting.sv, which is applied for the small
and experimental-branch-predictor configs.

Signed-off-by: Marno van der Maas <mvdmaas+git@lowrisc.org>

fixup
2022-08-03 15:06:03 +01:00
Marno van der Maas
5120fdadcc [dv] Add README for Ibex DV
Signed-off-by: Marno van der Maas <mvdmaas+git@lowrisc.org>
2022-08-03 15:06:03 +01:00
Marno van der Maas
ef86c30341 [dv] Write ePMP tests and enable ePMP in DV
- Enable epmp in riscv_core_settings.sv
- Bump CI and Spike version in `ci/vars.yml`
- Enable full random PMP test
- Create tests for machine mode lockdown (MML)
  - Code execute only, rest read/write
  - All regions execute only
  - All regions read only
- Create test for machine mode whitelist policy (MMWP)
- Create test for rule lock bypass (RLB)

Signed-off-by: Marno van der Maas <mvdmaas+git@lowrisc.org>
2022-08-03 15:06:03 +01:00
Canberk Topal
b5820b32c6 [dv,testlist] Enable irq_timer, allow WFI in Umode
This commit sets two different riscv-dv knob to make sure we hit
some holes in our coverpoints.

Activating `enable_timer_irq` for everytime we enable other
interrupts makes sure that we respond to it just like we respond
to other interrupts.

Setting tw=0 makes it so that we would allow WFI in user mode. We
were already randomizing it but for some certain tests, we actually
want to be in a sleep state, which wouldn't happen if tw=0 in user
mode.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-08-03 13:37:52 +01:00
Canberk Topal
cc55c47c37 [dv,core_ibex] Add push_pull agent for Scramble IF
This allows us to actually use Icache in our tests beecause
before this commit key_valid was tied to 0 which means everytime
we receive a FENCE.I instruction, we wouldn't be able to successfully
flag inval_done. Which means we weren't probably using ICache correctly.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-08-03 11:10:28 +01:00
Canberk Topal
e242ef07ad [rtl] Deny no-match X access in M-Mode while MML=1
In ePMP spec, it specifies as:

```
Executing code with Machine mode privileges is only possible from memory
regions with a matching Mmode-only rule or a locked Shared-Region rule
with executable privileges. Executing code from a region without a
matching rule or with a matching S/U-mode-only rule is denied.
```

This change provides that.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-08-03 10:59:40 +01:00
Greg Chadwick
e93452e502 [dv] Make Xcelium wave dumping includes unpacked arrays
In various places within Ibex we use unpacked arrays. We weren't dumping
these in Xcelium.
2022-08-02 15:57:12 +01:00
Canberk Topal
ae399e6454 [dv,fcov] IRQ and NMI detection fixes for fcov
This commit makes sure that different IRQs are collected in a single
`fcov_irqs` bus correctly. Also changes nmi_taken coverpoint to catch
interrupt taken case for NMI types from the same bus.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-08-02 10:16:08 +01:00
Canberk Topal
7bae3b7ba3 [dv,fcov] Fix cp_mem_raw_hz implementation
This commit fixes how we catch an instruction at WB stage. Before this fix
we were effectively checking opcode of decoded instruction instead.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-07-26 09:54:59 +01:00
Greg Chadwick
6518cb6db6 [dv] Add option to ignore cosim log to testlist
The riscv_csr_test does not use cosim but was failing due to lack of a
cosim log. This option skips the stage of pass/fail determination that
looks for that log.
2022-07-26 09:22:00 +01:00
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
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
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
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