Commit graph

2724 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
Greg Chadwick
27dd6b2e06 [rtl] Update use of prim_count following port changes
The latest version of `prim_count` from OpenTitan introduces a
`commit_i` input. To retain the behaviour of the previous `prim_count`
this should be set to a constant 1.

The `cnt_next_o` output has been renamed to `cnt_after_commit_o`.
2024-03-01 10:18:25 +00:00
Greg Chadwick
71683aa595 Update lowrisc_ip to lowRISC/opentitan@e0c4026501
Update code from upstream repository
https://github.com/lowRISC/opentitan to revision
e0c40265019aa0c74e6903d3b3a144c48a3815ec

* [prim/lint] Fix long line lint error in prim_intr_hw (Alexander
  Williams)
* [csr_seq_lib] Avoid slicing a queue (Rupert Swarbrick)
* [dv] Make mem_model's compare_byte function less chatty (Rupert
  Swarbrick)
* [doc,prim] Improve comments in prim_intr_hw (Harry Callahan)
* [dvsim] Format FormalCfg code. (Miguel Osorio)
* [dvsim] Add results_server dependency to FormalCfg (Miguel Osorio)
* [prim_sha2] Add `hash_running_o` (Andreas Kurth)
* [prim_sha2] Add `hash_continue_i` (Andreas Kurth)
* [prim_sha2] Make digest writable from input while disabled (Andreas
  Kurth)
* [dv,random_reset] Enhance handling of random resets (Guillermo
  Maturana)
* [dv] Change implementation of special mubi access modes (Michael
  Schaffner)
* [dv,cov_merge] Do serial coverage merge for vcs (Guillermo Maturana)
* [dv/csr_utils] Change csr_peek to return the peeked value (Rupert
  Swarbrick)
* [dv/csr_utils] Expand a documentation comment in csr_peek (Rupert
  Swarbrick)
* [dv/csr_utils] Simplify HDL path checking in csr_peek (Rupert
  Swarbrick)
* [dv/csr_utils] Use DV_CHECK to simplify code structure in csr_peek
  (Rupert Swarbrick)
* [dv/csr_utils] Fix a seeming typo in csr_peek (Rupert Swarbrick)
* [dv/csr_utils] Change `csr_peek` to function (Andreas Kurth)
* [prim] Fix lint error in shadow register subreg primitive (Pirmin
  Vogel)
* [otp_ctrl] Add second HW_CFG partition (Michael Schaffner)
* [primgen] Fix parameters in a primgen template (Rupert Swarbrick)
* [prim] Avoid unnecessary Impl parameter in prim_onehot_check (Rupert
  Swarbrick)
* [hw,prim,sha2] Fix syntax error in waiver file (Robert Schilling)
* [prim_sha2,rtl] prim_sha2 minor RTL and styling fixes (Ghada
  Dessouky)
* [prim_sha2,rtl] Add RTL implementation + update core + lint waivers
  (Ghada Dessouky)
* [otp_ctrl] Remove entropy_src chicken switches (Michael Schaffner)
* [dv] Correct direct prediction of regwen (Michael Schaffner)
* [clkmgr] Restructure division clock feedback (Michael Schaffner)
* Revert "[edn] Move prim_edn_req out of prim" (Rupert Swarbrick)
* [rtl, prim] Add 'commit' functionality to prim_count (Greg Chadwick)
* [prim] Fix up 1r1w cores (Alexander Williams)
* [prim] Add two-port memory ECC wrappers (Michael Schaffner)
* [prim] Add two-port memory implementation (Michael Schaffner)
* [prim] Make copies of dual port memory files (Michael Schaffner)
* [otp_ctrl] Add support for multiple HW_CFG partitions (Michael
  Schaffner)
* [otp_ctrl] Add option to disable integrity on a partition (Michael
  Schaffner)
* [dv] Enhance RAL model with clearable mubi types (Michael Schaffner)

Signed-off-by: Greg Chadwick <gac@lowrisc.org>
2024-03-01 10:18:25 +00:00
Adrian Lees
5a8a1a9993 [tracer] Fix reporting of load/store data
Modify tracer to use the appropriate read/write masks when logging
load/store traffic from the Load Store Unit.

