Commit graph

1004 commits

Author SHA1 Message Date
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
Pirmin Vogel
d64eaad817 Rework WB FSM in ID stage, remove combinational loop 2019-07-09 09:46:48 +01:00
Pirmin Vogel
7924431144 Rework register file write data mux 2019-07-09 09:46:48 +01:00
Pirmin Vogel
9e46bc50d5 Move jump_set generation from WB FSM into decoder 2019-07-09 09:46:48 +01:00
Pirmin Vogel
24ab4ae65c Remove decoder MUX signals for jump and branch
These signals do not need to be generated by the WB FSM inside the ID
stage and be fed back into the decoder. They simply depend on whether
the instruction is new (we execute for the first cycle) or not.
2019-07-09 09:46:48 +01:00
Pirmin Vogel
7e6452ac64 Multdiv: rename state signals 2019-07-09 09:46:48 +01:00
Pirmin Vogel
1082b85ff0 Rework interaction between EX block and ID stage
The EX block actually signals when its output is valid, and not when it
is ready to accept new input. The LSU valid signal is not needed inside
the EX block and can thus be fed directly to the ID stage.
2019-07-09 09:46:48 +01:00
Pirmin Vogel
d477fbc46b Correct wrong spelling in signal name 2019-07-09 09:46:48 +01:00
Pirmin Vogel
a6c2846346 Move stall and IF-ID control from ID stage into controller 2019-07-09 09:46:48 +01:00
Pirmin Vogel
3eb147dbc2 Prevent illegal instructions from propagating out of decoder
This commit makes sure that if any instruction is detected as being
illegal inside the decoder, the decoder does not set the control
signals to let the illegal instruction affect the register file,
LSU, EX, WB, CSRs. Previously, this was only the case for some but
but not all instructions.

Note that this is not sufficient to prevent instructions detected
as illegal elsewhere from affecting the processor state. For example,
when using RV32E, an instruction can be detected to use unavailable
registers outside the decoder in the ID stage. But it is cleaner to
handle all illegal instructions detected in the decoder similarly.
2019-07-09 09:46:48 +01:00
Pirmin Vogel
d973618ce8 Move logic to ignore decoder output out of decoder into ID stage
The decoder shall decode the instruction only. The handling of stalls
is not related to instruction decoding.
2019-07-09 09:46:48 +01:00
taoliug
6d09fb1060
Add interrupt agent (#116) 2019-07-01 18:25:37 -07:00
Pirmin Vogel
c86f71e724 Switch to new signal name in tracer instantiation
This got forgotten when renaming the signal inside ID stage in
commit b22a6a10de.
2019-07-01 17:56:59 +01:00
taoliug
2d66834f14
Integrate riscv-dv upstream changes (#107)
* Remove all local patches

* Update google_riscv-dv to 00739df

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

* Merge pull request #30 from google/dev (taoliug)
* Fix LSF options (Tao Liu)
* Refactoring to make extension easier (Tao Liu)
* Merge pull request #29 from google/dev (taoliug)
* Add a sample program (Tao Liu)
* Merge pull request #28 from google/dev (taoliug)
* Move riscv_core_setting to a separate folder (Tao Liu)
* Merge pull request #27 from google/dev (taoliug)
* Add ebreak/wfi test, more regression control (Tao Liu)
* Merge pull request #26 from google/dev (taoliug)
* Add support for GPR based comparison (Tao Liu)

* Add ibex extensions for riscv_dv
2019-07-01 08:59:31 -07:00
Tobias Wölfel
08f535ebb2 Fix updated signal name 2019-07-01 14:34:02 +01:00
Tobias Wölfel
b8be998978 Fix RVFI rd write enable 2019-07-01 14:09:34 +01:00