Skip to content

Commit

Permalink
Update lowrisc_ibex to lowRISC/ibex@123d46b4
Browse files Browse the repository at this point in the history
Update code from upstream repository
https://github.com/lowRISC/ibex.git to revision
123d46b4d60068502f80c117772a279db12f5af7

* [dv] Fix paths in `merge_cov.py` (Sᴜᴘᴇʀ Lᴇᴇ)
* Tweak questa timescale argument (Harry Callahan)
* Fixup the questa build/sim command templates in rtl_simulation.yaml
  (Harry Callahan)
* [rtl] Fix FI vulnerability in RF (Pascal Nasahl)
* [doc] Update cosim version (Pascal Nasahl)
* [util] Update check_tool_requirements.py (Gary Guo)
* [rtl] Avoid name collision in ibex_pmp.sv (Rupert Swarbrick)
* [dv] Fix performance counter printing in simple system (Rupert
  Swarbrick)
* Fix spelling of separator (Rupert Swarbrick)
* [dv] Add an extra key to common_project_cfg.hjson (Rupert Swarbrick)
* [verilator] Slight refactor in ibex_tracer to avoid BLKSEQ warning
  (Rupert Swarbrick)
* [verilator] Waive MULTIDRIVEN warning in ibex_tracer.sv (Rupert
  Swarbrick)
* [ibex_pmp/lint] Declare functions before using them (Michael
  Schaffner)
* Update google_riscv-dv to chipsalliance/riscv-dv@71666eb (Greg
  Chadwick)
* [dv] Fix ibex_cmd.py (Greg Chadwick)
* Port directed_test_schema.py to recent versions of Pydantic (Rupert
  Swarbrick)
* Tweak ibex_cmd.py to fail more cleanly (Rupert Swarbrick)
* Remove (empty) Verible waiver file (Rupert Swarbrick)
* [doc] Fix background of Icache block (Marno van der Maas)
* [doc] Fix background in block diagram (Marno van der Maas)
* Update google_riscv-dv to chipsalliance/riscv-dv@08b1206 (Marno van
  der Maas)
* [dv,doc] Point reference to lowRISC branch (Marno van der Maas)
* [dv] Move DVSIM data structures (Marno van der Maas)
* [dv] Add common_ifs_pkg.sv to DV files (Marno van der Maas)
* [doc] Fix documented mstatus reset value (Greg Chadwick)
* [dv] New directed test to cover some scenarios with U-mode execution
  (Greg Chadwick)
* [dv] Fix SET_PMP_CFG macro used by directed tests (Greg Chadwick)
* [dv,fcov] Add additional illegal bins to PMP fcov (Greg Chadwick)
* [dv, fcov] Increase iterations of riscv_mem_intg_error_test (Greg
  Chadwick)
* Use correct format string for $value$plusargs (Rupert Swarbrick)
* Reorder classes in ibex_debug_triggers_overrides.sv (Rupert
  Swarbrick)
* Express some coverpoint crosses in an equivalent way (Rupert
  Swarbrick)
* Drop an import from inside of a class (Rupert Swarbrick)
* Re-export imported symbols from ibex_mem_intf_pkg (Rupert Swarbrick)
* Bump Spike minimum version (Rupert Swarbrick)
* Correct type in scripts_lib.py's run_one (Rupert Swarbrick)
* [dv] Add asserts to check alerts for memory integrity failures (Greg
  Chadwick)
* Drop a double entry in rtl_simulation.yaml (Rupert Swarbrick)

Signed-off-by: Pirmin Vogel <[email protected]>
  • Loading branch information
