Commit graph

113 commits

Author SHA1 Message Date
Hailin
8ad0d7c9d4 [rtl] Add issue, commit, and result interfaces
This commit adds issue interface, commit interface,
and result interface of the RISC-V Extension Interface.
2022-10-04 12:10:51 +02:00
Greg Chadwick
ead2174c1a Introduce internal interrupt concept
An internal interrupt triggers an NMI. A single one is implemented, one
on integrity errors being seen in load data. This replaces a synchronous
exception on an integrity error which caused timing issues.
2022-04-01 17:00:23 +01:00
Greg Chadwick
aee235cfa6 [fcov] Add and improve functional coverage 2022-03-28 14:53:27 +01:00
Greg Chadwick
90918dff1d [rtl] Refactor illegal instruction logic
This groups the various different illegal instructions categories within
ibex_id_stage rather than spreading them between ibex_id_stage and
ibex_controller.
2022-03-28 14:53:27 +01:00
Tom Roberts
72a892d62c [rtl] Move PMP checking to IF stage output
- Instruction addresses are now checked in the IF stage, after the cache
  and after the prefetch buffer.
- To deal with unaligned instructions, the PMP logic checks the current
  address and the next in parallel.
- The spec_branch timing hack has been removed as it's no longer
  relevant with the PMP logic moved.
- Various updates made to the icache testbench to account for the
  changes.
- Relates to #1471

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-12-09 18:06:53 +00:00
Greg Chadwick
c03cc91a5d [rtl] RVFI changes and extensions for co-simulation
This adds some new `rvfi_ext` signals that are needed by the
co-simulation environment.

It also fixes/alters `rvfi_trap`. Previously it wouldn't work correctly
in various cases. Now it is fully functional, though it's meaning
includes more trap cases than the RVFI spec strictly includes. It is now
set for any instruction that produces a synchronous trap (everything bar
interrupts).
2021-10-15 11:30:35 +01:00
Greg Chadwick
f4e3eefcfb [rtl,dv,doc] Flip priority of fast interrupts
This matches the priority used in Spike.

This also fixes an issue in the DV where the priority of
external/software/timer interrupts wasn't calculated correctly.
2021-10-15 11:30:35 +01:00
Greg Chadwick
75c030b776 [rtl] Factor ID exceptions into instruction kill
Without this an instruction taking an exception will enter WB whilst
simultaneously remaining in ID. This didn't cause any known functional
issues as in the scenarios it occurred the RF write was disabled and the
WB stage eventually gets flushed. However it's still bad behaviour and
could lead to functional issues when RTL changes. It also eases the
co-simulation DV implementation.
2021-09-17 12:28:10 +01:00
Philipp Wagner
a25790abf9 [style] Indent module header with two spaces
Both the parameter and the port list in a module header should be
indented with two spaces, according to our style guide.
2021-08-31 15:30:28 +02:00
Philipp Wagner
be27bc8bcf [style] Fix whitespace issues around operators
Our style guide typically require a single whitespace around operators.
2021-08-31 15:30:28 +02:00
Greg Chadwick
69e715b287 [dv] Improvements to functional coverage
This adds more instruction categories and corrects various issues in the
categorization code. Further cross coverage has been added including
illegal bins to remove bins that cannot occur.

The concept of using SVAs with cross coverage has been dropped. The
systemverilog scheduling model makes the concept unworkable.
2021-04-14 08:55:16 +01:00
Greg Chadwick
d78e0d9a06 [rtl] Hard wire dcsr.stepie to 0
This indicates interrupts do not occur in single step mode.

Fixes #1279
2021-03-17 15:59:47 +00:00
Greg Chadwick
50be975226 [rtl] Fix hardware breakpoints and exceptions interaction
This change will cause the ID stage to stall if there is a potential
debug mode entry until instructions in both ID and WB have completed.
This fixes an issue with incorrect behaviour around hardware breakpoints
and exceptions that could cause exception entry to be missed, hardware
breakpoints to be triggered incorrectly or missed entirely.

