Commit graph

27 commits

Author SHA1 Message Date
Pirmin Vogel
28935490c2 [rtl] Protect core_busy_o with a multi-bit encoding
This commit protects the core_busy_o signal using a multi-bit encoding
to reduce the chances of an adversary for glitching this signal to low,
thereby putting the core to sleep and e.g. not handling an alert.

Without this commit, the glitch would only be detected once both the
main core and the shadow core wake up again and the comparison of the
core_busy_o signals continues.

This resolves lowRISC/Ibex#1827.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2022-10-25 12:52:01 +02: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
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
Canberk Topal
1e613cc7f4 [cosim,dv] Add support to set mcount registers
Extends RVFI connections further to include 30 mhpmcounterX registers.
Sets them up before every cosim step to let Spike know their real values.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-07-25 08:51:31 +01:00
Michael Schaffner
6caf82c2b4 [lint] Minor fixes
Signed-off-by: Michael Schaffner <msf@google.com>
2022-04-12 08:38:35 -07:00
Greg Chadwick
f7724adcc7 [rtl] Move memory ECC checks and generation into core
Previously integrity checks for incoming memory reads and integrity
generation for outgoing memory writes were handled within ibex_lockstep
and weren't duplicated.

This moves the integrity checks and generation into the core so they are
replicated and checked as part of the lockstep mechanism.

Additionally it generates a bus error on any memory integrity check
failure. This will result in Ibex taking an exception if any data read
or instruction fetch has bad integrity.
2022-03-16 10:21:03 +00:00
Greg Chadwick
3e4669f086 [rtl] Add SEC_CM markers for security features
These are used by the OpenTitan project to track the implementation of
security countermeasures
2022-03-09 08:57:24 +00:00
Greg Chadwick
b18eceba81 [rtl] Switch to multi-bit fetch enable
The multi-bit enable aids security hardening. For non secure Ibex all
but the bottom bit is ignored so it is effectively a single bit enable.
2022-02-21 15:35:35 +00:00
Greg Chadwick
9943f9a42c [rtl, doc] Seperate major alert into internal and bus
This is to allow more consistent signalling in systems that integrate
Ibex (e.g. OpenTitan) so bus integrity errors external to Ibex and one's
detected within Ibex can be fed into the same alert whilst seperating
out Ibex's various internal alert causes.
2022-02-17 15:11:51 +00:00
Pirmin Vogel
a46ff07489 [rtl] Fix AscentLint errors
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2022-02-17 07:51:58 +01:00
Greg Chadwick
c0f67946f2 [rtl,doc] Add double fault detection.
Fixes #1117
2022-01-25 15:05:39 +00:00
Canberk Topal
187944c417 [icache] Add RAM Primitives for scrambling
This commit includes switching to a scrambling RAM primitive for
ICache data and tag RAMs. Also introduces minor changes to ICache
to handle scrambling key valid signal.

It also includes a minor bug fix regarding not initializing
`fill_way_q` signal without ResetAll parameter. When the parameter
is not set and we have our first hit right after ICache enables,
the signal hangs.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-01-19 14:59:43 +00:00
Pirmin Vogel
448191dda2 [rtl] Use prim_flop/clock_mux2 primitives for lockstep reset generation
These primitives can serve as anchor points for constraining backend
tools.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2022-01-11 19:59:21 +01:00
Pirmin Vogel
8c01488624 [rtl] Document lockstep reset generation mechanism
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2022-01-07 21:25:06 +01:00
Michael Schaffner
169785d071 [secded] Switch to inverted ECC codes
Signed-off-by: Michael Schaffner <msf@google.com>
2021-12-02 15:14:11 -08:00
Greg Chadwick
c03cc91a5d [rtl] RVFI changes and extensions for co-simulation
This adds some new `rvfi_ext` signals that are needed by the
co-simulation environment.

It also fixes/alters `rvfi_trap`. Previously it wouldn't work correctly
in various cases. Now it is fully functional, though it's meaning
includes more trap cases than the RVFI spec strictly includes. It is now
set for any instruction that produces a synchronous trap (everything bar
interrupts).
2021-10-15 11:30:35 +01:00
Philipp Wagner
a25790abf9 [style] Indent module header with two spaces
Both the parameter and the port list in a module header should be
indented with two spaces, according to our style guide.
2021-08-31 15:30:28 +02:00
Philipp Wagner
be27bc8bcf [style] Fix whitespace issues around operators
Our style guide typically require a single whitespace around operators.
2021-08-31 15:30:28 +02:00
Tom Roberts
48f11c6733 [rtl] Add bus integrity checking
Extra bits are added alongside read/write data for the instruction and
data buses to facilitate data integrity checking.

Ibex testbench extended to generate the expected bits.

All other top-levels modified to add the new signals (which are mostly
ignored).

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-08-26 16:55:26 +01:00
Tom Roberts
65bf9c94f9 [rtl] Add LFSR permutation option
Random constants are sent through the hierarchy as parameters in-line
with other OpenTitan modules.

Further detail on this mechanism can be found in lowrisc/opentitan#2229

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-08-10 16:13:02 +01:00
Tom Roberts
7c0b1ff160 [rtl] Add register slice on output of shadow core
This decouples the shadow core from any timing paths and so should ease
implementation.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-08-03 13:47:00 +01:00
Tom Roberts
a1902004f9 [rtl] Add ResetAll parameter
This parameter forces a reset of all registers inside the core. This is
required to guarantee a common starting point for lockstep and thus
prevent spurious lockstep failure alerts.

Another minor change in this commit rearranges the writeback stage
multiplexing to gate incoming lsu write data when not valid. This stops
any X values from the data bus propagating to the register file
signalling (and thus to the lockstep comparison) which would cause the
lockstep alert to be X. It has the side effect of possibly reducing
power consumption in the register file.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-07-22 16:53:27 +01:00
Tom Roberts
6daae3509a [rtl] Modify fetch_en_i behavior
This signal used to be a one shot enable out of reset. We need an option
to pause execution for OpenTitan, so fetch_enable is extended to cover
that.

The signal is already driven low by the testbench at the end of test.
This is moved after the performance counter reads to ensure they can
complete.

Fixes #1105

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-06-23 09:16:27 +01:00
Tom Roberts
f3b163af35 [rtl] Add reset to lockstep delayed inputs
In tests with multiple resets, these signals could hold onto spurious
values through reset (since the clock is also gated) which caused
assertion failures on resumption.

Fixes #1368

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-06-18 11:09:39 +01:00
Tom Roberts
7ac218f3ae [rtl] Wire scan_rst_ni through ibex_top_tracing
Better to have the tracing top consistent with the non-tracing top.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-04-21 12:41:24 +01:00
Timothy Chen
33cca5e127 [ibex] Add reset bypass controls
Signed-off-by: Timothy Chen <timothytim@google.com>
2021-04-21 09:14:12 +01:00
Tom Roberts
a88f5eb912 [rtl] Add dual core lockstep option
Note that the alert output is tied off for now until an option is added
to reset all registers (otherwise there will be X propagation).

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-04-07 12:07:38 +01:00