Commit graph

2223 commits

Author SHA1 Message Date
Prajwala Puttappa
e6eb4fb11d [ibex, dv] Added a sequence to toggle fetch_enable_i pin
Ibex has a top-level `fetch_enable_i` input. When set to on (noting it's a multi-bit signal for
security hardening though only the bottom bit is looked at for non secure ibex) Ibex executes
normally. When set to off Ibex will stop executing. Randomly toggling it should have no functional
effect on Ibex's behaviour.
The fetch enable sequence will randomly toggle the value of `fetch_enable_i` with a configurable
bias between the 'On' value and all other values.
2022-03-09 10:14:46 +00:00
Greg Chadwick
3438b77921 [rtl] Add minor alert for icache ECC error 2022-03-09 08:57:24 +00:00
Greg Chadwick
f89e721040 [icache, rtl] Fix ECC error indication
Data RAM ECC needs qualifying with hit/miss.
2022-03-09 08:57:24 +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
Prajwala Puttappa
af0c027867 [ibex, dv] Makes delays between req, gnt and rvalid configurable
This commit adds functionalty to the memory response agent to make delays more
configurable.
There are two delays
- Delay between req and gnt
- Delay between gnt and rvalid

For each of these delays we have three modes:
* Fully random delay
* Fixed delay
* Biased delay. Randomised delays but allow biasing towards 0 delay, to give a mix of runs with back
to back transfers with no delay and some with delays.

Signed-off-by: Prajwala Puttappa <prajwalaputtappa@lowrisc.org>
2022-03-08 13:48:32 +00:00
Prajwala Puttappa
46c397501d [ibex, dv] Added new base, interrupt, debug and mem error sequences
Added an independent base test with following capabilities:
* chooses between single run, multiples runs or infinite runs (existing sequence
does this via the `num_of_interations` variable).
* interval between runs can be fixed or random, with 0 delay between runs possible.
For random intervals there should be a way to bias them more towards 0 delay
(e.g. specify 75% of delays should 0 with the rest randomly chosen).

Added an interrupt sequence that inherits from the above base sequence.
It has following capabilities:
* chooses the number of interrupts to raise
* specifies the interval between interrupt being raised and dropped
* a mask to specify interrupts that shouldn't be raised.

Added a debug sequence with the only functionality to specify the interval between
the debug request being raised and dropped

Added a sequence to corrupt instruction and data memory.

Signed-off-by: Prajwala Puttappa <prajwalaputtappa@lowrisc.org>
2022-03-08 13:43:49 +00:00
Rupert Swarbrick
c15f3b8888 [icache] Define some fake DPI functions to simplify linking
This is triggered by the fact that if the ICache parameter is false
then we don't instantiate the ibex_icache module. For verilator
simulations, the module is then discarded entirely, which means that
its two DPI functions are not defined. That's unfortunate because
we're also compiling the code in scrambled_ecc32_mem_area.cc, which
expects the functions to be defined.

