Commit graph

1082 commits

Author SHA1 Message Date
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
Pirmin Vogel
015f09881a add missing begin/end in multiline statements 2019-06-03 15:49:21 +01:00
Tao Liu
bdb089d456 Update google_riscv-dv to 215e064
Update code from upstream repository https://github.com/google/riscv-
dv to revision 215e0646ae9909aa0e78d6e91f4f33ed77f95e43
2019-05-31 17:39:28 +01:00
Pirmin Vogel
5319734180 Fix decoding of C.LI, C.LUI, C.SRLI, C.SRAI, C.SSLI
Hints encoded in these compressed instructions must decode into hints
in the corresponding base instructions. This resolves #51.
2019-05-31 17:26:18 +01:00
taoliug
cd15ce88be Add riscv-dv vendor in script and patches (#52)
Add riscv-dv vendor configuration and patches as basis for including the RISC-V DV code in a follow-up commit.
2019-05-31 08:58:21 +01:00
Ioannis Karageorgos
382a6c096c Fix non-unique case bug .
The `nop` instruction ( `32'h00_00_00_13` ) cannot be distinguished from masked `addi` ( `17'b?, 3'b000, 5'b?, 7'h13` ) in `unique casex` statement. The other way around is not a problem, as `addi` cannot have both registers as 0x0. 
This can be also fixed by replacing `unique casex` with `priority casex`. However, in my opinion, it is not a good solution as it may hide future bugs like this.
2019-05-29 09:34:09 +01:00
Pirmin Vogel
4020a39e99 Make prefetch FSM state signals lowercase 2019-05-24 15:52:58 +01:00
Pirmin Vogel
ab4c8699fb Simplify default assignments to enum types
This commit simplifies the assignment of literals to enum types in
default cases by:
- defining or using existing enum values for all-zero values,
- feeding a single `1'bX` into the type cast instead of exact width
  (the tools are fine with that).
2019-05-24 15:52:58 +01:00
Pirmin Vogel
036f963990 Enforce line wrapping after 100 chars according to style guide 2019-05-24 15:52:58 +01:00
Philipp Wagner
409892ec8c Fix handling of C.MV and C.JR
- Decoding must give precedence to rs2 (i.e. instr_i[6:2]) to
  switch between C.MV and C.JR.
  "C.MV is only valid when rs2̸=x0; the code points with rs2=x0
   correspond to the C.JR instruction. The code points with rs2̸=x0
   and rd=x0 are HINTs."

- C.JR is only valid with rs1==x0. Throw an illegal instruction
  exception if that's not the case.
  "C.JR is only valid when rs1̸=x0; the code point with rs1=x0
   is reserved." RV32 Spec, p103

All spec references based on RISC-V Unprivileged ISA
V20190305-Base-Ratification
2019-05-23 10:05:02 +01:00
Philipp Wagner
3de95df060 Fix decoding of C.ADD and C.EBREAK
The RV32C Specification, p106 (RISC-V Unprivileged ISA
V20190305-Base-Ratification) states:

C.ADD adds the values in registers rd and rs2 and writes the result to
register rd. C.ADD expands into add rd, rd, rs2. C.ADD is only valid
when rs2̸=x0; the code points with rs2=x0 correspond to the C.JALR and
C.EBREAK instructions. The code points with rs2̸=x0 and rd=x0 are HINTs.

This essentially says: rs2 == x0 takes precedence when decoding, that's
instr[6:2]. The current code was written with the assumption of
instr[11:7] taking precedence, thus incorrectly decoding a C.ADD HINT.

Fixes lowrisc/ibex#64
2019-05-23 10:05:02 +01:00
Pirmin Vogel
145269fdc8 Replace non-unique case with unique case + default 2019-05-22 17:02:18 +01:00
Pirmin Vogel
0305803e18 Fix alignment in tracer, add INSTR_LOAD/STORE parameter 2019-05-22 17:02:18 +01:00
Pirmin Vogel
709127ca4a Switch to logic [31:0] type for tracer instruction mask parameters
The instruction masks for the tracer are defined as parameters and contain
`?` literals, which can resolve to `1`, `0` or `X` in simulation. To cover
the `X`, the type of the masks must be changed from `int unsigned`
(standard for parameters according to guidelines) to `logic [31:0]`.
2019-05-22 17:02:18 +01:00
Pirmin Vogel
4809737b43 Correct order of exceptions in documentation 2019-05-22 17:02:18 +01:00
Pirmin Vogel
a44e312e74 Update doc to add data_err_i and LSU exceptions 2019-05-21 15:22:21 +01:00
Pirmin Vogel
3cb868597f Remove unnecessary {} to avoid linting errors 2019-05-21 15:22:21 +01:00
Pirmin Vogel
e37fc203dc Adjust FSM state signal names to guidelines 2019-05-21 15:22:21 +01:00
Pirmin Vogel
db75d30547 Replace non-unique case constructs by unique case
Our coding guidelines require the usage of `unique case` constructs with
proper `default` cases. This commit implements this change and also makes sure
that potential `'X` are propagated.
2019-05-21 15:22:21 +01:00
Pirmin Vogel
74abc47b71 Add missing default in unique case, propagate 'X in FSM states
This commit adds a `default` to all `unique case` statements. Also, in case
FSMs reach an undefined state, the `'X` is propagated to ease detection
in simulation. Both these changes are required by our coding guidelines.
2019-05-21 15:22:21 +01:00
Pirmin Vogel
76cd32e936 Add capability to detect and react on load/store errors 2019-05-21 15:22:21 +01:00