Signed-off-by: Adrian Lees <a.lees@lowrisc.org>
2024-02-17 20:43:01 +00:00
Adrian Lees
ea1a208f8d [bus] Return error if decode fails
Return an error signal to the host if an address request
does not match any device.
Previously a decode failure would match against the first
device, which in the Ibex Demo System happens to be
the SRAM.
2024-02-15 18:11:54 +00:00
Luís Marques
14c2b3f7ab Update old cpuctrl CSR name in cs_registers.rst
The commit 70186c57 renamed the CSR `cpuctrl` to `cpuctrlsts` but did
not update the table in `doc/03_reference/cs_registers.rst`. Fix that.
2024-02-12 10:04:25 +00:00
Greg Chadwick
1774cbbbe3 Update benchmarks README to better explain how to try different configs 2024-02-05 21:02:42 +00:00
Greg Chadwick
bd248343cc Enable the icache in coremark
When executed on a configuration without an icache the enable is safe
but has no effect.
2024-02-05 21:02:42 +00:00
Greg Chadwick
2de873c9bb Add icache_enable function to simple_system_common.h 2024-02-05 21:02:42 +00:00
Gary Guo
4f96e5446b Fix stale merge commit issue in private CI 2024-02-05 15:08:55 +00:00
Greg Chadwick
7049d4d4d7 [doc] Require sphinx version >= 7.0
The previous ~= 4.2 was failing build on readthedocs
2024-01-31 16:30:19 +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
Pascal Nasahl
b6d8b9f075 Update verilator version
To be consistent between projects, this PR updates the Verilator
version to 4.210, which is also used by OpenTitan. The reason for
this change is that in #2129 Verilator linting issues occured
that did not occur in OpenTitan.

Closes #2131.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-01-19 17:04:40 +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
Michael Schaffner
94a7446277 Update lowrisc_ip to lowRISC/opentitan@4cf2479b8e
Update code from upstream repository
https://github.com/lowRISC/opentitan to revision
4cf2479b8e6c9b68b9fe1adba202443d3dbe3ff3

* [prim_trivium] Allow dynamically disabling the lockup protection
  (Pirmin Vogel)
* [scrambling] Add reference to RFC issue (Michael Schaffner)
* [edn] Move prim_edn_req out of prim (Rupert Swarbrick)
* [reggen] Remove the devmode input (Michael Schaffner)
* [prim, rom_ctrl] Remove S&P layer from data scrambling (Michael
  Schaffner)
* [prim] Fix typo in Trivium/Bivium stream cipher primitives (Pirmin
  Vogel)
* [prim] Add scratch Verilator testbench for Trivium/Bivium primitives
  (Pirmin Vogel)
* [prim] Add Trivium/Bivium stream cipher primitives (Pirmin Vogel)
* [chip,dv] update makefile for real_key rom test (Jaedon Kim)
* [dvsim] cast self.seed to 'int' (Jaedon Kim)
* [dvsim] Change systemverilog seed to 32 bits (Hakim Filali)
* [dv] Specialize dv_spinwait_* documentation comments (Rupert
  Swarbrick)

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
Michael Munday
577a50095f Add NOTICE file
Add a NOTICE file containing some information about the project.

Signed-off-by: Michael Munday <mike.munday@lowrisc.org>
2024-01-10 15:37:44 +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
Gary Guo
c9f4a32963 [ci] introduce GitHub actions based private CI
The private CI works by using workflow dispatch to trigger a CI on
another repository.

Pending status checks are created before calling the dispatch to
indicate their queued status before they are picked up in private CI,
and also serves to block merge group from success.

Signed-off-by: Gary Guo <gary.guo@lowrisc.org>
2024-01-05 15:50:18 +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
Pascal Nasahl
d56143d03b [doc] Update cosim version
Currently, the verification documentation recommends to using
ibex-cosim-v0.3. However, this version of spike causes some
compilation issues on my side:
"class "processor_t" has no member "set_mhpm_counter_num"
when calling "make" in dv/uvm/core_ibex/.
This issue occurs when using the latest pre-build lowrisc toolchain
"20231205-1" or "20230427-1".

When using ibex-cosim-v0.5 DV works.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-01-03 16:00:47 +00:00
Gary Guo
df88055aa3 [util] Update check_tool_requirements.py
`distutils` is deprecated and will generate warnings when used.
Replace it with packaging.version instead.

pip3 command line invocation is replaced with importlib.metadata,
which removes dependency on pip3 being present.

Signed-off-by: Gary Guo <gary.guo@lowrisc.org>
2024-01-02 17:01:33 +00:00
James Wainwright
38da151a25 [ci] Run CI in merge queue and not master
This change updates the GitHub actions workflows to run on PR updates
and within the GitHub merge queue, but not on the push to the master
branch.

Because we use merge queues, the re-run for the master branch would be
redundant.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
2023-12-15 12:09:37 +00:00
Gary Guo
1c5da195b6 [CI] change pr_lint to run on pull_request instead of target
Signed-off-by: Gary Guo <gary.guo@lowrisc.org>
2023-12-15 11:06:48 +00:00
Gary Guo
33a1740dd2 [CI] add GitHub action version of the CI
Signed-off-by: Gary Guo <gary.guo@lowrisc.org>
2023-12-15 11:06:48 +00:00
Rupert Swarbrick
d097c918f5 [rtl] Avoid name collision in ibex_pmp.sv
Recent versions of Verilator complain about the code that was there
because the csr_pmp_cfg argument clashes with a name in ibex_core.sv.

