Commit graph

88 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Pirmin Vogel
2e697121b2 Specify width of literals cast to enums to avoid linting errors 2019-05-15 16:07:25 +01:00
Pirmin Vogel
f84ed3ecd3 Use lower_snake_case for code block labels 2019-05-15 10:42:48 +01:00
Pirmin Vogel
c9efb99d97 Use 'or' instead of ',' inside '@( )' statements 2019-05-15 10:42:48 +01:00
Pirmin Vogel
fde6e505df Make sure all inputs/outputs use _i/_o suffices 2019-05-15 10:42:48 +01:00
Pirmin Vogel
967834db0c Use cast before assignment to enum type to avoid Vivado errors 2019-05-13 17:37:54 +01:00
Pirmin Vogel
49fa87ba44 Use exc_cause in IF stage directly, add missing casts to enum type
In case of interrupts, `exc_cause` carries the interrupt ID in the lower
bits and its MSB is 0 anyway. There is no need to forward only the lower
bits to the IF stage.
2019-05-10 11:11:19 +01:00
Pirmin Vogel
53f2fb9350 Remove unused signals 2019-05-10 11:11:19 +01:00
Pirmin Vogel
580379df5a Replace non-unique case with if/else 2019-05-10 11:11:19 +01:00
Pirmin Vogel
6ac7f844a1 Replace hard coded parameters and signal widths by enum types 2019-05-07 13:30:07 +01:00
Philipp Wagner
f9ad280d0c Cleanup includes and defines
- Move ibex_tracer_defines.sv and ibex_defines.sv out of the 'include'
  directory, since these files are not actually included.
- Remove ibex_config.sv, it's mostly unused code. The remaining defines,
  SYNTHESIS, ASIC_SYNTHESIS, TRACE_EXECUTION, and CHECK_MISALIGNED should
  be set through command-line flags to the simulation/synthesis tools.

Initial version by Nils Gräf.
2019-05-03 17:30:29 +01:00
Alex Bradbury
7e81f6f4eb Standardise "subheadings" in code comments
The code base made extensive use of ASCII art headings/subheadings in
comments to delineate code. Switch to a more space efficient and easier
to edit format:

/////////
// Foo //
/////////
2019-04-26 15:09:00 +01:00
Philipp Wagner
48c0b34b38 Various fixes to debug implementation
This commit updates the RISC-V debug spec-compliant debug implementation
by incorporating changes mostly done by Robert Balas on the RI5CY core.

Most notably, single stepping works after this patch is applied.

With this patch the RISC-V debug compliance test built into OpenOCD
passes fully.
2019-04-26 15:09:00 +01:00
Philipp Wagner
4d0d59db8e Include executed instruction in dbg message
If an illegal instruction is executed we display a message in
simulation. This message now also contains the instruction itself, not
only the program counter.
2019-04-26 15:09:00 +01:00
Philipp Wagner
401e7e1e3c Switch to execution-based debug
This commit switches the ibex core from a custom debug system to an
execution-based, standard RISC-V debug system. The port is based on a
port done for the RI5CY core.
2019-04-26 15:09:00 +01:00
Scott Johnson
6b0475744d Code cleanup
Fix errors and warnings reported by lint tools, and clean up the code
according to our coding style. Move all imports into the module.
2019-04-26 15:09:00 +01:00
Philipp Wagner
8813f57624 Add Doxygen-style module descriptions
We leave the existing longer headers in place for author information.
2019-04-26 15:08:30 +01:00
Alex Bradbury
27e68bd76e Convert from Solderpad to standard Apache 2.0 license
This change has been informed by advice from the lowRISC legal
committee.

The Solderpad 0.51 license states "the Licensor permits any Work
licensed under this License, at the option of the Licensee, to be
treated as licensed under the Apache License Version 2.0". We use this
freedom to convert license markings to Apache 2.0. This commit ensures
that we retain all authorship and copyright attribution information.
2019-04-26 15:05:17 +01:00
Philipp Wagner
e9e5a719bc Move RTL code into rtl/ directory
This gives us a bit of space in the source tree for documentation,
verification, utilities, and much more.
2019-04-26 15:05:17 +01:00
Renamed from ibex_controller.sv (Browse further)