Commit graph

1819 commits

Author SHA1 Message Date
Rupert Swarbrick
27604d466b Add SV assertions to icache <-> core interface in UVM testbench
This adds SVA properties for the cache <-> core interface. Rather than
pollute the actual interfaces, these are wrapped in their own
interface ("ibex_icache_core_protocol_checker").
2020-04-27 08:16:22 +01:00
Rupert Swarbrick
d67847e6b8 Add heartbeat tracking to ICache testbench
This pretty much follows various UVM tutorials, except that we use the
sequencers (ibex_icache_core_sequencer, ibex_icache_mem_sequencer) to
poke the heartbeat objection object if there is one.

Doing this means that we can dispense with the explicit test timeout
in the hjson file: the test will fail if there is no activity on
either interface for 2000 cycles (this number is chosen because the
longest "wait a bit" time is 1200 cycles in the core driver).
2020-04-27 07:56:02 +01:00
Weicai
1b024135c7 [dv] Fix Xcelium compilation
Need these fixes in order to pass Xcelium compile in OpenTitan

Signed-off-by: Weicai Yang <weicai@google.com>
2020-04-25 17:59:32 +01:00
Tom Roberts
eb4913c8f0 [rtl/icache] Fix some issues in icache
- valid_o needs qualifying with output_error to mask X's in the output
  data.
- err_plus2_o should not depend on the output data, only the alignment and
  error status are relevant. Also needs skid_valid_q to mask
  skid_error_q which is not reset.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-04-24 14:11:34 +01:00
Tobias Wölfel
0c2e79a38f Add RV32B parameter option 2020-04-24 14:58:12 +02:00
ganoam
edd8e1d228 [bitmanip] Fix: Oversight in Tracer ZBT DV fail
Failing to read rd in tracer for fsri caused bitmanip DV test to fail.

Signed-off-by: ganoam <gnoam@live.com>
2020-04-24 12:50:42 +02:00
Tom Roberts
73155145c0 [rtl/lsu] Fix bug in pmp error clearing
- pmp_err_q needs to clear once the LSU state machine returns to idle,
  otherwise it will remain set indefinely.
- Relates to #808

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-04-24 09:06:05 +01:00
ganoam
133fef2c2f [bitmanip] Add ZBS Instruction Group
This commit implements the Bit Manipulation Extension SBS instruction
group: sbset[i], sbclr[i], sbinv[i] and sbext[i]. These instructions
set, clear, invert or extract bit rs1[rs2] or rs1[imm] for reg-reg and
reg-imm instructions respectively.

Archtectural details:
        * A multiplexer is added to the shifter structure in order to
          chose between 32'h1, used for the single-bit instructions as
          summarized below, and regular operand_b input.

        * Dedicated bitwise-logic blocks are introduced for multicycle
          shifts and cmix instructions (fsr, fsl, ror, rol),
          single-bit instructions (sbset, sbclr, sbinv, sbext), and
          stanard-ALU and zbb instructions (or, and xor, orn, andn,
          xnor).

