Commit graph

782 commits

Author SHA1 Message Date
Andreas Kurth
594ea976c9 [dv] Plan test for DM accesses in debug mode
Signed-off-by: Andreas Kurth <adk@lowrisc.org>
2025-04-03 08:48:00 +00:00
Priyanshu Mishra
8f4c75c5e4 Update core_ibex_pmp_fcov_if.sv 2024-12-20 12:09:26 +00:00
Andreas Kurth
a05d4d825c [rtl,pmp] Allow all accesses to Debug Module in debug mode
The RISC-V Debug Specification (current release 1.0.0-rc4) in Section
A.2 states that the PMP must not disallow accesses to addresses of the
Debug Module when the hart is in debug mode, regardless of how the PMP
is configured.  This commit changes the PMP accordingly.

Signed-off-by: Andreas Kurth <adk@lowrisc.org>
2024-12-19 10:42:48 +00:00
Harry Callahan
fb49826c16 [dv] Cleanup some code in the compile_tb.py module
Add comments, and move some variable declarations around to be closer to their use.

Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
2024-10-01 15:21:40 +00:00
Harry Callahan
8e77bb39d5 [dv] Tweak ISS linker arg construction for Xcelium
The previous code here was a bit too hacky, so implement a solution that
directly follows the suggestion in the Cadence support article.
An example was also added to make it clear what this transformation is
achieving.

Add some more typehints, and cleanup names.

Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
2024-10-01 15:21:40 +00:00
Elliot Baptist
4ed20f4ac3 Update more documentation links 2024-09-19 08:57:07 +00:00
Gary Guo
03ba286570 Fix icache regression failure on VCS
It appears that VCS require expression after `iff` to be wrapped inside
parenthesis otherwise it will complain about syntax error.

This should fix the weekly VCS regression.

Signed-off-by: Gary Guo <gary.guo@lowrisc.org>
2024-08-26 14:44:27 +00:00
Greg Chadwick
96a1c02ba0 [dv] Increase iterations and instructions in riscv_rf_intg_test
This enables more scenarios begin stimulated per regression run around
RF ECC errors.
2024-07-15 22:02:06 +01:00
Greg Chadwick
6ac0ddc46e [dv] Alter riscv_rf_intg_test to cover more scenarios
Previously the riscv_rf_intg_test skipped certain scenarios where an ECC
error from the register file should trigger an alert. This change stops
it from skipping those scenarios.
2024-07-15 22:02:06 +01:00
Greg Chadwick
668233699d [dv] Add spurious responses to memory agent
A spurious response is one that isn't associated with any on-going
request. With this new feature the memory agent can generate them
randomly when the interface is idle (i.e. there are no outstanding
requests).
2024-07-04 22:51:30 +00:00
Pascal Nasahl
0e0f27ad14 [dv] Add riscv_ram_intg_test
This test injects a fault into different MuBi encoded signals within
the prim_ram_1p_scr and prim_ram_1p_adv and checks whether a fatal
alert is triggered.

I have excluded the addr_match signal from FI as its encoding
is not directly checked. If the signal was a MuBi True, a
fault into it is treated by the mubi4_and_hi as a False.
If the signal was a MuBi False, a fault into it is treated
by the mubi4_and_hi also as a False. Hence, no address
collision occurs and the holding register is not returned.

This PR is based on #2182 and closes #2173.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-07-04 10:58:40 +00:00
Greg Chadwick
470b39a2a2 [dv] Output warning message on problematic MIP changes
When an interrupt is raised the Ibex controller will move from the
DECODE state to the IRQ_TAKEN state when it chooses to handle the
interrupt. When in IRQ_TAKEN it's possible for the interrupt state to
change again which aborts the interrupt entry. This leads to mis-matches
against cosim.

This change adds a warning to flag up cases where this has occurred to
enable quick triage of failures related to this scenario.
2024-07-03 15:31:44 +00:00
Greg Chadwick
e784d27464 [dv] Update testbench to use new 'pre_val' MIP
The 'pre_val' MIP addresses the scenario where MIP changes as an
instruction is excuting, this means a CSR instruction can observe a
different MIP from the one that decides whether or not that instruction
will be interrupted.
2024-07-03 15:31:44 +00:00
Greg Chadwick
3964804815 [dv] Fix model mismatches in cases where an access crosses PMP regions
Where an access is unaligned Ibex splits it into two transactions, each
of which undergoes a PMP check. It is possible for the first half to
fail a PMP check and the second to succeed and hence produce a request
on the memory interface.

In Spike it accesses memory byte by byte and if it encounters a PMP
error for a particular byte it won't try any further bytes.

This results in a mis-match between Ibex and spike when an unaligned
transaction is split across two PMP regions, one of which allows the
access and the other doesn't. Ibex generates a transaction and spike
doesn't producing an error.