In addition single step control logic is altered to work correctly with
the new debug mode entry behaviour.
2021-03-17 15:59:47 +00:00
Tom Roberts
5ef18f0b78 Update lowrisc_ip to lowRISC/opentitan@6cc5c164b
NOTE this commit includes various changes to align the Ibex repo with
changes upstream in OT!

Update code from upstream repository
https://github.com/lowRISC/opentitan to revision
6cc5c164ba96d339f06cbcede0d17d2c96ce3c05

* [dv] Add SV_FCOV_SVA back (Srikrishna Iyer)
* [DV][FCOV] Minor updates to lowRISC/opentitan#5414 (Srikrishna Iyer)
* [dvsim] Fix --cov + --build|run-only bugs (Srikrishna Iyer)
* [lint] Waivers for rv_core_ibex lint (Greg Chadwick)
* [lint] Allow one branch in unique case (Greg Chadwick)
* [dv/macros] Add fcov macros from Ibex (Tom Roberts)
* [dvsim/verilator] Fix pre-build cmd failure when hw/foundry is
  absent (Michael Schaffner)
* [verilator/otp] Enable OTP preloading in verilator (Michael
  Schaffner)
* [dvsim] Use builtins wherever possible (Srikrishna Iyer)
* [prim] Avoid an apparent combinatorial loop in prim_secded_*_dec.sv
  (Rupert Swarbrick)
* [dv/shadow_reg] Fix aes shadow reg error (Cindy Chen)
* [lint] Remove comportable waivers from non-comportable IPs (Michael
  Schaffner)
* [dv] Fix VPD dumping (Srikrishna Iyer)
* [prim] Waive Verilator lint warning in prim_lfsr.sv (Pirmin Vogel)
* [dv] Hard code various dv connections until full hook-up (Timothy
  Chen)
* [tlul] Add payload checker and generator on device side only.
  (Timothy Chen)
* [prim_packer] Silence verilator width warnings (Rupert Swarbrick)
* [dvsim] lint fixes to FlowCfg (Srikrishna Iyer)
* [dvsim] Minor improvement to FlowCfg (Srikrishna Iyer)
* [dvsim] lint fixes to Scheduler (Srikrishna Iyer)
* [dvsim] Very small update to Timer. (Srikrishna Iyer)
* [lint] Update Verible lint parser to detect Verible syntax errors
  (Michael Schaffner)
* [lint] Spot errors in the lint flow that we weren't expecting
  (Rupert Swarbrick)
* [lint] Remove Fusesoc-related message waivers (Michael Schaffner)
* [top / rst] Adjust the way rst_ni is used in design (Timothy Chen)
* [dvsim/syn] Update parsing script and area reporting (Michael
  Schaffner)
* [dv/regwen] update REGWEN conventions (Cindy Chen)
* [dv/tools] Bug fix to common.tcl tb_top section. (Eitan Shapira)
* [dv] Fix stress_all with reset (Weicai Yang)
* [prim] Add a new slow to fast clock synchronizer (Tom Roberts)
* [prim] Minor lint fix (Tom Roberts)
* [tlul] Add instruction type to tlul (Timothy Chen)
* [top] Ast updates (Timothy Chen)
* [lint] Increase threshold for max number of bits in an array
  (Michael Schaffner)
* [dv] add dv_base_reg_pkg to env_pkg template (Udi Jonnalagadda)
* [dv/verilator] Ignore foundry dir (Srikrishna Iyer)
* [dv] Provide license diagnostic info for VCS (Srikrishna Iyer)
* [prim/otp_ctrl] Fix ECC correctable bug in generic OTP wrapper
  (Michael Schaffner)
* [prim_ram_1p_scr] Make parity and diffusion layer settings more
  flexible (Michael Schaffner)
* [prim] fix flash sram adapter use for configuration space (Timothy
  Chen)