vogelpi committed Jan 16, 2024
1 parent 890b751 commit 2e69b99
Show file tree
Hide file tree
Showing 62 changed files with 2,037 additions and 872 deletions.
3 changes: 3 additions & 0 deletions hw/ip/rv_core_ibex/lint/rv_core_ibex.waiver
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ waive -rules RESET_MUX -location {ibex_lockstep.sv} -regexp {Asynchro
-comment "The test enable input used to control the bypass can be considered static"
waive -rules RESET_USE -location {ibex_lockstep.sv} -regexp {'rst_shadow_set_q' is used for some other purpose, and as asynchronous reset 'rst_ni' at}
-comment "A synchronous counter is needed to release the shadow core reset with a delay of LockstepOffset clock cycles and start the comparison logic one clock cycle later"
waive -rules {CLOCK_USE RESET_USE} -location {ibex_register_file_ff.sv} \
-regexp {'(clk_i|rst_ni)' is connected to '(prim_onehot_mux)' port} \
-comment {The module is fully combinatorial, clk/rst are only used for assertions.}

# Highlighting my main concerns here, documenting areas to review in next dive
#
Expand Down
2 changes: 1 addition & 1 deletion hw/vendor/lowrisc_ibex.lock.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
upstream:
{
url: https://github.com/lowRISC/ibex.git
rev: 1120e8ddbfe39cfedabe7dda16945e7e809c8389
rev: 123d46b4d60068502f80c117772a279db12f5af7
}
}
2 changes: 1 addition & 1 deletion hw/vendor/lowrisc_ibex/doc/03_reference/cosim.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ These extended signals have the prefix ``rvfi_ext``
Setup and Usage
---------------

Clone the `lowRISC fork of Spike <https://github.com/lowRISC/riscv-isa-sim>`_ and check out the ``ibex-cosim-v0.3`` tag.
Clone the `lowRISC fork of Spike <https://github.com/lowRISC/riscv-isa-sim>`_ and check out the ``ibex-cosim-v0.5`` tag.
Other, later, versions called ``ibex-cosim-v*`` may also work but there's no guarantee of backwards compatibility.
Follow the Spike build instructions to build and install Spike.
The ``--enable-commitlog`` and ``--enable-misaligned`` options must be passed to ``configure``.
Expand Down
2 changes: 1 addition & 1 deletion hw/vendor/lowrisc_ibex/doc/03_reference/cs_registers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Machine Status (mstatus)

CSR Address: ``0x300``

Reset Value: ``0x0000_1800``
Reset Value: ``0x0000_0080``

+-------+-----+---------------------------------------------------------------------------------+
| Bit# | R/W | Description |
Expand Down
540 changes: 257 additions & 283 deletions hw/vendor/lowrisc_ibex/doc/03_reference/images/blockdiagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions hw/vendor/lowrisc_ibex/doc/03_reference/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ When Ibex is configured with the SecureIbex parameter, the write enable signal i
This can be useful to detect fault injection attacks.
No attempt is made to correct detected errors, but an internal major alert is signaled for the system to take action.

Register file read addresses glitch detection
-------------------------------------------

When Ibex is configured with the SecureIbex parameter, the read addresses provided to the register file are converted to one-hot encoded signals, and a one-hot encoded MUX is used to select the register to read from.
By using one-hot encoding checkers, glitches in the one-hot encoded signals are detected.
Bit-flips inside the plain read addresses before the one-hot conversion happens are detected by the dual core lockstep.
This can be useful to detect fault injection attacks.
No attempt is made to correct detected errors, but an internal major alert is signaled for the system to take action.

ICache ECC
----------

Expand Down
3 changes: 1 addition & 2 deletions hw/vendor/lowrisc_ibex/doc/03_reference/verification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ In order to run the co-simulation flow, you'll need:
+ Some custom CSRs
+ Custom NMI behavior

Ibex verification should work with the Spike version that is tagged as ``ibex-cosim-v0.3``.
Other, later, versions called ``ibex-cosim-v*`` may also work but there's no guarantee of backwards compatibility.
Ibex verification should work with the Spike version that is tagged as ``ibex-cosim-v0.5``.

Spike must be built with the ``--enable-commitlog`` and ``--enable-misaligned`` options.
``--enable-commitlog`` is needed to produce log output to track the instructions that were executed.
Expand Down
5 changes: 5 additions & 0 deletions hw/vendor/lowrisc_ibex/dv/uvm/common_project_cfg.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
project: ibex

// These keys are expected by dvsim.py, so we have to set them to something.
book: bogus.book.domain
doc_server: bogus.doc.server
results_server: bogus.results.server
results_html_name: report.html
Expand All @@ -14,6 +15,10 @@
scratch_path: "{scratch_base_path}/{branch}"
tool_srcs_dir: "{scratch_path}/{tool}"

