Commit graph

2792 commits

Author SHA1 Message Date
Robert Schilling
a3865e6cd0 [ibex,tracer] Uniquify trace log with module hierarchy
In case of having multiple Ibexes, this caues a conflict in openening
the same filename from different instances. Add the unique module
hierarchy into the filename.

Signed-off-by: Robert Schilling <rschilling@rivosinc.com>
2025-02-14 09:18:18 +01:00
Rupert Swarbrick
78739562ce [ibex_core] Fix assertion when SecureIbex is false
This assertion wasn't quite correct if SecureIbex is false because it
was checking for the magic IbexMuBiOn value instead of just looking at
the bottom bit.

Fixes #2249.
2025-01-24 12:49:45 +00:00
Rupert Swarbrick
cecf4fd2df [ibex_register_file_fpga] Drop two confusing comments
These were noticed by someone responding to issue #2230. I think the
author's original logic was to point out that there's a path from e.g.
raddr_a_i to rdata_a_o which doesn't depend on any clock, so is
"asynchronous".

But that's the same in the other modes and also for the other register
file implementations, which don't have analogous comments.

Drop these ones.
2025-01-23 19:27:35 +00:00
Katharina
591c3812f9 Fix typo in comment in ibex_id_stage.sv 2025-01-16 19:17:50 +00:00
Robert Schilling
5da1679f36 [ibex_tracer] Use static variables in always/final blocks
Signed-off-by: Robert Schilling <rschilling@rivosinc.com>
2025-01-10 13:17:17 +00:00
Rupert Swarbrick
4d722d3308 [rtl] Drive oh_raddr_*_err if RdataMuxCheck=0
These errors aren't detected or reported if the mux is disabled, but
the RTL didn't actually drive them at all.
2025-01-07 09:38:11 +00:00
Priyanshu Mishra
8f4c75c5e4 Update core_ibex_pmp_fcov_if.sv 2024-12-20 12:09:26 +00:00
Andreas Kurth
a05d4d825c [rtl,pmp] Allow all accesses to Debug Module in debug mode
The RISC-V Debug Specification (current release 1.0.0-rc4) in Section
A.2 states that the PMP must not disallow accesses to addresses of the
Debug Module when the hart is in debug mode, regardless of how the PMP
is configured.  This commit changes the PMP accordingly.

Signed-off-by: Andreas Kurth <adk@lowrisc.org>
2024-12-19 10:42:48 +00:00
Andreas Kurth
8b82e89719 [controller] Add assertion on pipeline flush when entering debug mode
Signed-off-by: Andreas Kurth <adk@lowrisc.org>
2024-12-19 10:42:48 +00:00
Marno van der Maas
88d27a0944 ibex_pcounts: resolve uninitialize warning
Although the current code isn't wrong as far as I can tell, it would be
better to initialize the lognest_name_length variable when it is
declared to avoid a build warning with older Verilator versions.
2024-12-18 16:05:47 +00:00
Pascal Nasahl
667fd20d2e [rtl] Fix non-DSP reset in ibex_counter
When targeting Xilinx FPGAs, we utilize a DSP for counters
with a width of less than 49-bit. In this case, a sync. reset
is needed. However, currently, there is a bug in the RTL
where also a sync. reset is used for the non-DSP counters
on the FPGA.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-12-06 14:55:01 +00:00
Pascal Nasahl
0945aa84c6 Revert "[rtl] Fix counter reset value on FPGA"
This reverts commit 54985d21b0.
2024-12-04 00:06:01 +00:00
Pascal Nasahl
54985d21b0 [rtl] Fix counter reset value on FPGA
If the counter width is >= 49, we do not use a DSP on the FPGA.
Then, we should use an asynchronous reset to initialize the counter.

This bug was detected when enabling the lockstep for the CW340. A
lockstep mismatch happend as the mcycle counters of the main and
shadow core did not match due to this bug.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-11-29 10:43:32 +00:00
Gary Guo
d2d55ed348 [ci] remove Azure Pipelines
We have been using GitHub Actions for some time now, both for public CI
and private CI, and it seems to be functioning well.