* [dv] Make CSR fields randomizable by default. (Srikrishna Iyer)
* [dv/prim] minor updates (Udi Jonnalagadda)
* [top] Minor lint fixes (Timothy Chen)
* [prim_flash] Flash port alignments (Michael Schaffner)
* [prim_util_pkg] Fix DC warning in _clog2() (Philipp Wagner)
* Add missing full_o output signal of prim_fifo_sync (Philipp Wagner)
* [dv] Gracefully kill simulation (Srikrishna Iyer)
* [dv] Minor updates to prim tbs (Srikrishna Iyer)
* [flash / top] Minor edits based on reviews (Timothy Chen)
* [flash_ctrl / top] Various functional updates to flash (Timothy
  Chen)
* [dv/otp_ctrl] regwen sequence (Cindy Chen)
* [prim] Wire up full_o sync fifo output port in prim_sram_arbiter
  (Rupert Swarbrick)
* [dvsim] Generate FUSESOC_IGNORE at top of scratch root (Rupert
  Swarbrick)
* Revert "[lint] Remove Fusesoc-related message waivers" (Michael
  Schaffner)
* Revert "[lint] Rename tool warnings to flow warnings and reduce
  their severity" (Michael Schaffner)
* Revert "[lint] Provision syntax error filter for Verible lint"
  (Michael Schaffner)
* [prim] Update fifo behavior during reset (Timothy Chen)
* [dv] Move cip related macros to cip_macros (Weicai Yang)
* [dv/dvsim] Fix when next_item does not have dependency (Cindy Chen)
* [prim_packer_fifo/rtl] reset to disable output controls (Mark
  Branstad)
* [lint] Provision syntax error filter for Verible lint (Michael
  Schaffner)
* [lint] Rename tool warnings to flow warnings and reduce their
  severity (Michael Schaffner)
* [lint] Remove Fusesoc-related message waivers (Michael Schaffner)
* [dv/dvsim] collect coverage in scheduler (Cindy Chen)
* [dvsim] Fix Syn class (Michael Schaffner)
* [dv/shadow_reg] move get_shadow_regs function to dv_base_ral_block
  (Cindy Chen)
* [lc_ctrl] Switch ECC to standard Hamming code (Michael Schaffner)
* [prim_ram_*p_adv/prim_otp] Add option to use standard Hamming ECC
  (Michael Schaffner)
* [secded_gen] Fix template bug that results in lint error (Michael
  Schaffner)
* [prim/fifo_async] Disallow non-power-of-two depths (Tom Roberts)
* [dv/alert] update shadow_reg alert naming in DV (Cindy Chen)
* [dv] Align csr::reset_asserted to actual reset pin (Weicai Yang)
* [prim_secded*_fpv] Generate FPV testbenches (Michael Schaffner)
* [prim_secded*] Regenerate all SECDED primitives (Michael Schaffner)
* [secded_gen] Add ability to generate FPV TB's and correct Hamming
  code (Michael Schaffner)
* [dvsim] Run cov_merge / cov_report as part of the main set of jobs
  (Rupert Swarbrick)
* [dvsim] Get rid of Deploy's static dispatch_counter (Rupert
  Swarbrick)
* [dvsim] Make the scheduling logic per-target (Rupert Swarbrick)
* [dvsim] Remove "status" from Deploy items (Rupert Swarbrick)
* [dvsim] Create jobs with dependencies instead of sub-jobs (Rupert
  Swarbrick)
* [dvsim] Simplify SimCfg._gen_results (Rupert Swarbrick)
* [dvsim] Factor deploy method out of Deploy object (Rupert Swarbrick)
* [dvsim] Move time tracking into its own class in Deploy.py (Rupert
  Swarbrick)
* [dvsim] Fix printing of Deploy objects (Rupert Swarbrick)
* [dv] make dv_macros.svh more UVM_agnostic (Srikrishna Iyer)
* [dv/prim] reduce smoke test iterations (Udi Jonnalagadda)
* [dv/hmac] reduce runtime for sha_vector test in smoke regression
  (Cindy Chen)
