Commit graph

952 commits

Author SHA1 Message Date
Pirmin Vogel
9749120f05 Add mscratch CSR 2019-06-28 18:55:26 +01:00
Pirmin Vogel
2967113edd Mask LSB of mepc CSR to 0 for writes initiated by software 2019-06-28 18:55:26 +01:00
Pirmin Vogel
07214f626d Switch to RISC-V spec compliant trap handling
For exceptions, the Ibex always jumps to the trap vector base address
specified in `mtvec`. The exception cause is specified in `mcause` with
possibly additional information in `mtval`.

Interrupts are handled in vectored mode as before.
2019-06-28 18:55:26 +01:00
Pirmin Vogel
e9bdbaddd6 Make mtvec CSR compliant to spec
The LSBs indicate the vector mode. They are set to vectored for Ibex.
2019-06-28 18:55:26 +01:00
Pirmin Vogel
8ed9ff5bde Reduce width of mcause CSR 2019-06-28 18:55:26 +01:00
Pirmin Vogel
b22a6a10de Add mtval CSR
`mtval` can provide additional information to trap handlers.
In case of load/store errors, it holds the failing address.
For illegal instruction exceptions, it holds the illegal instruction.
2019-06-28 18:55:26 +01:00
Pirmin Vogel
5171ee79f0 Rework AGU mux for misaligned loads/stores
This operation only depends on the LSU detecting a misaligned address.
Previously, the mux control was scattered across ID stage, controller
and decoder. With this commit, all the relevant code for this operation
is moved into the ID stage and also streamlined.
2019-06-28 18:55:26 +01:00
Pirmin Vogel
71a1ccc08d Order CSR assignments according to their address 2019-06-28 18:55:26 +01:00
Philipp Wagner
d00db65227 Avoid WIDTH lint warnings in Verilator
Verilator displays the following lint warnings:

%Warning-WIDTH: ../src/lowrisc_ibex_ibex_0.1/rtl/ibex_cs_registers.sv💯 Operator SHIFTL expects 32 bits on the LHS, but LHS's VARREF 'RV32E' generates 1 bits.
                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.
%Warning-WIDTH: ../src/lowrisc_ibex_ibex_0.1/rtl/ibex_cs_registers.sv:103: Operator SHIFTL expects 32 bits on the LHS, but LHS's VARREF 'RV32M' generates 1 bits.
%Warning-WIDTH: ../src/lowrisc_ibex_ibex_0.1/rtl/ibex_cs_registers.sv:108: Operator SHIFTL expects 32 bits on the LHS, but LHS's VARREF 'MXL' generates 2 bits.
%Warning-WIDTH: ../src/lowrisc_ibex_ibex_0.1/rtl/ibex_register_file_ff.sv:63: Operator EQ expects 32 bits on the LHS, but LHS's VARREF 'waddr_a_i' generates 5 bits.

It's not quite clear (to me) from reading the SV spec if this is a bug
in Verilator lint, or if this is actually a code bug.