This adds a fixup into the co-simulation environment. It detects when we
have an access that fails PMP that is misaligned. Where this has
resulted in Ibex producing a memory request that spike would not we
remove it from the list of memory requests to check after checking that
the request passes PMP within spike.
2024-07-03 15:31:44 +00:00
Greg Chadwick
89f4d86719 [dv] Fix exception_stall_instr_cross illegal bins 2024-07-03 15:31:44 +00:00
Greg Chadwick
2c132113c0 [dv] Add riscv_rf_ctrl_intg_test
This tests new hardening added to the register file around read and
write control signals.
2024-07-03 14:21:10 +00:00
Greg Chadwick
1449ed5ea8 [dv] Add cover points for memory interface behaviour 2024-06-21 11:18:41 +00:00
Greg Chadwick
604ba343bb [dv] Fix race condition in ibex_mem_intf_agent
Previous code working with clocking blocks synced to the raw clock
event. Instead they should sync to the clocking block event. This
ensures the values being read are the latest values rather than a cycle
old.

In particular for ibex_mem_intf_agent this meant it was unable to
produce a single cycle response to any memory transaction. With this fix
these are now observed.
2024-06-21 11:18:41 +00:00
Pascal Nasahl
d019dccb4b [dv] Remove phase argument from collect_trans
This commit applies the patch from lowRISC/opentitan@18b0ced to the Ibex
repository.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-06-06 21:36:55 +01:00
Pascal Nasahl
957529c4bd [dv] Add mubi and prim_count pkg to DV environment
With the latest update in vendor/lowrisc_ip, two additional packages
need to be imported.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-06-06 21:36:55 +01:00
Pascal Nasahl
5cea5d65c3 [rtl] Add error port to iCache
This commit adds the error port to the iCache which was introduced
with lowRISC/opentitan#23292.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-06-06 21:36:55 +01:00
Pascal Nasahl
0b0b01006c [rtl] Update RAM ports inside ibex_top
This commit updates the RAM ports inside ibex_top to reflect recent
changes introduced with lowRISC/opentitan#23212 (SRAM readback mode).

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-06-06 21:36:55 +01:00
James Wainwright
c1139477dc Add missing copyright headers
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
2024-03-28 08:41:30 +00:00
Greg Chadwick
eb668b064b [dv] Output VCS simulation log to file
The DV flow is expecting log files to be produced with a particular file
name, without it the reporting mechanisms do not work correctly. This
adds VCS log output to a named rather rather than just capturing stdout.
2024-03-07 15:20:43 +00:00
Greg Chadwick
926a9865d9 [dv] Add flag needed to allow force under VCS
Tests targetting security features make use of force to corrupt values.
Under VCS this requires building with a particular flag.
2024-03-07 15:20:43 +00:00
Greg Chadwick
6bdbcfabf2 [dv] Fix use of plusargs
Previously some $value$plusargs calls weren't explictly specifying a
format for a number to read from the plusarg. Under some simulators this
is acceptable under others it generates an error.
2024-03-07 15:20:43 +00:00
Greg Chadwick
5db718c153 [fcov] Fix illegal bins related to stall types
An instruction stall on a FENCE.I had been mistakenly placed in an
illegal bin. A FENCE.I acts much like a branch or jump so can produce
instruction stalls just as those instructions can.
2024-03-07 15:20:43 +00:00
Greg Chadwick
15945049b2 [dv] Handle missing paths when producing regression log
It's possible for a TestRunResult to contain an entry that has a path to
a build/run artifact but for that to be None rather than an actual path.
This causes the collect_results.py script to fail.

With this change such paths will be described as 'MISSING' in the
regression log instead.
2024-03-07 15:20:43 +00:00
Greg Chadwick
63fa98537e [dv] Only run SecureIbex relevant tests for SecureIbex configs 2024-03-07 15:20:43 +00:00
Greg Chadwick
55e2f40bb4 [dv] Fix regression for non PMP configs
Programs generated from RISC-V were exiting early in configs that don't
have PMP
2024-03-07 15:20:43 +00:00
Greg Chadwick
cb885df346 [dv] Fix path for vcs.tcl for wave dumping 2024-03-07 15:20:43 +00:00
Greg Chadwick
77ebbf729d [dv, cov] Log coverage merge stdout for VCS
Additionally update metadata with the appropriate coverage merge log
information.
2024-03-07 15:20:43 +00:00
Greg Chadwick
126f9c3450 [cosim] Fix SIGSEGV in ~SpikeCosim
When SpikeCosim is getting destructed a SIGSEGV was observed on CentOS
7. The root cause hasn't been identified other than it relates to the
deletion of `isa_parser_t`, potentially some kind of use after free
error.

This is an (optional) hacky workaround that simply never deletes the
`isa_parser_t` pointer in SpikeCosim. As in practise this occurs at the
end of simulation when the process is terminating the memory leak is of
little consequence.