* [DV] Enable cov comp creation iff cov is enabled (Srikrishna Iyer)
* [prim_alert] Fix xcelium compile error (Cindy Chen)
* [alert_rxtx/fpv] Update alert sender FPV testbenches (Michael
  Schaffner)
* [alert_rxtx] Add option to latch fatal alert in alert sender
  (Michael Schaffner)
* [kmac/dv] KMAC smoke test (Udi Jonnalagadda)
* [dv/str_utils_pkg] add byte_to_str function (Udi Jonnalagadda)
* [prim] - Add new prim_lc_dec (Jacob Levy)
* [util] Move design-related helper scripts to util/design (Michael
  Schaffner)
* [prim-flash] Add missing deps (Srikrishna Iyer)
* [dv] Define SIMULATION during DV sims (Michael Schaffner)
* [dv] Fix a typo in tb.sv.tpl (Weicai Yang)
* Cleanup: Remove executable bits from source files (Philipp Wagner)
* [dv] Use separate clock for EDN (Weicai Yang)
* [dv] Add macro DV_EDN_IF_CONNECT to simplify EDN connect in TB
  (Weicai Yang)
* [dv] Fix typo in clk_rst_if (Weicai Yang)

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-03-04 09:56:36 +00:00
Greg Chadwick
3e7720e403 [rtl] Lint fixes for Ascent lint issues 2021-03-01 09:52:57 +00:00
Greg Chadwick
c3bd4fa7ef [rtl] Remove paths between dmem and imem signals
Prior to this change Ibex had multiple feedthrough paths from the data
memory interface to the instruction memory interface. This existed
because Ibex would hold off doing a instruction fetch for a jump or
branch if there was a outstanding memory request. It would wait for the
response to be available so either the jump or branch would occur or an
exception was taken.

With this change the branch or jump will speculatively begin the
instruction fetch whilst there is an outstanding memory request. Should
an exception result from the memory request the fetch will be discarded
and the exception taken as normal.

An alternative fix would not factor the data error response
(data_err_i) directly into the controller logic for branches and jumps.
With this option new stall cycles would be introduced anywhere a branch
or jump immediately follows a memory instruction which would have an
adverse impact on performance.
2021-02-26 17:32:34 +00:00
Greg Chadwick
99b8f61223 [rtl] Debug mode controller changes
* `if` in `DBG_TAKEN_IF` is needless as the conditions it checks will be
  true if controller enters `DBG_TAKEN_IF` state

* flop `enter_debug_mode` so `FLUSH` state looks at what
  `enter_debug_mode` was when it was seen in `DECODE` state rather than
  what it has become. In particular the controller could enter `FLUSH`
  on the basis of performing a WFI then divert down the debug control
  path due to a new debug request being raised. In this instance it is
  preferable for the WFI to complete entering `SLEEP` before the debug
  request wakes the core back up.
2021-02-18 17:34:17 +00:00
Greg Chadwick
794d865f56 [dv] Ibex uarch functional coverage
This adds a framework for gathering functional coverage for Ibex
microarchitecture along with a selection of initial coverpoints.
2021-01-22 11:12:08 +00:00
Fresher14
0199bbae66 Use overlapping implications for Xcelium 19.03
Xcelium 19.03 doesn't support the `->` (binary logical) operator, but
using `|->` (overlapping implication) is equivalent here and supported;
use this operator instead.

Fixes #1213
2020-12-17 11:25:03 +00:00
Tom Roberts
d977e146ba [rtl] Various small lint fixes
- Move various unused signal fixes from the waiver file to the rtl, so
  that all tools can pick them up.