Signed-off-by: Gary Guo <gary.guo@lowrisc.org>
2024-11-22 16:45:05 +00:00
Pascal Nasahl
84232a5bfa [rtl] Fix zero value in FPGA RF
We should use `WordZeroVal` instead of `0` for reads from register `x0` in the
FPGA register file.

This bug was discovered when enabling the `RegFileECC` parameter. When this is
enabled, the core performs ECC checks, expecting that `WordZeroVal` is returned
for `x0`. Else, we get a major alert.

Fixes lowRISC/opentitan#25146

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-11-18 13:35:35 +00:00
Marno van der Maas
f0f6bfd79a Block diagram: make feature text readable
White text on the dark red should be more readable than the black.
2024-11-12 12:49:41 +00:00
Marno van der Maas
496e06f659 Block diagram: fixes and improved looks
- Move background to its own layer
- Make font sizes consistent
- Fix icache and pc background
  Previously the background was morphed around the text, this makes it a
  background again.
- Remove redundant rectangle
  The instruction memory interface had two rectangles, one black and one
  purple. I removed the purple one that was bleeding through in the
  corners.
- Instruction fetch alignment
  The Instruction fetch block was not the same height and was not top
  aligned with the other blocks.
- Align text with boxes
  This essentially aligns all the text insides the blocks
- Standardize lines as 0.265mm
  The lines between blocks and the ones making the triangular shapes were
  mostly 0.265mm with a few exceptions.
- Stroke width of block outlines same
  Made all the stroke widths for all the blocks 0.5mm. I've made the outer
  box a nice round 1.0mm.
- Use lowRISC colors
  E0384F for the background (including the start of the gradient)
  A21F4F for the outside line
- Alignment of in/out arrows
  Many of these arrows were not aligned, this improves that alignment.
- Add white background to instr inf
  Instruction memory interface lost its white background when the purple
  outline was removed. This commits adds it back in.
- Use Liberation Sans everywhere
  Exo 2 is not supported natively in browsers and there was no easy way to
  embed fonts in SVG where Inkscape knew about it.
- Fade to white, not transparent
- PMP check font is now smaller
- Add background to debug request input
- Make text under prefetcher bigger so it is rendered on GitHub
- Execute text is now its own block so that it is rendered on GitHub
2024-11-11 15:31:55 +00:00
Harry Callahan
fb49826c16 [dv] Cleanup some code in the compile_tb.py module
Add comments, and move some variable declarations around to be closer to their use.

Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
2024-10-01 15:21:40 +00:00
Harry Callahan
8e77bb39d5 [dv] Tweak ISS linker arg construction for Xcelium
The previous code here was a bit too hacky, so implement a solution that
directly follows the suggestion in the Cadence support article.
An example was also added to make it clear what this transformation is
achieving.

Add some more typehints, and cleanup names.

Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
2024-10-01 15:21:40 +00:00
Robert Schilling
f92d599e00 [pmp] Use top-level straps for PMP reset values
By using top-level straps for the PMP reset configuration its
easier to implement different reset configurations if there are
multiple Ibex cores in the system.

Signed-off-by: Robert Schilling <rschilling@rivosinc.com>
2024-09-23 10:28:57 +00:00
Elliot Baptist
4ed20f4ac3 Update more documentation links 2024-09-19 08:57:07 +00:00
Elliot Baptist
6a33f69ccb Update verification_stages.rst OT links 2024-09-18 12:58:20 +00:00
Pascal Nasahl
2617c43c0a [rtl] Fix wrong address in latch RF
This commit fixes a typo that used the wrong read address (raddr_b
instead of raddr_a) for port A.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-09-17 14:25:27 +00:00
lingscale
53888bcdf4 [rtl] fix a typo. 2024-08-28 10:19:17 +00:00
lingscale
0cd79187b6 [doc] fix a typo. 2024-08-28 10:17:28 +00:00
Gary Guo
03ba286570 Fix icache regression failure on VCS
It appears that VCS require expression after `iff` to be wrapped inside
parenthesis otherwise it will complain about syntax error.

