Commit graph

846 commits

Author SHA1 Message Date
Greg Chadwick
511a3516a6 [dv] Remove CPUCTRLSTS from riscv_csr_test
Bit 8 of this CSR cannot be predicted by the CSR test generator leading
to test failures. Remove it from the test for now until this is
addressed.
2022-10-14 12:59:20 +01:00
Marno van der Maas
4608df4606 [dv] Shellcheck prettify script
Signed-off-by: Marno van der Maas <mvdmaas+git@lowrisc.org>
2022-10-11 17:08:46 +01:00
Marno van der Maas
322ab3a285 [dv] Shellcheck objdump script and check for RISCV_TOOLCHAIN variable
Signed-off-by: Marno van der Maas <mvdmaas+git@lowrisc.org>
2022-10-11 17:08:46 +01:00
Canberk Topal
e27deb1015 [dv] Add MHPM Counter number param to SpikeCosim
This commit adds another field in SpikeCosim class so that Spike
can hardcode the correct event registers.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-10-11 15:52:42 +01:00
Marno van der Maas
671b924f66 [pmp] Add coverpoints for large NAPOT regions 2022-10-10 13:46:17 +01:00
Harry Callahan
3c11ef10b9 single_step test : only drive debug_req_i after stepping finishes
This addresses a current testbench issue where asserting debug_req_i close to
when single_stepping over an instruction causes an incorrect 'cause' to be
recorded within DCSR.
2022-10-06 17:52:36 +01:00
Harry Callahan
377382fb78 Single step debugging test changes for fcov
This builds upon the cosimulation environment to allow us to rip-out all the
existing checking from the test, and instead focus on generating good stimulus
to hit all our coverage points.
Make use of the riscv-dv changes to insert ecall into the main test body, now
that we have a different mechanism for ending the test.
Allow illegal instructions, csr instructions, ebreak, etc. which the previous
brittle checking paradigms could not handle.
2022-10-06 17:52:36 +01:00
Harry Callahan
0e396d5944 Change failure modes and add comments with more clarifying details 2022-10-05 17:00:31 +01:00
Harry Callahan
3650e08e4e Record test failure due to timeout in regr.log
This commit adds a new field to the trr (test-run-result) structured data
that records the failure_mode of a testcase. If the test failed due to a
timeout, print a small addendum {T} to each log-line in the summary.

eg.

23.33% PASS 7 PASSED, 23 FAILED
riscv_debug_basic_test.21259:                     PASS
riscv_debug_basic_test.21260:                     FAILED {T}
riscv_debug_basic_test.21261:                     PASS
riscv_debug_basic_test.21262:                     FAILED {T}
riscv_debug_basic_test.21263:                     FAILED {T}
riscv_debug_instr_test.21259:                     FAILED {T}
riscv_debug_instr_test.21260:                     FAILED {T}
riscv_debug_instr_test.21261:                     FAILED {T}
riscv_debug_instr_test.21262:                     PASS
riscv_debug_instr_test.21263:                     FAILED {T}
riscv_dret_test.21259:                            FAILED
riscv_dret_test.21260:                            FAILED
riscv_dret_test.21261:                            FAILED {T}
2022-10-05 17:00:31 +01:00
Marno van der Maas
3943a4eca3 [pmp] Remove off mode from pmp_*_mode_cross coverpoints 2022-09-30 11:05:00 +01:00
Greg Chadwick
4084dc4a46 [cosim] Fix spike cosim instruction count
The count wasn't being initialised in the constructor and should be of
type 'unsigned int'.
2022-09-30 09:41:07 +01:00
Greg Chadwick
a788593842 [cosim] Pass Ibex config through for verilator cosim 2022-09-30 09:41:07 +01:00
Greg Chadwick
d35ff67df6 [dv] Fix timeout issues
core_ibex_directed_test has a 'disable fork' that was killing processes
that were running sequences. Another part of the testbench waits for
those sequences to finish. When this 'disable fork' happens too early
the sequences are killed before they finish so the testbench never
terminated and times out. Instead ensure the sequences have finished
before doing the 'disable fork'.
2022-09-27 09:12:54 +01:00
Greg Chadwick
70186c57ae [rtl] Add ic_scr_key_valid field to CPUCTRL (renamed CPUCTRLSTS)
The ic_scr_key_valid field indicates whether the ICache scrambling key
is valid.