- Fix some oversize line issues.
- Fix some signed / unsigned casting issues.
- Remove some extraneous semicolons.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-10-27 11:29:35 +00:00
Tom Roberts
2c22c1ee01 [rtl] Fix debug step over EBREAK issue
- If there is a request to enter debug mode (either due to a halt
  request or single stepping mode) on the same cycle as an EBREAK
  instruction, continue with the EBREAK and capture the ID PC rather
  than the IF PC.
- relates to #1106

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-09-14 14:19:35 +01:00
Greg Chadwick
2f1b95d214 [doc] Document branch prediction configuration 2020-08-27 11:25:17 +01:00
Greg Chadwick
6123ac7719 [rtl] Introduce static branch prediction 2020-08-27 11:25:17 +01:00
Udi
b1531f2e38 [ibex/rtl] Remove duplicate check for irq_fast[5]
Currently in ibex_controller.sv when generating the ID of any fast
interrupts, irq_fast[5] is checked for twice.
This is a redundant line, and so this PR simply removes it.

Signed-off-by: Udi <udij@google.com>
2020-08-21 13:03:24 -07:00
Greg Chadwick
21ad662418 [rtl] remove lsu_req_in_id signal
This signal aimed to ensure loads/stores completed succesfully when an
interrupt or debug request appeared at the same time they were being
executed when the writeback stage is present. However other stall logic
suffices for this purpose (debug/interrupt will wait for instruction to
unstall in ID/EX which only happens once request has been sent out, then
first instruction of debug/interrupt handler will stall until load/store
response has been seen based on the generic stall logic for lsu requests
in the writeback stage).

With this signal in place debug single stepping was broken around loads
and stores.

Fixes #1029
2020-08-11 14:12:07 +01:00
Michael Schaffner
ae547c8d30 [top_pkg] Fix style lint warnings
Signed-off-by: Michael Schaffner <msf@google.com>
2020-06-22 20:52:15 +01:00
Bert Pieters
fdfdcc0467 [rtl] disable clock between reset and fetch_enable_i
Fixes lowRISC#957

Signed-off-by: Bert Pieters <bert.pieters@gmail.com>
2020-06-22 13:25:39 +02:00
Tom Roberts
5ecaa11c63 [rtl] Fix writeback stage interrupt issue
- If an interrupt arrives at the same time as a load/store instruction
  is in ID stage, the interrupt must wait until load/store completes.
  Without the WB stage this happens naturally as the core stalls. With
  the WB stage, we need to allow the load/store to progress to the WB
  stage (and clear the ID stage) then hold back the interrupt until it
  completes.
- Also cleaned up some lsu related stalling terms and signal naming.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-06-10 15:13:32 +01:00
Greg Chadwick
c0ae8ffb99 [rtl] Fix issue with ID/EX exceptions
When a potential exception occurs in ID/EX controller must wait for any
outstanding instruction in WB to complete before resolving it. The
instruction in WB may also have an exception which takes priority over
ID/EX.

Signed-off-by: Greg Chadwick <gac@lowrisc.org>
2020-06-02 13:45:46 +01:00
Greg Chadwick
833bdefe33 [rtl] Fix exception priority for writeback stage
With the writeback stage enabled the controller can see a load or store
error from the writeback stage whilst seeing some other fault/exception
from ID/EX (e.g. an instruction fetch error). The writeback stage fault
must take priority, however without the writeback stage the
priortisation changes.

This introduces more explicit prioritisation logic for faults/exceptions
and gives the correct prioritisation for configurations both with and
without a writeback stage.

Fixes #912

Signed-off-by: Greg Chadwick <gac@lowrisc.org>
2020-06-02 13:45:46 +01:00
Tom Roberts
12b39476c0 [rtl] Add speculative branch signal
- Drive a speculative version of the branch signal into the IF stage to
  drive address muxing
- The speculative signal is the same as the regular branch signal but
  assumes all conditional branches are taken
- This breaks the timing path from branch condition calculation into
  address muxing (and therefore PMP error calculation)
- When the branch is not taken, any external request we might otherwise
  have made is suppressed
