Commit graph

1061 commits

Author SHA1 Message Date
Philipp Wagner
24a9c64bf1 Add simulation for RISC-V compliance testing
This adds a Verilator simulation of Ibex for use in RISC-V Compliance
Testing. In addition to ibex itself, the simulation contains a RAM and
a memory-mapped helper module for the test software to interact with the
outside world. The test framework uses this to dump a "test signature",
which is written to a certain part of the memory, and to end the
simulation. (In the future, this could be extended to include printf()
like functionality.)
2019-08-05 15:49:15 +01:00
Philipp Wagner
b72f5db6bd DV: Add verilator simulation utility 2019-08-05 15:49:15 +01:00
Philipp Wagner
677153f549 Setup Verilator lint and waivers
This adds Verilator lint support to our fusesoc core file. A waiver file
is created to waive all well-understood lint warnings. The UNOPTFLAT
warnings are not well understood at the moment, they are waived for now
and further discussion is expected to happen in a GH issue (referenced
in the waiver).

Run with

```
fusesoc --cores-root . run --target=lint lowrisc:ibex:ibex_core
```

The waiver file support requires edalize >= 0.1.5.
2019-08-05 15:36:55 +01:00
Philipp Wagner
3c5e998445 Document specifications we aim to support
Fixes #124
2019-08-05 11:34:14 +01:00
Rhys Thomas
187f6c9c6f Fixed broken URL in readme. 2019-08-05 10:42:39 +01:00
taoliug
54fac2954a
Move DV README.md to doc/verification.rst (#208) 2019-08-02 15:05:02 -07:00
taoliug
584ceda381 Add README.md for the DV flow (#207) 2019-08-02 13:45:33 -07:00
taoliug
463f518424 Integrate with new end-to-end simulation (#206) 2019-08-02 08:31:12 -07:00
taoliug
ba5c63b8d1 Update google_riscv-dv to a07e0a7 (#203)
Update code from upstream repository https://github.com/google/riscv-
dv to revision a07e0a726edf0230314c08d31546eecbed23054b

* Merge pull request #53 from google/flow (taoliug)
* Update README file for the new flow (Tao Liu)
* Merge pull request #52 from google/flow (taoliug)
* Add timeout mechanism to the flow (Tao Liu)
* Merge pull request #51 from google/flow (taoliug)
* Simulation flow update (Tao Liu)
* Merge pull request #50 from udinator/master (taoliug)
* added license for csr_template.yaml (Udi)
* Merge pull request #49 from google/dev (taoliug)
* Update log process script (Tao Liu)
* Merge pull request #48 from google/dev (taoliug)
* Fix illegal instruction issue (Tao Liu)
* Merge pull request #47 from google/dev (taoliug)
* Refactor the simulation flow (Tao Liu)
* Merge pull request #45 from danghai/master (taoliug)
* Add .gitignore to remove untracked files (danghai)
* Fix warning from Questa optmize (danghai)
* Add optimize log file for Questa simulator (danghai)
* New YAML based simulation flow (Tao Liu)
* Merge pull request #40 from scottj97/typos-redone (taoliug)
* Fix typos in comments (Scott Johnson)
* Fix typos/grammar in README (Scott Johnson)
* Merge pull request #43 from udinator/master (taoliug)
* use hex format in YAML description (Udi)
* CSR test description (Udi)
* removed run script (Udi)
* Modified CSR test generation code to adhere to style guidelines.
  (Udi)
* Merge pull request #41 from vandanaprabhu/questa (taoliug)
* CSR Generation Script and YAML template (Udi)
* Prevent Xcelium from attempting to run a simulation during the
  compile step (Scott Johnson)
* Document support for Questa (Scott Johnson)
* Fix simulation-time warnings from Mentor Questa (Scott Johnson)
* Fix compile warnings from Mentor Questa (Scott Johnson)
* Fix warning from Questa compiler (Scott Johnson)
* Fix warning from Questa compiler (Scott Johnson)
* Adding support for using the Questa simulator (Vandana Prabhu)
* Pass proper seed to Cadence Xcelium simulator (Scott Johnson)
* Convert compile commands to functions instead of variables (Scott
  Johnson)
2019-08-01 09:53:26 -07:00
Rahul Behl
76ac3ef658 Updates to the sim timescale option
- Updated the timescale option to not include "=" in between the
    timescale directive and the value passed. See #181 for further
    details
2019-07-29 16:00:35 +01:00
Pirmin Vogel
cee2e9396f Remove csr_restore_dret_i signal
This signal was used to restore `mstatus` when executing DRET.
But this is not needed as `mstatus` is not modified when entering
debug mode.
2019-07-29 15:55:48 +01:00
Pirmin Vogel
964e62afee CSRs: remove `define for mstatus CSR handling 2019-07-29 15:55:48 +01:00
Pirmin Vogel
a7f344b02a Avoid linting errors 2019-07-29 15:52:42 +01:00
Pirmin Vogel
6d72aebc16 Correct cause number for illegal instruction exception
This bug has beed reported by @taoliug. This resolves #195.
2019-07-26 11:38:09 +01:00
Pirmin Vogel
ef696bf1f7 src_files.yml: correct path of source files 2019-07-26 10:31:29 +01:00
Pirmin Vogel
1aa276dbc0 RVFI: re-add accidentally removed rvfi_intr signal
This signal is now set during the first instruction after the PC has
been set to enter a trap handler.
2019-07-26 09:30:45 +01:00
taoliug
511b205226
Enable WFI test in regression (#190) 2019-07-24 13:52:00 -07:00
taoliug
2bf1ab923a
Fix interrtup test (#189)
Update TB for the new interrupt interface
2019-07-24 11:46:18 -07:00
Pirmin Vogel
0dee0ff1ec Adapt interrupt IF for Arty example, tracer and TB 2019-07-24 18:58:26 +01:00
Pirmin Vogel
72c77f855d Remove legacy interrupt controller
This removal got partially lost while rebasing for PR #149.
2019-07-24 15:57:36 +01:00
Pirmin Vogel
09aad340b1 Update documentation of interrupt framework 2019-07-24 14:22:00 +01:00
Pirmin Vogel
be975eaa9d Add mstack CSRs for recoverable NMIs
To enable recoverable non-maskeable interrupts (NMIs), an additional
set of registers is needed to backup `mstatus.MPP/MPIE` as well as
`mepc` and `mcause`. This is currently not part of the RISC-V Priv
Spec (v1.11). This commit adds these registers called `mstack` CSRs
according to the following proposal:
https://github.com/riscv/riscv-isa-manual/issues/261

These CSRs are only accessed by the hardware and not accessible to
software running on the core.
2019-07-24 14:22:00 +01:00
Pirmin Vogel
327d836281 Add non-maskeable interrupt (NMI) 2019-07-24 14:22:00 +01:00
Pirmin Vogel
71a33e1ca1 Add local fast interrupts, remove legacy interrupts
This commit adds 15 local fast interrupt lines managed through
the `mie` and `mip` CSRs directly, and removes the old legacy
interrupts including the internal controller.
2019-07-24 14:22:00 +01:00
Pirmin Vogel
c2fffe0440 Add mip and mie CSRs + interrupts
This commit adds the `mip` and `mie` CSRs as well as the software,
timer and external interrupts.

Currently these interrupts are overlapped with some of the legacy
interrupts, i.e., the core will jump to the same address for different
interrupts. For example, the software interrupt has the same ID as
legacy interrupt #3. Thus, the handler must read the `mip` register
to find out whether the interrupt routine has been entered because of
the software interrupt or the legacy interrupt.

Eventually, the number of legacy interrupts will be reduced to avoid
this overlapping, and they will be connected to the `mie` and `mip`
CSRs directly.
2019-07-24 14:22:00 +01:00
Philipp Wagner
1a487c4626 ibex_tracer: Move imports into module 2019-07-23 19:45:48 +01:00
Philipp Wagner
bcaead3ea6 ibex_tracer: Remove Verilator gating
We want people to get an error when compiling the tracer with Verilator:
this file should not be used with Verilator. An error is better than
silently getting the wrong result.
2019-07-23 19:45:48 +01:00
Philipp Wagner
62f3573f2b Rework how tracer is instantiated and called
This change is slighly painful, but a necessary cleanup around the
tracer.

- We now provide a separate core file for the tracer, called
  "ibex_tracer.core" (in line with "ibex_tracer.sv"). The core is called
  "lowrisc:ibex:ibex_tracer".
- The toplevel wrapper with tracing enabled got renamed to
  "ibex_core_tracing.sv", and the core file is correspondingly called
  "ibex_core_tracing.core. The core in it is called
  "lowrisc:ibex:ibex_core_tracing".
- Finally to keep symmetry, the toplevel of Ibex itself got renamed in
  the core file from "lowrisc:ibex:ibex" to "lowrisc:ibex:ibex_core".
  This ensures that we have the same name for the core file, the source
  entry point, and the core name.

IMPORTANT NOTE:
If you apply this change and use fusesoc, you need to adjust the name of
the core dependency from "lowrisc:ibex:ibex" to
"lowrisc:ibex:ibex_core".
2019-07-23 19:45:48 +01:00
taoliug
53ce0142e2
Update google_riscv-dv to 112dcc2 (#180)
Update code from upstream repository https://github.com/google/riscv-
dv to revision 112dcc2e669f124dfe48c35a09477603c3ccb180

* Merge pull request #39 from google/dev (taoliug)
* CSR instruction update (Tao Liu)
2019-07-23 07:10:45 -07:00
taoliug
bc61f0bfd9
Fix compile issue caused by design changes (#179) 2019-07-19 18:01:12 -07:00
taoliug
74e841b0cd
Update google_riscv-dv to 4e0d063 (#178)
Update code from upstream repository https://github.com/google/riscv-
dv to revision 4e0d063fea574cfae55c5bb627771b69d9899899

* Merge pull request #38 from google/dev (taoliug)
* Fix illegal instruction test issue Fix Xcelium compile failure #37
  (Tao Liu)
2019-07-19 16:15:12 -07:00
Philipp Wagner
428d057c4a Rename ibex_[tracer_]define to ibex_[tracer_]pkg
This file doesn't contain defines any more, but a normal SV package.

The diff is best viewed without whitespace changes, as the reindents
cause a lof of diff noise.

Fixes lowrisc/ibex#173
2019-07-19 11:34:40 +01:00
Philipp Wagner
6d533f07a4 Remove tracer defines from other description files
The ibex_tracer_define.sv file was removed from the FuseSoC core files,
but not from the src_files.yml (for Bender) and the .f file.

This is in line with the changes made in
f12b94c2a2.
2019-07-19 11:34:40 +01:00
Pirmin Vogel
e4383589eb Decoder: remove reg-reg load, make LWU illegal
The custom reg-reg load instruction was added in the original design but
is no longer needed. This commit removes it. Also, load instructions
with `instr[14:12] == 3'b110` are now decoded as illegal.

This resolves #25.
2019-07-19 11:29:33 +01:00
Pirmin Vogel
04f4cd44f6 Decoder: avoid setting PC upon illegal JALR instructions
Without this commit, the PC is still set to a possible wrong jump
target on illegal JALR instructions ultimately causing the wrong PC
being saved to `mepc` during the illegal instruction exception.

This bug has been reported by @taoliug. This commit resolves #170.
2019-07-18 15:52:26 +01:00
Pirmin Vogel
63702b3e75 ID/EX stage: do not write to register file upon load errors
This commit fixes the write back FSM to not store values returned from
memory to the register file when the LSU is reporting a load error.

This bug was reported by @ivanmgribeiro. This commit resolves #162.
2019-07-18 11:28:13 +01:00
Tobias Wölfel
f12b94c2a2 Remove unneeded tracer define 2019-07-18 11:09:38 +02:00
Pirmin Vogel
010985a395 Controller: save next PC to dpc CSR upon a halt request
This commit changes the controller to save the PC of the next
instruction to the dpc CSR when entering debug mode upon a halt
request instead of the PC of the current instruction (only valid
for EBREAK instructions).

This bug was reported by @taoliug. This resolves #164.
2019-07-17 11:17:37 +01:00
Pirmin Vogel
5925449848 Decoder: fix signaling and detection of illegal instructions
This commit fixes two bugs in the decoder:

1. For illegal branch condition selections, the illegal instruction
condition must be signaled as long as the instruction is being executed
and not just during the first cycle, as the controller cannot interrupt
multicycle instructions.

2. Illegal instructions should also be signaled when `instr[28]` is set
for register-register ALU operations. Previously, these were not
signaled as the original design used `instr[28]` to encode custom bit-
manipulation instructions.

These bugs were discovered by @taoliug. This resolves issue #163.
2019-07-17 11:04:15 +01:00
taoliug
c96ece0429
fix ibex regression script (#165) 2019-07-16 17:56:39 -07:00
Tobias Wölfel
b7ef64b62d Extension of example for tracer
Add more input test data.
2019-07-16 12:43:38 +02:00
Tobias Wölfel
ff50ac8c59 Uncompressed instructions for tracer (#154)
The tracer does not support the decoding of compressed instructions.
Forward the internally used decoded instruction and use it for tracer.
2019-07-16 12:43:38 +02:00
Tobias Wölfel
d059979af6 RVFI based on core state (#151, fix #147)
The RVFI implementation make use of signals from the decoder and
controller to detect the state of the processor.
Especially the signal for a new and retired instruction.
2019-07-16 12:43:38 +02:00
Tobias Wölfel
b8e1f552b4 Cleanup unused define 2019-07-16 12:43:38 +02:00
Pirmin Vogel
a38389e3a2 Remove linting errors for RVFI-related signals 2019-07-16 10:12:01 +01:00
taoliug
30f2d6db64
debug mode related TB updates (#160) 2019-07-15 16:36:18 -07:00
taoliug
6b49f32019
Update google_riscv-dv to 2e5a401 (#159)
Update code from upstream repository https://github.com/google/riscv-
dv to revision 2e5a40145a367ac3b04f78fee02c5011022719fd

* Merge pull request #36 from google/dev (taoliug)
* Add basic debug mode support (Tao Liu)
2019-07-15 15:44:16 -07:00
taoliug
4eaa57041d
fix debug_seq runtime options, update trace processing script (#158) 2019-07-15 13:25:15 -07:00
Pirmin Vogel
a775abd967 Fix dpc CSR not updated (#157)
* Controller: remove impossible condition for `DBG_TAKEN_IF`

There is no way to jump into `DBG_TAKEN_IF` because of an EBREAK
instruction. Thus, this case also does not need to be checked.

* Controller: do not enter debug when `debug_req_i` goes low

With this commit, the core is prevented from entering debug mode when
the debug request signal is deasserted during that procedure.
Previously, the core would still enter debug mode but not updating the
debug CSR.

This resolves #153 reported by @taoliug.

* Update ibex_controller.sv
2019-07-15 10:37:33 -07:00
Pirmin Vogel
c437008310 CSRs: replace _n suffix of register signals by _d 2019-07-15 15:33:29 +01:00