Instruction details: All of the zbs instructions rely on sharing the
        existing shifter structure. The instructions are carried out in
        one cycle.

        * sbset, sbclr, sbinv:
                shift_result = 32'h1 << rs2[4:0];
                singlebit_result = rs1 [|, ^ , &~] shift_result;

        * sbext:
                shift_result = rs1 >> rs2[4:0];
                singlebit_result = {31'0,shift_resutl[0]};

Signed-off-by: ganoam <gnoam@live.com>
2020-04-24 08:32:30 +02:00
Udi
321a3d267f [dv] fix spurious LSF enabling
Signed-off-by: Udi <udij@google.com>
2020-04-23 15:15:41 -07:00
Pirmin Vogel
dcf18d86c3 Add missing include
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-04-23 15:44:56 +02:00
Pirmin Vogel
a39cc33f7a Update src_files.yml
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-04-23 15:44:56 +02:00
Philipp Wagner
3c11c95981 [doc] Link to RISC-V Debug Specification
Unfortunately, no versioned links to the PDF are available (at least I
couldn't find one), so only link the entry page for the spec.
2020-04-23 13:48:32 +01:00
Philipp Wagner
82c113764c [doc] Clean up Sphinx warnings 2020-04-23 13:48:32 +01:00
Philipp Wagner
38912e115d [doc] Add note about debug system integration
Ibex only provides the necessary interfaces and core-internal
functionality for run-control debug. To get a fully working,
"debuggable" toplevel design, more components are needed. Describe where
to get them from, and include OpenTitan as an exemplary integration.
2020-04-23 13:48:32 +01:00
Jonathan Kimmitt
bd45e9a355 Reorder statements to prevent latch inference 2020-04-23 12:18:20 +01:00
ganoam
999735568e Use Shared Imd Val Reg with Multdiv Slow
This commit adds support for the shared immediate value register in the
id_stage for the slow implementation of the multdiv module.

Register accum_window_q is now stored in the intermediate value
register.

Signed-off-by: ganoam <gnoam@live.com>
2020-04-23 12:14:45 +02:00
Rupert Swarbrick
cf33bfeae0 Temporarily disable PMP/MEM errors in icache testbench
This allows tests to run to completion. Unfortunately, the core agent
currently has a bug in how it handles errors (if a sequence item
terminates with an error and is followed by a 'req' sequence item, the
test hangs).

I'll fix that in a separate patch soon (and revert this commit), but
don't want the memory agent changes to depend on the fix.
2020-04-23 11:12:45 +01:00
Rupert Swarbrick
5cd874ea71 Initial memory agent for ICache UVM testbench
As with the core agent, this doesn't yet have any proper monitoring,
and the testbench has no scoreboard, so we're not actually checking
anything.

However, it *does* implement a slave agent which can respond to
instruction fetches from the icache. This runs a test to completion,
try:

   make -C dv/uvm/icache/dv run WAVES=1

Note that the timeout in the hjson file was too small, so this bumps
it to a larger value. A later patch will replace the timeout with a
heartbeat monitor, which should be much cleaner.

The exact dance for the UVM reactive slave is complicated. See
dv/uvm/icache/dv/ibex_icache_mem_agent/README.md for the details.
2020-04-23 11:12:45 +01:00
Udi
d0ea6fe449 [dv] update directory paths for riscv-dv coverage
Signed-off-by: Udi <udij@google.com>
2020-04-22 00:46:00 -07:00
Philipp Wagner
6db7e12073 CI: Use packaged version of Verilator
Reduce CI times by using a packaged version of Verilator. The packaging
is done by me on Open Build Service, which provides Verilator packages
for various distributions. The packages are versioned to help choose the
exact version in CI.

This is experimental for now, let's see if that's a suitable path
forward in the longer term.
2020-04-21 11:09:23 +01:00
Tom Roberts
a3a1f9f40a [rtl] Fix icache PMP error handling
- Requests receiving a PMP error need to output a valid indicator, even
  though they will not have received any beats of data

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-04-20 16:05:19 +01:00
Tom Roberts
dc8ba83de4 [memutils] Add support for > 32b memories
Pack > 32bit memory loads into wider RAM instances. Fixes #790

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-04-20 16:04:43 +01:00
Udi
b4e5d91842 [dv] fix PMP compile option, update basic pmp test
Signed-off-by: Udi <udij@google.com>
2020-04-18 15:02:01 -07:00
Michael Gielda
d6d23917ae Fix rst syntax
Signed-off-by: Michael Gielda <mgielda@antmicro.com>
2020-04-18 17:28:06 +01:00
Udi
2be109ecca Update google_riscv-dv to google/riscv-dv@42264b7
Update code from upstream repository https://github.com/google/riscv-
dv to revision 42264b7782a10848935e995063c212893820e561

* fix pmp generation in bare program mode (Udi Jonnalagadda)
* Use literal instead array concatenation (Daniel Mlynek)
* fix access rights (Daniel Mlynek)
* fix in WA fo Aldec Riviera rand cannot be defined in packed struct
  (Daniel Mlynek)
* Fix ius compile error (Weicai Yang)
* fix pmp randomization to adhere to max offset (Udi Jonnalagadda)
* Add options to enable bitmanip by group (google/riscv-dv#532)
  (weicaiyang)
* [pmp] Relative addressing scheme to configure pmpaddr (google/riscv-
  dv#534) (udinator)
* redunant variable ALDEC_PATH removed (danielmlynek)
* riviera 2020.04 beta initial support (danielmlynek)
* Removed  system function call from the gen_section() function
  arguments list. (google/riscv-dv#531) (Dariusz Stachańczyk)
* Dynamic arrays declared as parameter changed to const variables.
  (google/riscv-dv#530) (danielmlynek)
* enhance pmp configuration to make safe region configurable (Udi
  Jonnalagadda)
* Fix a typo in riscvOVPsim (google/riscv-dv#529) (weicaiyang)

Signed-off-by: Udi <udij@google.com>
2020-04-17 17:06:42 -07:00
Dawid Zimonczyk
f8f68945c0 update yaml file for riviera 2020-04-17 09:05:21 -07:00
ganoam
06f50ddeac Bugfix: Generate Erroneous Illegal Insn
This commit fixes three possible cases for erroneous generation of
illegal instruction signals. Also, the bit-slices considered for
decoding ALU instructions are corrected to better reflect their
encoding specifications.

* Fix decoding of orc_b in illegal_insn generation.

* Insn[31] is no longer checked for generation of illegal instructions:
        This bit is part of the rs3 register adress for ternary
        bitmanipulation instructions (zbt).

* Correct bit-slicing for ALU reg-immediate instructions according
        to specification: immediates are encoded in the range
        insn[26:20] in all cases. Where a shift-amount is encoded, bits
        [26:25] will have no effect, but will no longer generate
        illegal instructions.

Signed-off-by: ganoam <gnoam@live.com>
2020-04-17 13:39:38 +02:00
Rupert Swarbrick
5a188342e7 Add clocking blocks to the ibex_icache_core_agent
Since this agent doesn't currently do any monitoring (will be
addressed in a later patch), the monitor_cb clocking block doesn't do
very much at the moment.

The driver_cb clocking block *is* used, though. The input lines are just
those needed to drive things correctly (ready is needed to do
ready/valid signalling properly; err is needed to abort instruction
fetches and do a branch after an error).

I've marked the output signals as negedge: this doesn't really make
any difference to simulation results, since the design samples
everything on posedge, but makes it rather easier to read dumped
waves.
2020-04-17 09:15:08 +01:00
Rupert Swarbrick
bce473b1dc Fix variable names in icache scoreboard code 2020-04-17 09:15:08 +01:00
Rupert Swarbrick
a93fc88f6f Fix scratch-root in icache/dv/Makefile 2020-04-17 09:15:08 +01:00
ganoam
4cb77b8121 [bitmanip] Add ZBT Instruction Group
This commits implements the Bit Manipulateion Extension ZBT instruction
group: cmix, cmov, fsr[i] and fsl. Those are instructions depend on
three ALU operands. Completeion of these instructions takes 2 clock
cycles. Additionally, the rotation shifts rol and ror are made
multicycle instructions.

All multicycle instructions take exactly two cycles to complete.

Architectural additions:

        * Multicycle Stage Register in ID stage.
                multicycle_op_stage_reg

        * Decoder generates alu_multicycle signal, to stall pipeline

        * For all ternary instructions:
                1. cycle: connect alu operands a and b to rs1 and rs2
                          respectively
                2. cycle: connect operands a and be to rs3 and rs2
                          respectively

        * Reduce the physical size of the shifter from 64 bit to 63
                bit: 32-bit operand + 1 bit for arithmetic / one-shift

        * Make rotation shifts multicycle instructions.

Instruction Details:
        * cmov:
                1. store operand a (rs1) in stage reg.
                2. return stage reg output (rs2)  or rs3.

                if rs2 != 0 the output (rs1) is already known in the
                  first cycle. -> variable latency implementation is
                  possible.

        * cmix:
                1. store rs1 & rs2 in stage reg
                2. return stage_reg_q | (rs2 & ~rs3)

                reusing bwlogic from zbb

        * rol/ror: (here: ror)
              shift_amt       = rs2 & 31;
              shift_amt_compl = (32 - shift_amt) & 31
              1. store (rs1 >> shift_amt) in stage reg
              2. return (rs1 << shift_amt_compl) | stage_reg_q

        * fsl/fsr:
        For funnel shifts, the order of applying the shift
        amount or its complement is determined by bit [5] of
        shift_amt. Pseudocode for fsr:

              shift_amt       = rs2 & 63
              shift_amt_compl = (32 - shift_amt[4:0])

              1. if (shift_amt >= 33):
                    store (rs1 >> shift_amt_compl[4:0]) in stage reg
                 else if (shift_amt <0 && shift_amt <= 31):
                    store (rs1 << shift_amt[4:0]) in stage reg
                 else if (shift_amt == 32 || shift_amt == 0):
                    store rs1 in stage reg

              2. if (shift_amt >= 33):
                    return stage_reg_q | (rs3 << shift_amt[4:0])
                 else if (shift_amt <0 && shift_amt <= 31):
                    return stage_reg_q | (rs3 >> shift_amt_compl[4:0])
                 else if (shift_amt == 32):
                    return rs3
                 else if (shift_amt == 0):
                    return rs1

Signed-off-by: ganoam <gnoam@live.com>
2020-04-16 14:03:35 +02:00
Rupert Swarbrick
db6f8f050e Teach check_tool_requirements to check for edalize versions
We need this specific edalize version because recent verilators have
got pickier about string parameter passing, breaking the
"MultiplierImplementation" parameter.

As well as teaching check_tool_requirements.py to get the edalize
version from pip3, this patch also does a bit of tidying up, coping
better if tool_requirements.py is missing or malformed.
2020-04-16 09:38:38 +01:00
Rupert Swarbrick
5c51bc7e4d Rename ibex_icache_agent -> ibex_icache_core_agent
There is more than one icache-specific agent that we need for the
icache testbench, so "ibex_icache_agent" isn't a very helpful name.
This commit was pretty much automated, except for a few spacing
cleanups, with commands like:

    git grep -l ibex_icache_agent | \
      xargs sed -i 's!ibex_icache_agent!ibex_icache_core_agent!g'

(and then rename the directory and files).
2020-04-15 10:52:04 +01:00
Rupert Swarbrick
38422a03bc Minimal code for the 'core agent' in icache UVM testbench
This fills in the sequencer, driver etc. to actually drive signals.
You can "run" a test with

  make -C dv/uvm/icache/dv run

This won't do anything useful (it will stop with a timeout) because
there is no memory agent yet.
2020-04-15 10:04:03 +01:00
Rupert Swarbrick
754a8f3d09 Add a simple Makefile to wrap running dvsim for icache tests
This patch also includes a hacky test timeout. We'll remove this (or
at least make it bigger) when we start actually running data through
the tests, but this is handy for now because it means simulations
finish without having to pkill them.
2020-04-15 10:04:03 +01:00
Rupert Swarbrick
ba9b137488 Switch from 'bool' to 'int' parameters in fusesoc core files
Fusesoc has an unfortunate bug[1] where a boolean parameter which has
default true can't be disabled. For now, just make all our boolean
parameters back into integers again. In the future, when that's fixed,
maybe we should switch things back.

[1] https://github.com/olofk/fusesoc/issues/392
2020-04-14 15:30:26 +01:00
Greg Chadwick
5da42b1594 [ci] Fix multi-config CI
Multi-config CI wasn't actually trying multiple configurations. This
fixes that issue and uses a less fragile method of producing fusesoc
options. They are generated once and stored in a variable so we cannot
accidentally break one or more steps by using an incorrect
ibex_config.py command in one step whilst using a correct
ibex_config.py in the display step (which is also intended to check the
ibex_config.py command is correct).
2020-04-14 15:08:00 +01:00
Greg Chadwick
8ce249bf6f [lint] Add waiver for RV32B parameter 2020-04-14 15:08:00 +01:00
Greg Chadwick
aeb92bc7d4 Add RV32B parameter to ibex_core_tracing/ibex_riscv_compliance 2020-04-14 15:08:00 +01:00
Rupert Swarbrick
56883f19ed Clarifications in icache detailed documentation
The new information is:

  - Branch addresses must be 16-bit aligned.

  - Explicitly allow top 16 bits of rdata to change when lower 16 bits
    contain a compressed instruction.

  - Explicitly allow the core to drop ready without valid.

I've also rejigged the layout slightly, improving (I think!) the
description of compressed and uncompressed instructions.
2020-04-13 14:29:34 +01:00
Tom Roberts
97a50d7f12 [rtl] Add fixed time execution of branches
- A new parameter and a run-time control bit (DataIndTiming and
  data_ind_timing) enabling different behaviour for running security critical
  code sections.
- In the new mode, all branches act as if taken, with not-taken
  branches executing as a branch to the next instruction.
- This should give similar execution time/power characteristics
  regardless of the branch condition.
- Note that with the BranchTargetALU, branches stall an extra cycle in
  secure mode to avoid factoring the branch-taken decision into the
  branch target address mux.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-04-13 14:27:40 +01:00
Udi
58c0e33334 [dv] fix timing issue in ebreakmu_test
Signed-off-by: Udi <udij@google.com>
2020-04-09 09:06:32 -07:00
Rupert Swarbrick
98046adfbc Initial icache testplan
This doesn't list all that many entries, possibly because the icache
doesn't really have many modes of operation (enabled/disabled;
invalidating).
2020-04-09 13:09:12 +01:00
Rupert Swarbrick
e1bb1ed82e Fill out an initial DV plan for the icache
This currently has quite a lot of TBD sections, but should hopefully
describe my plan for the UVM testing reasonably well.
2020-04-09 09:22:13 +01:00
Greg Chadwick
f73da9ef3b [dv] Remove IUS support
IUS lacks support for certain language features used in Ibex (such as
use of $clog2 in localparam definitions) so remove it as a simulator
that can be used by dv.
2020-04-08 18:17:34 +01:00
Udi
47678a855a [dv] Fix running on LSF
Signed-off-by: Udi <udij@google.com>
2020-04-08 09:21:09 -07:00
Greg Chadwick
1d2959e00a [dv] Record failure on log processing error
Previous to this change the entire process would die on an issue with
processing a single log. This alters it so this will just add to the
failure count with the error logged and the log processing continued to
its end.
2020-04-07 09:47:57 +01:00
Greg Chadwick
75148da58c [dv] Quit on UVM errors by default 2020-04-07 09:47:57 +01:00
Greg Chadwick
0852120462 [rtl] Fix xprop issues in cs_registers
Alter how logic for csr_wreq was written to not propagate X when using
certain more pessimistic modes of x propagation in simulation.
2020-04-07 09:08:26 +01:00
Greg Chadwick
cb8afccb7c [rtl] Modify ASSERT_KNOWN uses to work with xprop
When xprop is enabled various case and if/else constructs will propagate
X leading to failures in ASSERT_KNOWN. This introduces enable terms to
various ASSERT_KNOWN uses that would otherwise fail without them.

prim_assert.sv changes copied across from OpenTitan respository.
2020-04-07 09:08:26 +01:00