CPUCTRL is also renamed CPUCTRLSTS as it contains both control and
status bits.
2022-09-22 16:17:31 +01:00
Greg Chadwick
06fece4640 [cosim] Pass SecureIbex and ICache paramters through to cosim 2022-09-22 16:17:31 +01:00
Greg Chadwick
1d0344eb89 [rtl, dv] Add new CSRs for latest priviledged spec
This adds the following CSRs to support the v1.12 priviledged spec.

 - MSTATUSH
 - MCONFIGPTR
 - MENVCFG
 - MENVCFGH

MCONFIGPTR is read only and has its value provided by a ibex_pkg
parameter CSR_MCONFIGPTR_VALUE which is set to 0. Implementors can alter
this value if needed.

All the other CSRs ignore writes and read as 0.
2022-09-07 17:31:41 +01:00
Greg Chadwick
c30f7f98bd [dv] Prevent PMP setup for riscv_mem_error_test
RISCV-DV by default sets up some PMP regions. This leads to PMP failures
within riscv_mem_error_test which it isn't expecting. Suppress the PMP
setup to prevent this issue.
2022-09-06 16:52:24 +01:00
Greg Chadwick
056cb44ff7 [dv] Increase generated CSR instructions in riscv_rand_instr_test
This employs new RISC-V DV functionality to better stimulate reads and
writes for various CSRs in the random instruction test.
2022-08-30 13:12:11 +01:00
Greg Chadwick
95e0947e77 [cosim] Fix various CSR mismatches
This sets the initial values of a few CSRs in spike to match Ibex. It
also adds an mcause fixup so we get WARL behaviour matching Ibex.
2022-08-30 13:12:11 +01:00
Greg Chadwick
080ad8df96 [dv, cosim] Fix mcycle setting
Spike has a hack that decrements mcycle/minstret when written.
Previously this was not handled correctly by cosim. As we can only write
32 bits at a time two writes must be used and incremented to counteract
the decrementing handled carefully.
2022-08-30 13:12:11 +01:00
Greg Chadwick
7c37648b06 [dv] Improve riscv_core_setting.sv template
This now takes into account more configuration options allow DV to run
successfully across more configs.
2022-08-30 11:53:14 +01:00
Greg Chadwick
3d76300686 [dv] Add makefile step for generating core config file from template
The prior system of using a patch to alter the riscv_dv_setting.sv file
has been removed and replaced with a mako templating based approach.

Fixes #1787
2022-08-30 11:53:14 +01:00
Greg Chadwick
8653927bbd [dv] Drive read data/integrity to X for write response
Fixes #1727
2022-08-30 10:04:38 +01:00
Michael Schaffner
9e3989f205 [dvsim] Make sure results_html_name key is defined
Signed-off-by: Michael Schaffner <msf@google.com>
2022-08-24 14:42:02 -07:00
Michael Schaffner
e8783c711e [testplan] Align milestone/stage terminology
Signed-off-by: Michael Schaffner <msf@google.com>
2022-08-24 14:42:02 -07:00
Greg Chadwick
7b4b780c7e [dv] Double timeout for an RTL run in regression flow
This takes it from 15 to 30 minutes
2022-08-23 13:35:51 +01:00
Marno van der Maas
d77dd501c9 [dv,pmp] Minor fixes to PMP full random test
- Increase iterations to 20 because double faults are less likely.
- Remove restriction on MPRV randomization.

Signed-off-by: Marno van der Maas <mvdmaas+git@lowrisc.org>
2022-08-22 09:55:31 +01:00
Marno van der Maas
2669260aa0 [dv] Stop write PMP CSR routine when using full randomization 2022-08-22 09:55:31 +01:00
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
Greg Chadwick
e53a02ab31 [rtl] Alter some CSR WARL behaviour to match spike
The following changes are made:

- For unimplemented counters corresponding bits in MCOUNTINHIBIT read as
0 not 1
- For MHPMEVENTx we start at x = 3 with the first bit set (0-2
MHPMEVENTx CSRs do not exist)
- When writing an invalid privilege mode to MSTATUS.MPP/DCSR.PRV default
to U rather than M mode.

These new behaviours remain spec compliant and match spike.
2022-08-09 21:15:09 +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