This should fix the weekly VCS regression.

Signed-off-by: Gary Guo <gary.guo@lowrisc.org>
2024-08-26 14:44:27 +00:00
Greg Chadwick
38c0709391 [rtl] Remove ECC related data_rdata_i -> instr_X_o feedthroughs
Prior to this commit an ECC failure on the incoming data memory response
factored directly into the outputs for the instruction memory
interfaces. This existed due to a desire to take an NMI on an ECC
failure as soon as possible but causes timing issues so it has been
altered.

Now rather than directly raise the NMI the same cycle the assertion of
'irq_nm_int' is delayed by a cycle which breaks the feedthrough path.
2024-08-23 20:31:14 +00:00
Greg Chadwick
3937e484da Add SECURITY.md 2024-07-16 14:05:47 +00:00
Greg Chadwick
96a1c02ba0 [dv] Increase iterations and instructions in riscv_rf_intg_test
This enables more scenarios begin stimulated per regression run around
RF ECC errors.
2024-07-15 22:02:06 +01:00
Greg Chadwick
6ac0ddc46e [dv] Alter riscv_rf_intg_test to cover more scenarios
Previously the riscv_rf_intg_test skipped certain scenarios where an ECC
error from the register file should trigger an alert. This change stops
it from skipping those scenarios.
2024-07-15 22:02:06 +01:00
Greg Chadwick
9e4a950aa6 [rtl] Fix logic for generating ECC related alerts
Under certain circumstances Ibex ignored the ECC check from the register
file when it should not have. This fixes the issue.

Fixes #2188
2024-07-15 22:02:06 +01:00
Greg Chadwick
668233699d [dv] Add spurious responses to memory agent
A spurious response is one that isn't associated with any on-going
request. With this new feature the memory agent can generate them
randomly when the interface is idle (i.e. there are no outstanding
requests).
2024-07-04 22:51:30 +00:00
Pascal Nasahl
0e0f27ad14 [dv] Add riscv_ram_intg_test
This test injects a fault into different MuBi encoded signals within
the prim_ram_1p_scr and prim_ram_1p_adv and checks whether a fatal
alert is triggered.

I have excluded the addr_match signal from FI as its encoding
is not directly checked. If the signal was a MuBi True, a
fault into it is treated by the mubi4_and_hi as a False.
If the signal was a MuBi False, a fault into it is treated
by the mubi4_and_hi also as a False. Hence, no address
collision occurs and the holding register is not returned.

This PR is based on #2182 and closes #2173.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-07-04 10:58:40 +00:00
Greg Chadwick
3384bf4c42 [cosim] Clang lint fix 2024-07-03 15:31:44 +00:00
Greg Chadwick
e1f2df24d0 [ci] Bump co-sim version 2024-07-03 15:31:44 +00:00
Greg Chadwick
470b39a2a2 [dv] Output warning message on problematic MIP changes
When an interrupt is raised the Ibex controller will move from the
DECODE state to the IRQ_TAKEN state when it chooses to handle the
interrupt. When in IRQ_TAKEN it's possible for the interrupt state to
change again which aborts the interrupt entry. This leads to mis-matches
against cosim.

This change adds a warning to flag up cases where this has occurred to
enable quick triage of failures related to this scenario.
2024-07-03 15:31:44 +00:00
Greg Chadwick
65a7231a29 [cosim] Correctly deal with checking top of range memory accesses
The cosimulation environment does not know if a memory access from spike
is due to an instruction fetch or a data memory access. It uses a
heuristic to differentiate the two. Any access between the PC and the PC
+ 8 is considered an instruction fetch.