Longer term this issue should be investigated and properly fixed.
2024-03-07 15:20:43 +00:00
Greg Chadwick
e00db7d2e4 [dv] Skip SVG generation in DV flow if svg module is missing 2024-03-07 15:20:43 +00:00
Greg Chadwick
ca25f3013b [dv] Flow modifications for CentOS 7 for testbench compile
Fixes two issues observed on CentOS 7 during testbench compile
 - pkg-config doesn't behave properly when it receives multiple flags
 - riscv-fesvr library needs to be included in build
2024-03-07 15:20:43 +00:00
Pascal Nasahl
8ec0c6f18e [rtl] Harden lockstep enable against FI
Currently, the dual-core lockstep FI mitigation is enabled/disabled
using a single bit.
For transient bit-flips, this is not problematic, as one bit-flip
into this signal and one bit into the Ibex is required to threaten
the security of the system.

However, a permanent stuck-at-0 fault could disable the lockstep
completely by targeting this signal. Then, only a single, additional
fault (transient or permanent) is required.

This PR enhances the FI resilience of the Ibex lockstep by encoding
this single bit into a ibex_mubi_t signal, i.e., a 4-bit multi-bit
signal.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-01-23 09:14:45 +00:00
Michael Schaffner
56413ecf10 [icache] Disable S&P diffusion layer in memory scrambling
Signed-off-by: Michael Schaffner <msf@opentitan.org>
2024-01-19 03:24:48 +00:00
Sᴜᴘᴇʀ Lᴇᴇ
123d46b4d6 [dv] Fix paths in merge_cov.py 2024-01-11 15:00:52 +00:00
Harry Callahan
03946d8dcc Tweak questa timescale argument
Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
2024-01-08 11:03:10 +00:00
Harry Callahan
7d0cab583c Fixup the questa build/sim command templates in rtl_simulation.yaml
We do not actively use or test these commands and tools, so they probably broke
some time ago.

Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
2024-01-08 11:03:10 +00:00
Pascal Nasahl
35bbdb7be3 [rtl] Fix FI vulnerability in RF
As described in #20715, a single fault-induced bit-flip inside the
register file could change which of the register file value is
provided to Ibex.

This PR fixes this issue by (i) encoding raddr_a/b to one-hot
encoded signals, (ii) checking these signals for faults, and
(iii) using an one-hot encoded MUX to select which register file
value is forwarded to rdata_a/b.

Area increases by ~1% (Yosys + Nangate45 synthesis).

I conducted a formal fault injection verification at the Yosys
netlist to ensure that the issue really is fixed.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-01-04 15:26:32 +00:00
Rupert Swarbrick
e5dac43844 Fix spelling of separator 2023-11-24 20:23:49 +00:00
Rupert Swarbrick
20cc063cdc [dv] Add an extra key to common_project_cfg.hjson
The keys in this file get incorporated into the FlowCfg object that
represents a simulation or similar. Adding a spurious key won't cause
any problems, but we actually need it for the next commit, which grabs
the current version of dvsim from OpenTitan. That version of dvsim
expects the "book" key to have been set in common_project_cfg.hjson.

Splitting the two commits like this should make it a bit more obvious
where things have come from.
2023-11-24 17:27:25 +00:00
Greg Chadwick
99fb7be1be [dv] Fix ibex_cmd.py
With the latest versions of all python packages in
python-requirements.txt ibex_cmd.py was seeing a run-time type error.
Data from a YAML file that had previously always been a string could now
be an int as well. This alters the code to allow the int to work.
2023-10-03 13:42:54 +00:00
Rupert Swarbrick
dccad9e6a3 Port directed_test_schema.py to recent versions of Pydantic 2023-08-31 08:34:17 +00:00
Rupert Swarbrick
eb95f74a5a Tweak ibex_cmd.py to fail more cleanly
This shouldn't change the behaviour when it works. On a failure, we
now print out a bit more about what's going on.

When asked to do something impossible now, I think the output is a bit
clearer. For example, if you try to run riscv_bitmanip_full_test with
an OpenTitan configuration (which doesn't have full bitmanip), the
warning message is now:

    WARNING:ibex_cmd:Rejecting test: riscv_bitmanip_full_test. It specifies rtl_params of ['ibex_pkg::RV32BFull'], which doesn't contain the expected 'ibex_pkg::RV32BOTEarlGrey'.

(The following stuff that appears is a bit messy, but at least the
first line is now clearer!)
2023-08-31 08:32:36 +00:00
Marno van der Maas
18c6053fcf [dv,doc] Point reference to lowRISC branch 2023-07-18 08:34:09 +00:00
Marno van der Maas
d33fc90375 [dv] Move DVSIM data structures
This is copied from OpenTitan 0bda971

Co-authored-by: Gary Guo <gary.guo@lowrisc.org>
2023-07-06 07:55:47 +00:00
Marno van der Maas
a1d5d49d10 [dv] Add common_ifs_pkg.sv to DV files 2023-07-06 07:55:47 +00:00
Greg Chadwick
fbd070cf58 [dv] New directed test to cover some scenarios with U-mode execution
This directly stimulates cases where U-mode execution is attempted
against locked regions (and a region with no permissions).
2023-06-23 07:50:22 +00:00