Commit graph

505 commits

Author SHA1 Message Date
Hailin
13bbaf72d9 [test] Connect FPU subsystem 2023-03-31 15:58:32 +02:00
Hailin
cfa51bebcf [rtl] Performance Counters
Add performance counters for CV-XIF
2023-03-31 15:29:50 +02:00
Hailin
129af7a53b [rtl] Add memory and memory result interfaces
This commit adds memory interface and memory result interface
of the RISC-V Extension Interface.
2023-03-31 15:29:50 +02:00
Hailin
8ad0d7c9d4 [rtl] Add issue, commit, and result interfaces
This commit adds issue interface, commit interface,
and result interface of the RISC-V Extension Interface.
2022-10-04 12:10:51 +02:00
Hailin
36ea2210de [rtl] Change parameter type
This commit changes parameter type from 'int' to 'unsigned int'
according to CV-XIF standard update.
2022-06-22 16:37:05 +02:00
Hailin
d533faf086 [rtl] Add compressed interface
This commit adds compressed interface of the RISC-V Extension Interface.
This commit have passed verification with pseudo compressed accelerator.
2022-05-05 13:50:02 +02:00
Rupert Swarbrick
0a9f5ed1da [rtl] Remove "mispredict" ports from icache
These are no longer needed: a previous commit has moved the logic that
handles misprediction into the IF stage and branch_mispredict_i was
dead zero.
2022-04-04 16:56:04 +01:00
Rupert Swarbrick
618f1f08bd [rtl] Remove "mispredict" ports from prefetch buffer
These are no longer needed: a previous commit has moved the logic that
handles misprediction into the IF stage and branch_mispredict_i was
dead zero.
2022-04-04 16:56:04 +01:00
Rupert Swarbrick
59a4d11c10 [rtl] Combine the two branch signals in the IF stage
The prefetch buffer and icache both treat the branch_i and
branch_mispredict_i signals identically, so it's a bit cleaner to pull
that treatment up into ibex_if_stage.sv

This commit doesn't change the modules below: it just passes zeros for
the "mispredict" version. Removing those ports will be done in a
follow-up commit.
2022-04-04 16:56:04 +01:00
Greg Chadwick
ead2174c1a Introduce internal interrupt concept
An internal interrupt triggers an NMI. A single one is implemented, one
on integrity errors being seen in load data. This replaces a synchronous
exception on an integrity error which caused timing issues.
2022-04-01 17:00:23 +01:00
Greg Chadwick
aee235cfa6 [fcov] Add and improve functional coverage 2022-03-28 14:53:27 +01:00
Greg Chadwick
d88e5f8ce4 [rtl] Refactor pmp logic 2022-03-28 14:53:27 +01:00
Greg Chadwick
90918dff1d [rtl] Refactor illegal instruction logic
This groups the various different illegal instructions categories within
ibex_id_stage rather than spreading them between ibex_id_stage and
ibex_controller.
2022-03-28 14:53:27 +01:00
Greg Chadwick
9fd512bdbd [rtl] Refactor illegal debug CSR logic 2022-03-28 14:53:27 +01: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
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
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
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
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
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
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
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
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
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
Michael Schaffner
5350c13ae3 [ibex_top] Use correct ECC codeword for '0 reset in regfile
Signed-off-by: Michael Schaffner <msf@google.com>
2021-12-08 08:54:54 +00:00
Pirmin Vogel
c78acac8cc [rtl, bitmanip] Add xperm.[nbh] instruction (Zbp, draft v.0.93)
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2021-12-06 11:14:49 +01:00
Pirmin Vogel
40dab87448 [rtl, bitmanip] Clarify situation around zext.[bh] pseudo-instructions
This is related to lowRISC/Ibex#1228.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2021-12-03 22:43:05 +01:00
Pirmin Vogel
da85ce5ecf [rtl] Fix typo in comment
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2021-12-03 22:43:05 +01:00
Pirmin Vogel
16d6f5ea2b [rtl, bitmanip] Align Zbb implementation with draft v.0.93 and v.1.0.0
This invovles the following changes:
- Rename pcnt to cpop
- Switch encoding of max and minu
- Remove rev from Balanced version, only available in Full version via
  grev (Zbp)
- Include sext.b/h (previously in Zb_tmp)
- Remove slo[i] and sro[i] from Balanced version, only available in Full
  version (Zbp)

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2021-12-03 22:43:05 +01:00
Pirmin Vogel
e765b4dfec [rtl, bitmanip] Align Zbs implementation with draft v.0.93 and v.1.0.0
This only involves dropping the `s` from the instruction names, i.e.,
sbext becomes bext etc.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2021-12-03 22:43:05 +01:00
Pirmin Vogel
71b43a83e2 [rtl, bitmanip] Rename bext/bdep to bcompress/bdecompress
This change is related to the bitmanip draft version 0.94. It's needed
as in draft version 0.93 as well as in version 1.00 sbext from Zbs
changes to bext, leading to two completely different instructions having
the same name.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2021-12-03 22:43:05 +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
Sam Shahrestani
ab4041c439 Move NT branch addr calculation to ID stage 2021-11-18 13:05:19 +00:00
Michael Munday
c35472abb9 [bitmanip][zba] Add support for Zba (address calculation) extension
Add support for the Zba extension added in v0.93 of the bit manipulation
specification (unchanged in v1.0.0). The new instructions added are:

  - sh1add: rd = (rs1 << 1) + rs2
  - sh2add: rd = (rs1 << 2) + rs2
  - sh3add: rd = (rs1 << 3) + rs2

The instructions are single cycle and have been implemented using the
adder in the ALU.

Signed-off-by: Michael Munday <mike.munday@lowrisc.org>
2021-11-01 09:58:01 +00: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
Greg Chadwick
f4e3eefcfb [rtl,dv,doc] Flip priority of fast interrupts
This matches the priority used in Spike.

This also fixes an issue in the DV where the priority of
external/software/timer interrupts wasn't calculated correctly.
2021-10-15 11:30:35 +01:00
zeeshanrafique23
873e2281cf remove unused RD in branch insn from tracer 2021-10-01 17:51:18 +01:00
Rupert Swarbrick
305f0a80ea Add missing parameters to ibex_top_tracing 2021-09-27 11:06:04 +01:00
Greg Chadwick
31b2f6c863 [rtl] Fix retired instruction counters
When the writeback stage is present the retired instruction counter
(minstret) and the retired compressed instruction counter could see an
off by one error when an instruction was in the writeback stage when
reading the counters. With this fix the ID stage observes the
incremented value of the counters when an instruction that would
increment them is in writeback.
2021-09-17 12:28:10 +01:00