This heuristic did not correctly handle addresses at the top of the
range where the PC + 8 calculation overflows. This commit fixes the top
of range handling.
2024-07-03 15:31:44 +00:00
Greg Chadwick
e784d27464 [dv] Update testbench to use new 'pre_val' MIP
The 'pre_val' MIP addresses the scenario where MIP changes as an
instruction is excuting, this means a CSR instruction can observe a
different MIP from the one that decides whether or not that instruction
will be interrupted.
2024-07-03 15:31:44 +00:00
Greg Chadwick
3964804815 [dv] Fix model mismatches in cases where an access crosses PMP regions
Where an access is unaligned Ibex splits it into two transactions, each
of which undergoes a PMP check. It is possible for the first half to
fail a PMP check and the second to succeed and hence produce a request
on the memory interface.

In Spike it accesses memory byte by byte and if it encounters a PMP
error for a particular byte it won't try any further bytes.

This results in a mis-match between Ibex and spike when an unaligned
transaction is split across two PMP regions, one of which allows the
access and the other doesn't. Ibex generates a transaction and spike
doesn't producing an error.

This adds a fixup into the co-simulation environment. It detects when we
have an access that fails PMP that is misaligned. Where this has
resulted in Ibex producing a memory request that spike would not we
remove it from the list of memory requests to check after checking that
the request passes PMP within spike.
2024-07-03 15:31:44 +00:00
Greg Chadwick
89f4d86719 [dv] Fix exception_stall_instr_cross illegal bins 2024-07-03 15:31:44 +00:00
Greg Chadwick
2c132113c0 [dv] Add riscv_rf_ctrl_intg_test
This tests new hardening added to the register file around read and
write control signals.
2024-07-03 14:21:10 +00:00
Gary Guo
e2b721d488 [ci] update private CI 2024-07-01 16:15:41 +00:00
Greg Chadwick
1449ed5ea8 [dv] Add cover points for memory interface behaviour 2024-06-21 11:18:41 +00:00
Greg Chadwick
604ba343bb [dv] Fix race condition in ibex_mem_intf_agent
Previous code working with clocking blocks synced to the raw clock
event. Instead they should sync to the clocking block event. This
ensures the values being read are the latest values rather than a cycle
old.

In particular for ibex_mem_intf_agent this meant it was unable to
produce a single cycle response to any memory transaction. With this fix
these are now observed.
2024-06-21 11:18:41 +00:00
James Wainwright
d97a0b4a98 [doc] Fix C++ style guide link in README
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
2024-06-16 22:13:01 +00:00
Pascal Nasahl
d019dccb4b [dv] Remove phase argument from collect_trans
This commit applies the patch from lowRISC/opentitan@18b0ced to the Ibex
repository.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-06-06 21:36:55 +01:00
Pascal Nasahl
957529c4bd [dv] Add mubi and prim_count pkg to DV environment
With the latest update in vendor/lowrisc_ip, two additional packages
need to be imported.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-06-06 21:36:55 +01:00
Pascal Nasahl
21da9b3c7e Update lowrisc_ip to lowRISC/opentitan@d268f271f4
Update code from upstream repository
https://github.com/lowRISC/opentitan to revision
d268f271f4f75aeb8f3bf9624a497ae5bfb9c47e

* [rtl] MuBi encoding of iCache memory ctrl signals (Pascal Nasahl)
* [sram_ctrl] Add readback feature (Pascal Nasahl)
* [fpv] Tweak report headers to match Jasper version (Rupert
  Swarbrick)
* [prim_pad_wrapper,rtl] Change input enable to active-high (Andreas
  Kurth)
* [hmac/rtl] Wait for digest of complete block when stopping (Martin
  Velay)
* [prim_sha2_pad,rtl] Signal msg feed complete also when stopping
  (Andreas Kurth)
* [prim_sha2_pad,rtl] Go to idle (without padding) when told to stop
  (Andreas Kurth)
* [prim_sha2_pad,rtl] Refactor comparison on tx_count and msg len into
  signal (Andreas Kurth)