- This has a minor performance cost (0.8% without I$, ~0% with I$)

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-05-26 09:41:37 +01:00
Tom Roberts
8934267c78 [rtl] Fix instr_valid_i exception issue
- The controller state machine could only progress to FLUSH to handle an
  exception if instr_valid_i was set
- When the exception comes from a load/store in the Writeback stage, and
  no new instruction has been driven into the ID stage, this could cause
  exception to be missed
- The instr_valid_i qualification is therefore removed from the state
  machine as all relevant signals inside that if block are already
  qualified by instr_valid_i anyway
- Fixes #849

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-05-15 11:13:20 +01:00
Tom Roberts
b897300cbd [rtl] Branch signal timing fix
- Before this fix, the branch signal was qualified by the illegal
  instruction signal and the illegal csr signal.
- This patch removes both of these since the decoder already masks
  branches with illegal isntruction, and a branch cannot be a CSR op.
- This improves the worst path in the design significantly without the
  branch target ALU.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-03-25 15:26:02 +00:00
Tom Roberts
42aa761c5d [rtl] Fix mtval for unaligned instr errors
mtval should record which half of the instruction caused the error
rather than just recording the PC.
An extra signal is added in the IF stage to indicate when an error is
caused by the second half of an unaligned instruction. This signal is
then used to increment the PC by 2 for mtval capture on an error.

Fixes #709
2020-03-18 12:53:35 +00:00
Greg Chadwick
89e5fc11ed [RTL] Add configurable third pipeline stage
The third pipeline stage is a new writeback stage. Ibex can now be
configured as the original two stage design or the new three stage
design using the `WritebackStage` parameter in ibex_core. This defaults
to 0 (giving the original two stage design).

The three stage design is *EXPERIMENTAL*

In the three stage design all register write back occurs in the third,
final stage. This allows a cycle for responses to loads and stores so
when the memory system can respond in a single cycle there will be no
stall. This offers significant performance benefits.

Documentation of the three stage design is still to be written so
existing documentation applies to the two stage design only as various
aspects of Ibex behaviour will change in the three stage design.