What's more, they mean different things! In ibex_core.sv, it was the
PMP configuration for the entire core. In the functions, it's the PMP
configuration for a single region. This patch adds a "region_" prefix
to the names, which fixes both the Verilator warning and my confusion!
2023-12-05 15:18:40 +00:00
Rupert Swarbrick
c37edf5095 [dv] Fix performance counter printing in simple system
This will avoid printing out a load of spurious zeros if the Ibex
config doesn't enable the corresponding counter.
2023-11-24 20:23:49 +00:00
Rupert Swarbrick
e5dac43844 Fix spelling of separator 2023-11-24 20:23:49 +00:00
Rupert Swarbrick
508c4a29fb [doc] Describe counters more explicitly in simple_system README 2023-11-24 17:29:21 +00:00
Rupert Swarbrick
7647e9a03d Update lowrisc_ip to lowRISC/opentitan@e6a0e9a136
Update code from upstream repository
https://github.com/lowRISC/opentitan to revision
e6a0e9a1363d33789283ea6ba3c4d94d41f2dee5

* [dvsim] fix seed in json report (Gary Guo)
* [prim_prince,rtl] Split data_state array into two pieces (Rupert
  Swarbrick)
* [prim_prince] Move the split_var verilator hint to prim_cipher.vlt
  (Rupert Swarbrick)
* [bazel] Use the new rules for building ROMs (Chris Frantz)
* [hw,rtl,prim] Switch AND/OR for Mubi W1S/W1C (Robert Schilling)
* [util] Error out if secure_prng seed is less than 256 bits (Vladimir
  Rozic)
* [dv] Update dv_sim to support sram new targets (Miguel Osorio)
* [flash_ctrl,dv] update expected double bit error set (Jaedon Kim)
* [bazel] Update the binary/test rules for building ROMs (Chris
  Frantz)
* [bazel] Prepare `dvsim` to work with the new rules (Chris Frantz)
* [mubi,gen] Fix comments (Guillermo Maturana)
* [reggen] Add mubi support SWAccess that sets/clears a reg (Robert
  Schilling)
* [doc] Fixing a few typos in xoshiro PRNG documentation (Vladimir
  Rozic)
* [doc] Testplan's are now generated as markdown. (Hugo McNally)
* [bazel,dvsim] Prevent dvsim from (trying to) copy irrelevant files
  (Amaury Pouly)
* [doc] Moved badges over to using hosted images (Hugo McNally)
* [doc] Fixed links to the getting started section. (Hugo McNally)
* [dvsim] Avoid checking for gsutil when we just need gcloud (Rupert
  Swarbrick)
* [dvsim] Simplify the code that copies files up to GCP (Rupert
  Swarbrick)
* [dvsim] Use new results_server methods to list cleanly (Rupert
  Swarbrick)
* [dvsim] Wrap logic to move "latest" directory into results_server.py
  (Rupert Swarbrick)
* [dvsim] Add an object representing connections to results server
  (Rupert Swarbrick)
* [dv/cov] Fix coverage handling in some common items (Guillermo
  Maturana)
* [prim] Convert prim_clock_div to abtract (Alexander Williams)
* [dv/top-level] Fix sram data integrity error injection (Guillermo
  Maturana)
* [tools,vcs] Make flops use the sampled value of data to avoid races
  (Guillermo Maturana)
* [prim lfsr] Replace randomize() calls with $urandom in prim_lfsr_tb
  (Vladimir Rozic)
* [doc] Update LFSR coeffs descriprion. (Vladimir Rozic)
* [prim_lfsr] Remove redundant list of LFSR_COEFF (Vladimir Rozic)
* [dv/top-level] Harden chip_sw_data_integrity_escalation (Guillermo
  Maturana)
* [otbn,dv] Wait more carefully for secure wipes in vseqs (Rupert
  Swarbrick)
* [doc,report] Fix the dvsim report links to the testplans (Harry
  Callahan)
* [doc] Add the block-dashboards to the primative page (Harry
  Callahan)
* [prim_subreg] Fix RC access corner case (Michael Schaffner)
* [prim_lc_dec] Fix Xcelium compile error (Michael Schaffner)
* [misc] Use lc_tx_t testing functions at endpoints (Michael
  Schaffner)

Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
2023-11-24 17:27:25 +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
Rupert Swarbrick
fe84d64d79 [verilator] Slight refactor in ibex_tracer to avoid BLKSEQ warning
The existing code wanted to open file_handle as a trace file if
necessary and then use it on that clock cycle. So it (sensibly) used a
blocking assignment.