* [prim_sha2_pad,rtl] Fix setting of digest mode when continuing
  (Andreas Kurth)
* [hmac/prim_2,rtl] Do not clear redundant digest values (Ghada
  Dessouky)
* [prim,fpv] Tweak how a parameter gets used in some assertions
  (Rupert Swarbrick)
* [prim,fpv] Fix trivial lint warning in prim_fifo_sync_assert_fpv
  (Rupert Swarbrick)
* [prim,rtl] Fix trivial lint warning in prim_fifo_sync (Rupert
  Swarbrick)
* Launcher Modification (Youming Lu)
* [top_earlgrey,pinmux] Add input disable attribute for non-manual
  pads (Andreas Kurth)
* [dv] Add more prints to bit bash sequence (Rupert Swarbrick)
* [ipgen,flash_ctrl] Fix core files (Guillermo Maturana)
* [prim,rtl] Avoid unnecessary check in prim_esc_receiver.sv (Rupert
  Swarbrick)
* [prim,fpv] Use PossibleActions param in prim_esc_receiver (Rupert
  Swarbrick)
* [prim_diff_decode] Use `prim_xnor2` to detect integrity issue
  (Andreas Kurth)
* [prim] Fix typo'd loop increment (James Wainwright)
* [hmac/prim_sha2,rtl] Implement SW error for invalid HMAC config
  (Ghada Dessouky)
* [rom] Remove real and fake key targets. (Miguel Osorio)
* [prim_sha2,rtl/dv] Fix secret value wiping (Ghada Dessouky)
* [prim,rtl,fpv] Fix typo in assertion in prim_alert_receiver (Rupert
  Swarbrick)
* [fpv,prim] Drop prim_count_expected_failure.hjson (Rupert Swarbrick)
* [fpv,prim] Generalise from DecrNeverTrue to listing possible actions
  (Rupert Swarbrick)
* [prim,fpv] Correct assertions for commit_i input (Rupert Swarbrick)
* [prim,fpv] Rephrase some "backwards" assertions in prim_count
  (Rupert Swarbrick)
* [prim,fpv] Properly "waive" some unreachable prim_count assertions
  (Rupert Swarbrick)
* [prim,fpv] Fix width of FPV variable in prim_arbiter_ppc.sv (Rupert
  Swarbrick)
* [prim,fpv] Rephrase prim_count error assertions (Rupert Swarbrick)
* [prim,fpv] Fix port list in prim_count_tb (Rupert Swarbrick)
* [prim_ram_1p_scr] Align documentation with actual implementation
  (Pirmin Vogel)
* [prim, rom_ctrl] Increase number of PRINCE rounds for improved
  security (Pirmin Vogel)
* [prim,fpv] Make file structure slightly clearer (Rupert Swarbrick)
* [prim,fpv] Shorten a variable name (prim_hier -> hier) (Rupert
  Swarbrick)
* [prim,fpv] Tidy up and document some FPV macros (Rupert Swarbrick)
* [dvsim,lint] Fix bug in duplicate detection in lint parser (Rupert
  Swarbrick)
* [rtl,comments] Fix some comments (Guillermo Maturana)
* [dv,prim] Clarification of reset behavior (Adrian Lees)
* [ast] Add dependency in fileset_partner to select correct ast_pkg
  (Sharon Topaz)
* [prim,fpv] Only allow unconstrained counters in prim_count FPV
  (Rupert Swarbrick)
* [dvsim] Split and rename Modes.py (Rupert Swarbrick)
* [prim,dv] Tweak ASSERT_FINAL to be a no-op if FPV enabled (Rupert
  Swarbrick)
* [prim,tlul,rtl] Explicitly cast a "1" to specific number of bits
  (Rupert Swarbrick)
* [dvsim] Fix plurals in type names in Modes.py (Rupert Swarbrick)
* [dvsim] Move find_mode and find_and_merge_modes out of Modes class
  (Rupert Swarbrick)