Alternative proposal for #92
2019-06-27 17:54:11 +01:00
Pirmin Vogel
4f928b3ad0 Doc: Fix typos 2019-06-26 14:09:23 +01:00
Pirmin Vogel
2ed71a499a Make dummy clock gating module compatible with latch-based reg file
The latch-based register file needs a clock gating cell that is
transparent for the clock enable signal only during the low clock
phase.
2019-06-26 14:09:23 +01:00
Pirmin Vogel
89b0d3a200 Clarify application scenarios of register file versions 2019-06-26 14:09:23 +01:00
Pirmin Vogel
d8cf729c21 Rename ibex_register_file.sv to ibex_register_file_latch.sv 2019-06-26 14:09:23 +01:00
Philipp Wagner
d811c04cce Disable performance counters by default
Performance counters are an optional feature. Disable them by default to
avoid users having them enabled unknowingly and paying the (rather
large) area price for it.
2019-06-25 17:46:07 +01:00
Pirmin Vogel
37d9322785 Change format of assertions and add display output 2019-06-24 21:37:53 +02:00
Pirmin Vogel
b3c6c7ddbf Correct LSU assertion
Errors are signaled with `rvalid` and not with `gnt`.
2019-06-24 21:37:53 +02:00
Pirmin Vogel
6306436465 Add assertions for instruction and data address alignment 2019-06-24 21:37:53 +02:00
Pirmin Vogel
b7919a7bd3 Make sure instr address output is word aligned
The core handles unaligned instruction fetches by doing two separate
word-aligned instruction fetches. Without this commit, the core can
still output addresses which are not word aligned and relies on the
memory to ignore the LSBs of the address. This is not safe.
2019-06-24 21:37:53 +02:00
Pirmin Vogel
182e10048b Make sure data address output is word aligned
The core handles unaligned accesses by doing two separate word-aligned
accesses. Without this commit, the core can still output addresses
which are not word aligned and relies on the memory to ignore the LSBs
of the address. This is not safe.
2019-06-24 21:37:53 +02:00
Pirmin Vogel
0ecf71e8e1 Correct performance counter increment
Prior to this commit, the next counter value was not based on the
current value.
2019-06-24 21:34:56 +02:00
Pirmin Vogel
157eb5bc11 Fix performance counters
Without this commit, the performance counters mhpmcounter3(h)-
mhpmcounter31(h) are optimized away during synthesis due to
`X`-values in the address decoder masks. This commit replaces
these masks with offsets and instead masks the input address
before comparison.