Verilator now warns about blocking assignments to globals in
"sequential logic processes" (the always_ff that is driving
everything). This is sort of easy to fix: just use an "always" block!

This commit looks slightly more involved because I've changed things
to pass the file handle to printbuffer_dumpline as an argument. It
makes the state update (where we open the file handle) a little easier
to follow.
2023-11-22 09:46:03 +00:00
Rupert Swarbrick
20183012f7 [verilator] Waive MULTIDRIVEN warning in ibex_tracer.sv
Fixes #2091.
2023-11-22 09:46:03 +00:00
Michael Schaffner
bac72d96ec [ibex_pmp/lint] Declare functions before using them
Signed-off-by: Michael Schaffner <msf@opentitan.org>
2023-10-19 07:58:30 +00:00
Greg Chadwick
97c0a7231a Update google_riscv-dv to chipsalliance/riscv-dv@71666eb
Update code from upstream repository
https://github.com/chipsalliance/riscv-dv to revision
71666ebacd69266b1abb7cdbad5e1897ce5884e6

* Fixes to support RV32 (Maciej Kurc)
* Extend CI matrix (Eryk Szpotanski)
* Add pyflow test (Grzegorz Placzek)
* Allow the CI to run from any branch and any PR (Maciej Kurc)
* [pmp] Remove MSECCFG reads from trap handler when Smepmp is disabled
  (Marno van der Maas)

Signed-off-by: Greg Chadwick <gac@lowrisc.org>
2023-10-03 13:42:54 +00:00
Greg Chadwick
883acc2bfc [dv,vendor] Pin bitstring version to fix gen_csr_test.py
The gen_csr_test.py script provided by RISC-V DV doesn't work with
version 4.0 and upwards of the bitstring library. This patch pins it to
3.1.9 to avoid the issue.
2023-10-03 13:42:54 +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
fddb2fc3a3 [doc] Bump minimum Verilator version
It turns out that we use split_var in the code, which was added in
version 4.030 (and several bugs were fixed in following versions).
Change the minimum required version to match what we're using in
CI (and presumably works!)

This was triggered by issue #2080.
2023-08-31 08:33:04 +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
Rupert Swarbrick
3c895f89a6 Remove (empty) Verible waiver file
The recent versions of Verible that I've tried die when they are given
an empty waiver file. The error message is "Fatal error: Broken waiver
config handle". I can't see a way to add a comment ("// No waiver" or
similar), so I think the best way to keep everything alive is to
delete the empty file.
2023-08-30 14:41:19 +00:00
Marno van der Maas
db6257b44a [doc] Fix background of Icache block
The background of the Icache block was a not-well-fitted path that was
causing the background to seep through. This commit updates that
background to more tightly align with the lines and letters.
2023-08-30 09:37:05 +00:00
Marno van der Maas
3a2cc6ae8c [doc] Fix background in block diagram
The background was originally a gradient background on the right
together with a solid background on the left. This caused some
distortion on closer inspection. This commit changes it to have one
background that is a gradient from left to right.
2023-08-30 09:37:05 +00:00
James Wainwright
1eb0beafa5 [ci] Consolidate Verible linting workflow into one stage
Running the verible linter and adding review comments to the pull
request previously had to be done in two stages:

1. Triggered on the pull request - prepare config and waiver files as
   artifacts.
2. Running on the repo's HEAD - run Verible and add review comments.

This was required because Actions running in the context of the pull
request did not have write permissions to add comments to pull requests.

This is now possible with the `pull_request_target` event, which
triggers when pull requests change, but runs in the context of the
repo's HEAD and has the permissions to create comments.

See lowRISC/ibex#1427 and
chipsalliance/verible-linter-action#31 for details.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
2023-08-04 08:53:47 +00:00
Marno van der Maas
06df66452f [credits] Add names of recent contributors 2023-08-02 08:08:56 +00:00
Marno van der Maas
f60d03b6b0 Update google_riscv-dv to chipsalliance/riscv-dv@08b1206
Update code from upstream repository
https://github.com/chipsalliance/riscv-dv to revision
08b12066b34c9728f706e45098ba502a36d7ca59

Signed-off-by: Marno van der Maas <mvdmaas+git@lowrisc.org>
2023-07-18 08:40:01 +00:00
Marno van der Maas
44ed214caa [vendor] Use new RISCV-DV URL 2023-07-18 08:40:01 +00:00
Marno van der Maas
18c6053fcf [dv,doc] Point reference to lowRISC branch 2023-07-18 08:34:09 +00:00