// Common DVSIM data structures
build_pass_patterns: []
build_fail_patterns: []

// The current design level
design_level: "ip"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
`include "cosim_dpi.svh"

class ibex_cosim_scoreboard extends uvm_scoreboard;
import ibex_pkg::*;
chandle cosim_handle;

core_ibex_cosim_cfg cfg;
Expand Down Expand Up @@ -151,8 +150,10 @@ class ibex_cosim_scoreboard extends uvm_scoreboard;

// Set performance counters through a pseudo-backdoor write
for (int i=0; i < 10; i++) begin
riscv_cosim_set_csr(cosim_handle, CSR_MHPMCOUNTER3 + i, rvfi_instr.mhpmcounters[i]);
riscv_cosim_set_csr(cosim_handle, CSR_MHPMCOUNTER3H + i, rvfi_instr.mhpmcountersh[i]);
riscv_cosim_set_csr(cosim_handle,
ibex_pkg::CSR_MHPMCOUNTER3 + i, rvfi_instr.mhpmcounters[i]);
riscv_cosim_set_csr(cosim_handle,
ibex_pkg::CSR_MHPMCOUNTER3H + i, rvfi_instr.mhpmcountersh[i]);
end

riscv_cosim_set_ic_scr_key_valid(cosim_handle, rvfi_instr.ic_scr_key_valid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ package ibex_mem_intf_agent_pkg;
`include "ibex_mem_intf_request_driver.sv"
`include "ibex_mem_intf_request_agent.sv"

// Re-export parameters from ibex_mem_intf_pkg so that other packages can access them through this
// package.
export ibex_mem_intf_pkg::*;

endpackage
27 changes: 27 additions & 0 deletions hw/vendor/lowrisc_ibex/dv/uvm/core_ibex/common/prim/prim_and2.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

// Abstract primitives wrapper.
//
// This file is a stop-gap until the DV file list is generated by FuseSoC.
// Its contents are taken from the file which would be generated by FuseSoC.
// https://github.com/lowRISC/ibex/issues/893

module prim_and2 #(
parameter int Width = 1
) (
input [Width-1:0] in0_i,
input [Width-1:0] in1_i,
output logic [Width-1:0] out_o
);

if (1) begin : gen_generic
prim_generic_and2 #(
.Width(Width)
) u_impl_generic (
.*
);
end

endmodule
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This directory contains the custom directed tests as well as scripts and headers
Currently following open source test suites are vendored:
- [riscv-tests](https://github.com/riscv-software-src/riscv-tests)
- [riscv-arch-tests](https://github.com/riscv-non-isa/riscv-arch-test)
- epmp-tests ([fork](https://github.com/Saad525/riscv-isa-sim) from an opensource [repo](https://github.com/joxie/riscv-isa-sim))
- epmp-tests ([fork](https://github.com/lowRISC/riscv-isa-sim/tree/mseccfg_tests) from an opensource [repo](https://github.com/joxie/riscv-isa-sim))

## Generating test list

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@
li t1, pmp_cfg; \
sll t1, t1, t0; \
csrw pmpcfg1, t1; \
j 4f; \
2 : li t2, 11; \
bgt t1, t2, 3f; \
li t1, pmp_cfg; \
sll t1, t1, t0; \
csrw pmpcfg2, t1; \
j 4f; \
3 : li t2, 15; \
bgt t1, t2, 4f; \
li t1, pmp_cfg; \
Expand Down Expand Up @@ -111,6 +113,10 @@
lw s1, 0(s2); \
sw s1, 0(s2);

// This assumes a PMP access failure on the read and write where the handler
// jumps back to the failing access in M mode. If the access succeeds it remains
// in U mode and the second SWITCH_TO_U_MODE will trap (due to attempting a
// write to mstatus).
#define RW_ACCESSES_IN_U_MODE(pmp_addr, gran) \
la s0, pmp_addr; \
SWITCH_TO_U_MODE_LABEL(1f); \
Expand Down
Loading

0 comments on commit 2e69b99

Please sign in to comment.