Signed-off-by: Greg Chadwick <gac@lowrisc.org>
2020-03-06 15:29:14 +00:00
Greg Chadwick
b932a8bbf3 [rtl] Break path from data_err_o -> instr_req_o
Fixes #649
2020-03-05 10:51:25 +00:00
Greg Chadwick
5d16a5b104 [rtl] Introduce default clk/reset to prim_assert
This mirrors the change made in OpenTitan
(https://github.com/lowRISC/opentitan/pull/1485)
2020-02-10 09:42:52 +00:00
Pirmin Vogel
2a42c23eaf [rtl] Decouple mip and mie CSRs
This commit modifies the `mip` CSR to not depend on the `mie` CSR. While
the values of both these CSRs are combined to decide whether an
interrupt shall be handled, the RISC-V spec does not state that the
content of of `mip` should depend on `mie`. This commit better aligns
Ibex with other open-source RISC-V cores.

This resolves lowRISC/ibex#567 reported by @pfmooney.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-02-04 16:15:38 +01:00
Pirmin Vogel
b22fca7bbe Ignore all interrupts in NMI mode, clarify interrupt documentation
This is related to lowRISC/ibex#557, lowRISC/ibex#469 and
lowRISC/ibex#434.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-01-31 13:09:09 +01:00
Greg Chadwick
86c1775a64 [rtl] Timing fix for pc_mux_o in ibex_controller 2020-01-31 09:32:20 +00:00
Daniel Mlynek
9d232d1cde Include assert macros when they are used
prim_assert.sv is a file containing assertion macros (defines).
Previously, prim_assert.sv was compiled as normal SystemVerilog file.
This made the defines available for the whole compilation unit as soon
as they were defined. Since all cores using prim_assert depended (in
fusesoc) on the lowrisc:prim:assert core, prim_assert was always
compiled first, and the defines were visible in subsequent files.

All of that is only true if all files end up in one comilation unit. The
SV standard states that what makes up a compilation unit is
tool-defined, but also states that typically, passing multiple files (or
a file list/.f file) to a single tool invocation means that all files
end up in one compilation unit; if the tool is called multiple times,
then the files end up in separate compilation units.

Edalize (the fusesoc backend) doesn't guarantee either behavior, and so
it happens that for Vivado, Verilator, Cadence and Synopsys simulators,
all files are compiled into a single compilation unit. But for Riviera,
each file is a separate compilation unit.

To avoid relying on the definition of compilation units, and to do the
generally right thing (TM), this commit changes the code to always
include the prim_assert.sv file when it is used in a source file.
Include guards are introduced in the prim_assert.sv file to avoid
defining things twice.
2020-01-28 14:46:48 +00:00
Pirmin Vogel
0778008f33 [rtl] Remove X assignments, add SVAs for selector signals
This commit replaces all X assignments in the RTL with defined
values. In addition, SystemVerilog Assertions are added to catch
invalid signal values in simulation. A new file containing the
corresponding assertion macros is added as well.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-12-20 10:09:09 +01:00
Greg Chadwick
328aabb548 [RTL] Only restore from mstack in nmi mode
Fixes #492
2019-12-16 19:51:22 +00:00
Tom Roberts
088cd11593 [dbg] Add minimal hardware breakpoint support
- Add the minimum amount of trigger system to support GDB hbreak
- Only a single trigger is implemented
- Only instruction address matching
- Only break into debug mode (no native debug)
- Fixes #382

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2019-12-11 15:02:06 +00:00
Pirmin Vogel
9738b6c703 [rtl] Rework core_busy signals, remove feedback to clk
This commit reworks the generation of the `core_busy` signal used to
control the main clock gate of the core. Without this commit, the
controller generates a separate `first_fetch` signal only asserted in
the FIRST_FETCH state that directly controls `core_busy` and thus the
main clock gate. This is problematic as it introduces a feedback to
from the controller state into the clock.

This commit removes the problematic signal and changes the generation of
`ctrl_busy` in the FIRST_FETCH state of the controller. This signal is
now used to control the main clock gate in all states (previously all
except FIRST_FETCH) but it gets registered, thus it does not introduce
the feedback into the clock.

This resolves lowRISC/ibex#211.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-11-14 12:55:16 +01:00
Tom Roberts
0243e08111 [rtl] Switch to M mode on debug entry
- Core should operate as if in M-mode while in debug mode
- Previous priv level is restored from dcsr on DRET
- Fixes #463
2019-11-14 09:37:02 +00:00
Pirmin Vogel
52b03f3637 [rtl/controller] Remove redundant check in EBREAK handling
This commit removes a redundant for `ebrk_insn` in the `DBG_TAKEN_ID`
state. If this signal is not set, the controller does not enter this
state in the first place. This is not changing functional behavior,
but removes a `MISSING_ELSE` coverage hole reported by @udinator.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-11-13 13:12:15 +01:00
Pirmin Vogel
6a5ee22395 [rtl/controller] Remove redundant check in execption handling
This commit turns the last case in the exception handling if/else block
from an `else if` to an `else`. This is not changing functional
behavior as the same condition is checked previously, but removes a
`MISSING_ELSE` coverage hole reported by @udinator.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-11-13 13:12:15 +01:00
Greg Chadwick
cc94bc8d54 [RTL] Fix single stepping on exceptions
When we single step over an instruction that causes an exception DPC
should be set to point to the exception handler (where we would have
gone were we not single stepping).
2019-10-16 10:23:05 +01:00
Greg Chadwick
b94961402c [RTL] Fix ebreak behaviour in U-mode
Fixes #370

Whether EBREAK enters debug mode is controlled by the
ebreaku and ebreakm dcsr fields. Which is relevant depends upon the
privilege level.
2019-10-16 09:10:34 +01:00