To enable the synthesizer optimizing away unused counters,
the masks for these counters are set to zero.
2019-06-24 21:34:56 +02:00
Pirmin Vogel
92803bb8e5 Make sure CSR set/clear/write op only change the CSR during one cycle
Without this change, the core can continue to write CSRs during multiple
subsequent clock cycles when being stalled. This can corrupt CSR (e.g.
performance counters).
2019-06-24 17:02:40 +02:00
Pirmin Vogel
dfc475ea4a README.md: Add reference to our own Verilog coding style guide 2019-06-21 14:42:41 +01:00
Pirmin Vogel
ec3b246f16 Doc: Add debug_req_i to blockdiagram 2019-06-21 14:42:41 +01:00
Tobias Woelfel
826da1522f Fix vim setting suggestion 2019-06-19 14:39:41 +02:00
Pirmin Vogel
d363a3d3b6 Fix linting errors 2019-06-18 13:43:16 +01:00
Tobias Wölfel
8bada6a0b9 Fix RVFI signal name 2019-06-18 00:08:24 +01:00
taoliug
cc8aed4ed2
Fix tcl path (#73) 2019-06-07 15:01:19 -07:00
taoliug
52bc23cc39
Add coverage dump options (#71) 2019-06-07 13:58:06 -07:00
Pirmin Vogel
05d00737b2 README.md: Update, include additional references
This commit helps to make the README.md the main entry point into the
Ibex world. It does so by updating it and including additional
references to a style guide, a guide on how to write commit messages,
references to our Zulip chat and the original Zero-riscy paper.
2019-06-07 13:49:12 +01:00
Pirmin Vogel
d2fd88dc67 Doc: Add new top-level block diagram 2019-06-07 13:49:12 +01:00
Pirmin Vogel
d7810941e3 Doc: Adapt RVFI section, add connection in intro 2019-06-07 13:49:12 +01:00
Pirmin Vogel
b32078138c Doc: Adjust upper left corner: background color, logo etc. 2019-06-07 13:49:12 +01:00
Pirmin Vogel
5c4e6cb4e3 Doc: Update and cleanup 2019-06-07 13:49:12 +01:00
taoliug
d77bc49595
Import riscv-dv @b4bd0c6cff0456111be966a11c1bd0aeec2d96e4 (#69)
* update ibex patch file

* Update google_riscv-dv to b4bd0c6

Update code from upstream repository https://github.com/google/riscv-
dv to revision b4bd0c6cff0456111be966a11c1bd0aeec2d96e4

* Merge pull request #24 from google/dev (taoliug)
* Add option to skip reading scratch register (Tao Liu)
2019-06-06 17:27:20 -07:00
Tobias Wölfel
4bbe38fa52 Update documentation external link 2019-06-06 13:11:26 +01:00
Tobias Wölfel
90796e3800 Add RVFI documentation 2019-06-06 11:21:06 +01:00
Tobias Wölfel
632f3dcda6 RVFI memory access
Unaligned access is allowed.
2019-06-06 11:21:06 +01:00
Tobias Wölfel
951437a2c9 RVFI implementation
Generate signals for RISC-V Formal Verification.

Output of signals is partially delayed to get values before and after
the completion of an instruction.

The timing of the output is based on the detection of a retired
instruction. This change is detected on changes of the instruction
code itself, changes of the program counter and the valid signal.

The compressed instruction is forwarded because the decoder maps the
compressed instruction into the corresponding uncompressed instruction,
but the original instruction is needed to detect the correct format.

Register output based on the requirements from RVFI.
2019-06-06 11:21:06 +01:00
Philipp Wagner
6d81447d67 Doc: Switch back to upstream Sphinx
Upstream has now released a new version which includes Stefan's patch to
correctly build the PDFs.

Fixes #41
2019-06-05 12:56:58 +01:00
taoliug
50c73dcf58
fix ibex TB top compilation issue (#58) 2019-06-04 10:55:22 -07:00
taoliug
7ec87d8044
Update google_riscv-dv to be14080 (#57)
Update code from upstream repository https://github.com/google/riscv-
dv to revision be14080425cc3b9a5b33c6c29962893c890c62ee

* Merge pull request #23 from google/dev (taoliug)
* Add privileged CSR implementation configuration (Tao Liu)
2019-06-03 15:05:35 -07:00
taoliug
2782ae9677 Add UVM testbench
This adds a UVM testbench and associated tooling for Ibex. 
The tooling requires Synopsys VCS to run.
2019-06-03 16:45:00 +01:00
Pirmin Vogel
effa61c684 Update documentation on CSRs and performance counters 2019-06-03 15:49:21 +01:00
Pirmin Vogel
d5a89b571f Modify illegal clear and set CSR ops to be read-only
The specifications mandate that CSRRS/CSRRC instructions must not write to
CSRs from x0. Similarly, CSRRSI/CSRRCI instructions must not write a zero
immediate to CSRs. With this commit, these conditions are checked and
corresponding CSR operations are changed to read-only.
2019-06-03 15:49:21 +01:00
Pirmin Vogel
a3b6c28ebd Remove legacy performance counters 2019-06-03 15:49:21 +01:00
Pirmin Vogel
d4b349766e Cause illegal instruction exception for access violations on CSRs
This commit adds checks to CSR accesses. If a CSR is accessed that is not
implemented, or if a read-only CSR is written to, an illegal instruction
exception is caused.
2019-06-03 15:49:21 +01:00
Pirmin Vogel
3ea6744f81 Add standard compliant performance counters
This commit adds the CSRs `mcycle(h)`, `minstret(h)`, `mcountinhibit` and
mhpmcounter3(h) - mhpmcounter31(h) as well as `mphmevent3 - mhpmevent31`.
The registers `mphmevent3 - mhpmevent31` are hardwired and cannot be
reconfigured.
2019-06-03 15:49:21 +01:00
Pirmin Vogel
7a5c8ef5c6 Fix clear operation for performance counters in CSR.
This operation was not properly implemented. Resolves #16.
2019-06-03 15:49:21 +01:00
Pirmin Vogel
cb320352b9 Correct bit numbers in PCMR documentation.
These numbers were inverted in the documentation. This commit resolves #15.
2019-06-03 15:49:21 +01:00