The obvious solution (don't include scrambled_ecc32_mem_area.cc if you
don't have an icache) isn't easy to do, because FuseSoc doesn't
currently allow us to use parameters to configure its dependency
tree (see fusesoc issue 438 for a discussion).

The super-clever solution that I came up with before(!) was to declare
these symbols as weak in the C++ code. That way, we can do a runtime
check to make sure that no-one is silly enough to call them without an
icache, but everything will still build properly either way.

Unfortunately, that doesn't work well with xcelium simulations.
Xcelium turns out to compile all the C++ code into one .so library and
generate functions for exported DPI functions in another. These two
solibs then get loaded at runtime with dlopen(). But this doesn't work
with weak symbols: in fact, it seems you end up with the C++ version
every time. Boo!

So let's be stupider about it and define (bogus) versions of the DPI
functions in this case. Fortunately, both of them are designed to
return zero on failure so we can just return zero and needn't worry
too much.

The idea is that when this lands, we can revert the OpenTitan change
that switched the C++ code to using weak symbols and Xcelium
simulations will start working.
2022-03-03 13:48:10 +00:00
Prajwala Puttappa
bdf2f2b440 [ibex, dv] Added agent configuration for ibex_mem_intf_response_agent
Defining agent configuration for any agent is a standard UVM flow and is
a cleaner flow for defining delay between driving sequence items,
passing virtual interface etc.

Agent configuration has been added to the existing agent to make delay
configuration more flexible in the future.

Signed-off-by: Prajwala Puttappa <prajwalaputtappa@lowrisc.org>
2022-02-28 14:44:58 +00:00
Greg Chadwick
0f69d4972c [dv] Add X assertions for top-level IO
Ensure all top-level inputs and outputs are known when they are
expected to be known.
2022-02-24 14:53:21 +00:00
Greg Chadwick
58bc6f27ab [doc] Add details about icache latency to DIT docs
When the icache is enabled and data independent timing is required
variable fetch latency due to cache hit or miss may introduce
undesirable timing behaviour. This adds explicit mention of this to the
documentation.
2022-02-23 08:48:12 +00:00
Greg Chadwick
d3bd063662 [rtl] Add prim_buf for security critical signals
A sufficiently agressive optimiser may optimise these away as under
normal functioning they effectively don't do anything. They are purely
to detect the presence of induced faults.
2022-02-22 08:57:31 +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
Rupert Swarbrick
3475b9106c Refer to a specific tag for the ibex-cosim version of Spike
We're going to want to make a couple more releases of Spike, cleaving
a bit closer to the upstream repository. Let's be explicit about which
version people should get.
2022-02-21 09:43:11 +00:00
Rupert Swarbrick
302bb65161 [doc] Update bitmanip list in integration.rst 2022-02-17 16:19:59 +00:00
Rupert Swarbrick
36a9abbf1c Use ifndef to avoid re-declaration warnings in *cosim_dpi.svh 2022-02-17 16:19:03 +00:00
Rupert Swarbrick
9f14922382 [dv] Construct ISA string from RTL parameters for cosim tests 2022-02-17 16:06:53 +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
Rupert Swarbrick
e84e7de53f Fix narrowing conversion warning in cosim_dpi.cc 2022-02-17 10:17:22 +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
Rupert Swarbrick
336173b4d9 Re-enable bitmanip tests 2022-02-16 12:26:36 +00:00
Rupert Swarbrick
bc4bafd8ca [docs] Update description of ISS versions
We can now point at a single version of Spike (the "ibex_cosim"
branch, until we've managed to upstream things properly). And ditch
the OVPsim stuff: that's not going to be supported again any time
soon.
2022-02-16 12:26:36 +00:00
Rupert Swarbrick
6f6cafaa4d [ci] Bump Spike version to get cosim implementation
This will only have an effect on our private CI, which picks up this
spike build from the toolnas. The build is the ibex_cosim branch,
which contains the stuff we need for the recent cosim support. It's
also new enough to support the v1.0+0.93 bitmanip flavour that we
support in the RTL.
2022-02-15 17:27:44 +00:00
Rupert Swarbrick
5691ef1a45 [ci] Bump RISC-V toolchain version to get bitmanip support
This version should have support for bitmanip 1.00+0.93, the version
that we target in the RTL.
2022-02-15 15:17:52 +00:00
fabian
bbc48a0c34 Add srecord as simple_system prerequisite 2022-02-09 09:33:07 +00:00
Rupert Swarbrick
4482af1789 [doc] Fix inline literal syntax in icache.rst 2022-02-02 10:19:13 +00:00
Rupert Swarbrick
4bcc0fae6a [doc] Fix botched table layout
My commit 46b7e07 moved the right-most pipe symbol, which causes
Sphinx to skip the rest of the file. Oops!
2022-02-02 10:19:13 +00:00
Rupert Swarbrick
46b7e07098 [doc] Fix RV32B enum description 2022-01-27 16:02:44 +00:00
Greg Chadwick
69dfa6f8da [ci] Add missing python3-dev dependency
Private CI is broken without this. The public CI runs on azure agents
which already have this installed.
2022-01-26 15:39:38 +00:00
Greg Chadwick
c0f67946f2 [rtl,doc] Add double fault detection.
Fixes #1117
2022-01-25 15:05:39 +00:00
Greg Chadwick
97fa5cf280 [rtl,doc] Add customisable PMP reset values
Fixes #1423
2022-01-24 10:01:36 +00:00
Srikrishna Iyer
7c7e0e6d70 [ibex_tracer] Void cast function calls
...whose return value is ignored. This cleans up a compile time warning.

Signed-off-by: Srikrishna Iyer <sriyer@google.com>
2022-01-20 16:59:22 -08: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
Greg Chadwick
e53b033962 [examples/fpga] Fix memory interface
Logic driving instr_gnt/data_gnt violated Ibex memory protocol. It just
happened to work until a recent change.

Fixes #1500
2022-01-14 09:00:48 +00:00
Greg Chadwick
2ec8d7433e [examples/fpga] Use 64 kB memory by default
The 256 kB is too large for the Arty-A7 with the A7-35T. Only use it
for the FPGA power analysis configuration.
2022-01-14 09:00:48 +00:00
Greg Chadwick
dcdd982686 [lint] Lint fix for RndCntLfsrX parameters
This doesn't produce a lint warning in the version of verilator
currently used in CI but does produce a warning in newer versions.
2022-01-14 09:00:48 +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
Greg Chadwick
756610800b [doc] Fix config and expand max-width of docs 2022-01-11 12:49:04 +00:00
Greg Chadwick
596b4d7e92 [doc] Add new Ibex testplan 2022-01-11 12:49:04 +00: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
Greg Chadwick
a5c55f132e [dv] Add initial coverage plan 2022-01-06 13:47:04 +00:00
Pirmin Vogel
410ffd349d [bitmanip, doc] Update info on bitmanip support and area numbers
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2021-12-16 14:18:00 +01:00
Pirmin Vogel
119ac89130 [syn] Add missing package dependency
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2021-12-16 14:18:00 +01:00
Pirmin Vogel
36c9f4e569 [rtl] Remove redundant comments in decoder
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2021-12-16 14:18:00 +01:00
Pirmin Vogel
92a95cac32 [bitmanip] Add new configuration option for OpenTitan Earl Grey
RV32BOTEarlGrey selects the Zba, Zbb, Zbc, Zbs sub-extensions from
v.1.0.0 of the bitmanip spec and the Zbf, Zbp, Zbr, Zbt sub-extensions
from draft v.0.93. Zbe (bcompress/bdecompress) is supported by RV32BFull
only.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2021-12-16 14:18:00 +01:00
Pirmin Vogel
a33a91b232 [lint] Fix some AscentLint errors
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2021-12-13 17:52:20 +00:00
Greg Chadwick
fd1195a148 [dv] Set UVM_VERBOSITY to UVM_LOW
Vendored in VIP from OpenTitan is very noisy at default UVM_MEDIUM
level, producing multi-GB log files in some instances.
2021-12-10 15:28:43 +00:00
Greg Chadwick
f1cd3bffc6 [dv] Fix bad reference to instr_req_out
instr_req_out no longer exists now PMP is handled on the IF/ID
interface.
2021-12-10 10:40:22 +00:00
Tom Roberts
72a892d62c [rtl] Move PMP checking to IF stage output
- Instruction addresses are now checked in the IF stage, after the cache
  and after the prefetch buffer.
- To deal with unaligned instructions, the PMP logic checks the current
  address and the next in parallel.
- The spec_branch timing hack has been removed as it's no longer
  relevant with the PMP logic moved.
- Various updates made to the icache testbench to account for the
  changes.
- Relates to #1471

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-12-09 18:06:53 +00:00
Pirmin Vogel
fccdd63992 [rtl] Replace always_ff with always @(posedge .. in FPGA regfile
This resolves lowRISC/Ibex#1485.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2021-12-09 16:35:31 +01:00
Greg Chadwick
fa3df3b8ee [dv] Fix PMP error handling for icache
The icache uses a single bit to signify an error. This could either be a
PMP error or a fetch error. Add extra probing so the testbench can
differentiate between the two cases.
2021-12-09 14:08:05 +00:00