* [dvsim] Die more cleanly on an invalid use of merge_mode (Rupert
  Swarbrick)
* [dvsim] Get rid of "mname" field in Modes.py (Rupert Swarbrick)
* [dvsim] Simplify named attribute lookup in Modes.py (Rupert
  Swarbrick)
* [dvsim] Get rid of pretty print magic in Modes.py (Rupert Swarbrick)
* [dvsim] Strengthen typing and simplify printing for modes in SimCfg
  (Rupert Swarbrick)
* [dvsim] Slightly tidy up SimCfg._print_list (Rupert Swarbrick)
* [dvsim] Get rid of an unused dictionary in OneShotCfg.py (Rupert
  Swarbrick)
* Add the project name to the copyright header (Michael Munday)
* Fix or waive Python lint errors and warnings (Pirmin Vogel)
* Remove trailing whitespaces (Pirmin Vogel)
* [dv,mem_bkdr] Fix handling of multiple tiles in sram (Guillermo
  Maturana)
* [hmac] Coding style and minor fixes (Ghada Dessouky)
* [dv] Remove phase argument from monitor's collect_trans (Rupert
  Swarbrick)
* [prim_fifo_sync_cnt] Minor code cleanup (Andreas Kurth)
* [dv,mem_bkdr] Fix digest calculation for hw_cfg0 (Guillermo
  Maturana)
* [prim_fifo_sync_cnt] Fix signedness of Depth parameter (Andreas
  Kurth)
* [prim_fifo_sync] Keep wraparound pointers contained within
  `prim_fifo_sync_cnt` (Andreas Kurth)
* [prim_fifo_sync] Move pointer and depth calculation to
  `prim_fifo_sync_cnt` (Andreas Kurth)
* [prim_fifo_sync] Remove out-commented RTL code (Andreas Kurth)
* [prim_fifo_sync_cnt] Improve module and parameter documentation
  (Andreas Kurth)
* [lint] Demote licence warning in AscentLint parser (Rupert
  Swarbrick)
* Revert "[dv] Remove phase argument from monitor's collect_trans"
  (Rupert Swarbrick)
* [dv] Fix parameter types in dv_base_mubi_cov.sv (Rupert Swarbrick)
* [dv] Remove phase argument from monitor's collect_trans (Rupert
  Swarbrick)
* [dv, xcelium] Use detachable reports to avoid CORS (Elliot Baptist)
* [otp_ctrl] Add fuse for late debug enable mechanism (Michael
  Schaffner)
* [prim] Add support for MuBi's up to 32bit (Michael Schaffner)
* [otp_ctrl] Increase Hamming distance in OTP commands (Michael
  Schaffner)
* [dv] Add checks to set_freq_*hz (Rupert Swarbrick)
* [dv] Fix more timeout comments with wrong units (Elliot Baptist)
* Make .core files pass FuseSoC 2 schema validator (Olof Kindgren)
* [dvsim] Run deepcopy to work around memory usage bug (Rupert
  Swarbrick)
* [dvsim] Make global_val handling a bit clearer (Rupert Swarbrick)
* [prim_sha2,rtl] Add key_length type and change type encodings (Ghada
  Dessouky)
* [dv,sram_ctrl] Fix a few failing tests (Guillermo Maturana)
* [topgen] Add field to specify status IRQ default behavior (Michael
  Schaffner)
* [dv] Update clear_all_interrupts to support status type (Michael
  Schaffner)

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-06-06 21:36:55 +01:00
Pascal Nasahl
5cea5d65c3 [rtl] Add error port to iCache
This commit adds the error port to the iCache which was introduced
with lowRISC/opentitan#23292.

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-06-06 21:36:55 +01:00
Pascal Nasahl
0b0b01006c [rtl] Update RAM ports inside ibex_top
This commit updates the RAM ports inside ibex_top to reflect recent
changes introduced with lowRISC/opentitan#23212 (SRAM readback mode).

Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
2024-06-06 21:36:55 +01:00