Commit graph

1819 commits

Author SHA1 Message Date
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
Pirmin Vogel
b1df836940 Controller FSM: simplify debug_mode_q-related control
The FSM now uses input signals for interrupt and debug request handling
that depend on whether the core is in debug mode. This avoids the need
for many `debug_mode_q` guards and somewhat simplifies the FSM.

If in debug mode, the core shall not handle interrupts according to the
spec anyway.
2019-07-15 15:33:29 +01:00
Pirmin Vogel
0dafd51b97 Generate instr_ret/compressed inside ID stage
This commit moves the generation of these signals into the ID stage
to generate it with more accurate timing. More precisely, an
instruction is now considered as retired once it has been completely
executed and not once the next instruction is pushed into the IF-ID
pipeline register.

Also, it no longer depends on whether the instruction was valid or
illegal. For RVFI and the tracer, also illegal instructions must be
considered.
2019-07-15 13:20:26 +01:00
taoliug
1d75e4c8b9
Update google_riscv-dv to 084fa3a (#152)
Update code from upstream repository https://github.com/google/riscv-
dv to revision 084fa3a4debb682b34c9b7f9b17342bb06619a3b

* Merge pull request #35 from google/dev (taoliug)
* Add timeout mechanism for the regression script (Tao Liu)
* Merge pull request #34 from google/dev (taoliug)
* Add check for the toolchain path setup (Tao Liu)
2019-07-12 11:06:46 -07:00
taoliug
98cfad26f3
Use new ibex_core_tracer as DUT (#148) 2019-07-11 19:35:47 -07:00
taoliug
b0d2c0ff48
Add support for debug mode and interrupt test (#146) 2019-07-11 11:19:06 -07:00
Pirmin Vogel
c1bceb2f89 ID stage: remove unneeded branch_in_id signal 2019-07-11 17:35:12 +01:00
Pirmin Vogel
2319e1ec87 Use decoder regfile write enable for non-LSU/mult/div ops
Previsouly, the regfile write enable output of the decoder was always
fed through the WB FSM which is unnecessary except for stores and
mult/div operations.
2019-07-11 17:35:12 +01:00
Pirmin Vogel
5b0e81ecd2 Move store/load_err_i into separate exc_req_lsu signal 2019-07-11 17:35:12 +01:00
Pirmin Vogel
795b5bd651 Cleanup performance monitor signals 2019-07-11 17:35:12 +01:00
Pirmin Vogel
6b5d26bae2 Cleanup interplay of IF and ID stage (controller)
Once the core is executing, the IF stage now only gets two signals
from the controller: One to clear the instruction valid output and one
to prevent the IF stage from pushing new instructions.

The former `if_valid_o` of the IF stage has been renamed to clarify
that this is not a valid bit but just the write enable for the
pipeline register.
2019-07-11 17:35:12 +01:00
Pirmin Vogel
1456e8e0da Rework register file write enable mux
The register file shall not be written upon illegal CSR operations
and when the core is idle (waiting for new instructions). Otherwise
the write enable signal from the WB FSM/decoder is used.
2019-07-11 17:35:12 +01:00
Pirmin Vogel
e47b500c50 Remove obsolete signals between controller and ID stage 2019-07-11 17:35:12 +01:00
Pirmin Vogel
45dadcd5bd Cleanup controller 2019-07-11 17:35:12 +01:00
Pirmin Vogel
35a5a737a7 Do not set PC when setting exceptions registers in single stepping
In the next state, the PC is set to jump into debug anyway.
2019-07-11 17:35:12 +01:00
Pirmin Vogel
3e1c8df311 Correctly prioritize exceptions in controller 2019-07-11 17:35:12 +01:00
Pirmin Vogel
95c0dc0556 Fix handling of single stepping
Single stepping should execute exactly one more instruction, not abort
any running (multicycle) instructions, and only enter debug mode after
the current instruction is finished. In case the current instruction
leads to an exception, the exception registers must be set accordingly,
but the core must jump into debug mode instead of the exception
handler.

Previous to this commit, single stepping would immediately jump into
debug mode and ignore any exceptions.
2019-07-11 17:35:12 +01:00
Pirmin Vogel
9ef3c13f87 Fix control for interrupts, debug request and multicycle instr
This commit makes sure that interrupts and debug requests do not
interrupt currently running multicycle instructions. Priority is
given 1) to the currently running instruction, possible exceptions
caused by this instruction, 2) debug requests, 3) interrupt
requests.

Previously, currently running instructions were aborted upon
incoming debug and interrupt requests, which could corrupt the
processor state and lead to exceptions being ignored.

