Commit graph

749 commits

Author SHA1 Message Date
Rupert Swarbrick
e9c0a0223a Make build_modes a dictionary in ibex_icache_sim_cfg.hjson
This mirrors a mistaken OpenTitan commit that I made in
December (4c89520 on the OT side), editing a vendored file. Oops!

Match that behaviour here, so that we can re-vendor without undoing
the change.
2024-03-21 14:13:50 +00:00
Rupert Swarbrick
aef478fb6e [dv] Remove phase argument from collect_trans
The prototype of this task has to match the one in dv_base_monitor,
which we are importing from OpenTitan (called "lowrisc_ip").
Unfortunately, OpenTitan imports Ibex, causing a circular reference
which makes it a bit fiddly to change any types.

This commit switches the tasks to match the new prototype we're going
to use in OpenTitan. We can't just apply it in Ibex
immediately (because it won't work with our vendored lowrisc_ip code),
but creating the commit *does* mean we can vendor in the changed Ibex
code at the OpenTitan end.

Once that's sorted, we can vendor OpenTitan back into Ibex and get
everything cleaned up properly.

In hindsight, we probably should have made sure our vendoring
structure was a DAG.
2024-03-21 13:20:07 +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
Greg Chadwick
4e17587213 [dv] Fix SET_PMP_CFG macro used by directed tests
For some region numbers it would perform additional spurious writes to
the pmpcfg CSRs
2023-06-23 07:50:22 +00:00
Greg Chadwick
a7845832a2 [dv,fcov] Add additional illegal bins to PMP fcov 2023-06-22 11:00:26 +00:00
Greg Chadwick
4fe6d89ed3 [dv, fcov] Increase iterations of riscv_mem_intg_error_test
This helps hit more coverage more reliably in particular for the
priv_mode_irq_cross cross coverage.

A better fix would adjust riscv_mem_intg_error_test to utilize U mode
more but it's a quick test for run so this suffices for now.
2023-06-22 10:15:49 +00:00
Rupert Swarbrick
97df7a5b10 Use correct format string for $value$plusargs
Not doing so causes VCS to spit out a warning message. The intention
seems to be that the initial call to $value$plusargs will evaluate to
true and will put the value that was assigned into the
disable_pmp_exception_handler variable, which then gets checked.
2023-05-26 10:58:20 +00:00
Rupert Swarbrick
b94ed2813d Reorder classes in ibex_debug_triggers_overrides.sv
The previous version doesn't make sense if you read the classes in
exactly the order they are defined in the file. It turns out that this
is what VCS did: oops! Fortunately, the fix is pretty trivial: declare
the classes the other way around.
2023-05-26 10:58:20 +00:00
Rupert Swarbrick
4118f97595 Express some coverpoint crosses in an equivalent way
The previous code caused VCS to complain that the "with" clause didn't
use any of the constituent coverpoints. I *think* that VCS wasn't
understanding that cp_interrupt_taken[5:4] does indeed depend on
cp_interrupt_taken (concentrating on core_ibex_fcov_if for
concreteness).

Fortunately, the check is easy to express a different way. There, we
were just asking that the top two bits are zero. Another way to say
that is "if I shift everything else off the bottom, the result is
zero". So we say it that way.
2023-05-26 10:58:20 +00:00
Rupert Swarbrick
1985c767a2 Drop an import from inside of a class
This causes VCS to spit out an error because it's not technically
allowed in SystemVerilog. The only things that we needed to import
seems to have been the CSR_MHPMCOUNTER3* names. We can just refer to
them explicitly.
2023-05-26 10:58:20 +00:00
Rupert Swarbrick
3b34f803f5 Re-export imported symbols from ibex_mem_intf_pkg
Other code tries to pick up things like DATA_WIDTH through this agent
package, that it imports. That doesn't seem unreasonable, but VCS
complains because we're not re-exporting it here.
2023-05-26 10:58:20 +00:00
Rupert Swarbrick
a31c0431b6 Correct type in scripts_lib.py's run_one
It seems that typeguard now spots if env happens to be None. We can
just relax things: we're only using env by passing it through to
subprocess.run, which handles a None env in the expected way.
2023-05-17 13:09:59 +00:00
Rupert Swarbrick
7a685b2224 Drop a double entry in rtl_simulation.yaml
We ended up with the Unicode fix twice because of two colliding PR
merges. We only need one copy of the -CFLAGS argument, and VCS
generates a rather strange message about an unknown argument if you
use it twice. Fortunately, it's easy to fix once you've worked out how
to get the system to print out what it's doing.
2023-05-15 08:42:06 +00:00
Greg Chadwick
1120e8ddbf [dv] Improve interrupt signalling to cosim
Previously any changes in interrupt state or debug requests were
strictly associated with retired instructions. This causes cosim
mismatches where a lower priority interrupt occurs in time before a
higher priority interrupt or debug request but between instruction
fetches/retirements so both the low and high priority interrupts are
signalled with the instruction retirement.

This introduces a way for the RVFI to signal an interrupt has occurred
that isn't associated with an instruction retirement to allow the cosim
to see the seperation in time between different interrupts and debug
requests and hence model behaviour correctly.
2023-04-27 12:04:22 +00:00
Greg Chadwick
e587f20d44 [rtl] Increase minimum delay for IRQ assertion in new sequence library
An IRQ asserting then deasserting when not explictly cleared by an
interrupt handler can lead to RTL/cosim mismatches in some cases.
Increasing the delay here minimises those instances.
2023-04-27 12:04:22 +00:00
Greg Chadwick
6bd50a97cb [dv] Improve coverage of priv_mode_irq_cross
This allows mie to be randomly enabled/disabled in memory integrity
error tests. It also corrects the illegal bins.
2023-04-25 15:14:31 +00:00
Greg Chadwick
033abfc09f [dv] Double fault detector should sample with clocking block 2023-04-18 16:49:41 +00:00
Saad Khalid
0623fdbbd8 Removed some uncoverable fcov when
* mml is low
* region is unlocked
execution would be permitted in m-mode
2023-03-16 13:13:31 +00:00
Greg Chadwick
b7859139c1 [dv] Summary svg tweaks
- Use white text for the names
 - Set correct height
2023-03-10 17:41:44 +00:00
Greg Chadwick
94f9f16c07 [dv] Refactor reporting and add additional reports
New reports provide HTML, dvsim compatible json and an SVG summary
dashboard.
2023-03-03 18:24:58 +00:00
Saad Khalid
8efaef8dc1 added U-mode accesses in pmp_mseccfg directed test 2023-02-28 09:59:05 +00:00
Saad Khalid
e5fc3a6bab * Added a directed test for mseccfg.mml 1 and transitions of PMP permissions
* Added a header file for common macros useful for directed tests
* Added license header and description for empty test
2023-02-28 09:59:05 +00:00
Saad Khalid
5693d7da32 added brief readme for directed test flow 2023-02-21 14:19:01 +00:00
Saad Khalid
68d2740e9a removing the directed tests readme for now 2023-02-21 14:19:01 +00:00
Saad Khalid
43a533f4f2 added readme for generating directed testlist 2023-02-21 14:19:01 +00:00
Saad Khalid
2ea7e64341 updated directed testlist and script for generating it 2023-02-21 14:19:01 +00:00
Saad Khalid
95c388ba90 added a script for populating testlist 2023-02-21 14:19:01 +00:00
Saad Khalid
26717c8989 deleted redundant files 2023-02-21 14:19:01 +00:00
Harry Callahan
4a48b3c08d Move 'clean' to top-level makefile
So you can type 'make clean' instead of 'make GOAL=clean'
2023-02-08 13:05:59 +00:00
Saad Khalid
10f4fad3e8 updated comment since directed test use the same flow 2023-02-08 13:05:59 +00:00
Saad Khalid
c00e3198e3 added license headers 2023-02-08 13:05:59 +00:00
Saad Khalid
72e9bcd488 vendored riscv test env for common macro files 2023-02-08 13:05:59 +00:00
Saad Khalid
d51437bcf9 added ibex specific macros 2023-02-08 13:05:59 +00:00
Harry Callahan
15da9f9753 Add 'all_directed' and 'all_riscvdv' as special TEST targets
Running the Makefile dv flow with TEST=all_directed or TEST=all_riscvdv will
run all of the tests from either source of tests.
2023-02-08 13:05:59 +00:00
Harry Callahan
afef45d78e Add missing copyright messages / licenses 2023-02-08 13:05:59 +00:00
Saad Khalid
ce53589e11 Add pydantic schema + common configs for directed tests
This commit introduces the use of a pydantic model to validate the
data used to define directed tests. 'pydantic' is a python data validation
and settings management library which allows for structured data to be
checked against 'pydantic models'. In this case, we define a 'model' for
how we expect the directed-test yaml to look, including fields and datatypes,
and then validate that the imported file matches this expectation.
In effect, it allows the checking of the data to be seperated from its use.

dv/uvm/core_ibex/scripts/directed_test_schema.py defines the pydantic model,
and provides a function 'import_model()' to check the file-contents and
return a valid dictionary of the structured data.
2023-02-08 13:05:59 +00:00