This commit resolves #108 and #121.
2019-07-11 17:35:12 +01:00
Pirmin Vogel
fd6426f52c Replace pipe_flush signal by wfi_insn
This signal is triggered iff a `wfi` instruction is decoded.
2019-07-11 17:35:12 +01:00
{“Tao
205db5e6ea Change return to exit in sim script (fixes #137) 2019-07-11 16:39:02 +01:00
Tobias Woelfel
6ebc0001ec Ibex example Arty A7-100T
Simple example of how Ibex can be used to run software on a FPGA target.
2019-07-11 16:09:49 +01:00
Tobias Wölfel
1df87f4400 Add fence instruction to tracer (#134) 2019-07-11 13:25:18 +01:00
Tobias Wölfel
edccb325e4 Example for Ibex tracer usage 2019-07-11 13:25:18 +01:00
Tobias Wölfel
014c753dde Tracer rewrite
Instantiate tracer module in a separate core file and use only RVFI
signals.
2019-07-11 13:25:18 +01:00
Tobias Wölfel
1e2d5b7eda Rename opcode OP-IMM
Align name with RISC-V spec.
2019-07-11 10:04:56 +01:00
Tobias Wölfel
27d2addaa4 Rename fence opcode (#138) 2019-07-11 10:04:56 +01:00
Tobias Wölfel
08e9ba0165 Reorder opcode enum 2019-07-11 10:04:56 +01:00
taoliug
b203a0f7c7
Add bash shebang to sim script(fixes #133) (#135) 2019-07-10 23:13:21 -07:00
Pirmin Vogel
8b4e337118 Decoder: fix drive conflict, set jump_set_o for JALR
This commit solves problems reported by @jeanlouismaquet in #130.
2019-07-10 15:24:21 +01:00
Alex Bradbury
36079d784b Reference the performance counter docs from the CSR doc page 2019-07-10 15:00:55 +01:00
Alex Bradbury
81db2eb1a4 Fix doc typo introduced in #128 2019-07-10 15:00:55 +01:00
Alex Bradbury
33b7904a12 Document mtvec as WARL rather than read-only
mtvec is hard-wired, but isn't read-only as writes don't cause an
exception.
2019-07-10 09:41:08 +01:00
Alex Bradbury
ce042bd350 Document that misa is hard-wired
Fixes #123.
2019-07-10 09:41:08 +01:00
taoliug
ec89314a20
Update google_riscv-dv to 949552f (#127)
Update code from upstream repository https://github.com/google/riscv-
dv to revision 949552f964eec9d058c7c90889bdd5b80d1e60ad

* Merge pull request #33 from google/dev (taoliug)
* Add control for the privileged CSR checking (Tao Liu)
* Merge pull request #32 from google/dev (taoliug)
* Fix minor issue in comparing script (Tao Liu)
2019-07-09 13:13:30 -07:00
Pirmin Vogel
73e94fb6f8 Comment on RV32E register address check in compressed decoder
It is not necessary to do this check in the compressed decoder. If a
compressed instruction in RV32E tries to access any register x16 - x31,
the regular decoder triggers an illegal instruction exception and the
controller writes the actual faulting (compressed) instruction to
`mtval`.
2019-07-09 17:56:58 +01:00
Pirmin Vogel
5093e0a0d2 Explicitly set alu_op_x_mux_sel in decoder
To make the regfile address check in RV32E not triggering false alarms
when accessing reg x16 - x31, the decoder should only set the muxes
for the regfile output when the instruction actually requires the
regfile output.

It is cleaner to explicitly set the `alu_op_x_mux_sel` signals to
`OP_X_REG_X` instead of relying on the default assignment if they
are really needed.
2019-07-09 17:56:58 +01:00
Pirmin Vogel
9ed49b9a17 Do not select regfile in decoder if not required
Otherwise, the regfile address check in RV32E can trigger false alarms
for some instructions and arguments (e.g. immediates).
2019-07-09 17:56:58 +01:00
Pirmin Vogel
a3bfcd0f04 Decoder: enable checking of register file addresses for RV32E 2019-07-09 17:56:58 +01:00
Pirmin Vogel
2478b5f978 Check rs1 & rd for non-CSR system instructions
For `ecall`, `ebreak`, `mret`, `dret`, `wfi` these two fields must be 0.
If they are not zero, the decoder generates an illegal instruction
exception.
2019-07-09 17:08:21 +01:00
Pirmin Vogel
6a1ac272da Fix linting errors 2019-07-09 15:39:06 +01:00
Pirmin Vogel
8613e880fc LSU cleanup, abort misaligned ops if first part fails
This commit cleans up the LSU and fixes two bugs:

1. If a misalgned transaction creates an error during the first
   part of the transaction, the second part is not pushed out and
   the transaction is aborted. Previously, the LSU tried to output
   also the second part but did not adhere to the defined
   protocol.

2. Misaligned operations are again working correctly. Previously,
   the generation of the byte enable and the alignment of read
   data was broken as these operations rely on the updated
   address from the AGU to have the same alignment as the
   original address.

This partially resolves #121.
2019-07-09 15:39:06 +01:00
Pirmin Vogel
c84ca25755 Cleanup CSR-related signals 2019-07-09 09:46:48 +01:00
Pirmin Vogel
1174603e76 Rework ID stage and decoder
This commit moves logic directly related to the decoder from the ID
stage into the decoder. This logic includes:
- Generation of immediates and decoder-based mux selectors
- Generation of register file addresses
- CSR operand check and manipulation depending on value in `rs1`
- Register file address check for RV32E (still disabled)

The muxes themselves stay in the ID stage as their control signals also
depend also on other, non-decoder-based signals (LSU, EX, WB FSM).
2019-07-09 09:46:48 +01:00