Commit graph

2505 commits

Author SHA1 Message Date
Harry Callahan
0187816ef3 CI-JOB : increase seeds for PMP tests to check coverage 2022-11-01 09:46:02 +00:00
Canberk Topal
ccdbf0b0ed [SQUASH:1886]
[dv] Add directed instruction for random MSECCFG

This commit adds a directed instruction stream to riscv_pmp_full_random_test
To inject random writes to MSECCFG register.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>

[dv] Randomize MPRV in pmp_full_random_test

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>

[dv] Add a matching NA4 in pmp_full_random_test

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-11-01 09:37:35 +00:00
Harry Callahan
ca5feb5cee FIXME: local change to merge coverage using db's in a file
The 'imc' tool can accept a list of coverage databases as arguments on the
command line, or a '-runfile' argument can point to a file containing a list of
the databases, one entry per line.
Switch to use the file-method, as too many iterations leads to exceeding the
maximium length of arguments to the shell.
2022-11-01 09:36:18 +00:00
Harry Callahan
04f5ff61c7 Tidy up merge_cov.py to use metadata / pathlib 2022-11-01 09:36:18 +00:00
Harry Callahan
dfcf8d00d0 Move tests to their own directory, out/run/tests
Make it easier to find the coverage / regr.log file
2022-11-01 09:36:18 +00:00
Harry Callahan
569796da4f Cleanup check_logs.py, remove redundant cosim_trace check 2022-11-01 09:36:18 +00:00
Harry Callahan
dad16aa5cf [RISCV-DV] Change coverage job to pass trace csv's to test by file
This fixes an issue where large numbers of test iterations could result in
exceeding the length of argument list allowed when invoking a new subprocess.
2022-11-01 09:36:18 +00:00
Greg Chadwick
b278e5b267 [dv] Fix riscv_mem_error_test
Memory errors trigger the same exception as PMP failures. For this test
we simply need to return to the failing instructions rather than the
more complex handling from the PMP exception handler.
2022-10-31 18:03:43 +00:00
Greg Chadwick
4dca23383a [dv] Access CPUCTRLSTS and SECURESEED in riscv_rand_instr_test 2022-10-31 18:03:43 +00:00
Greg Chadwick
cb01156154 [cov] Add illegal bin for misaligned data accesses 2022-10-31 18:03:43 +00:00
Greg Chadwick
ad584baa9a [rtl] Fix dummy instructions
Previously there was a single dummy_instr_id_o signal from ibex_core
which the register file used to determine if it could write to the zero
register (which reads as zero always for real instructions). However a
write occurs in the writeback stage so this signal was not asserted
correctly.

This adds a dummy_instr_wb_o signal to control the write to zero
register. dummy_instr_id_o remains as it's still employed for register
reads for dummy instructions.
2022-10-31 17:42:12 +00:00
Harry Callahan
3dee4621c8 Rework reset handling for UVM env
Move the handling of resets to the routine core_ibex_base_test::handle_reset,
which sequences the resets of different testbench components to ensure that
everything comes back up in the right sequence after a reset stimulus.
2022-10-31 17:32:32 +00:00
Harry Callahan
3e3940aa78 Break-out load_binary_to_mem for ISS and DUT seperately 2022-10-31 17:32:32 +00:00
Greg Chadwick
e63bb13d0a [ci] Bump cosim version to latest
This integrates in the ebreak behaviour changes in spike
2022-10-31 16:46:55 +00:00
Greg Chadwick
980f73b047 [cosim] Fixup ebreak behaviour
When DCSR is set such that ebreak will enter debug mode we were getting
cosim mismatches. This was because Ibex produces the ebreak on the RVFI
interface and spike effectively skips right over it and executes the
first instruction of the debug handler immediately. Traps have similar
but not identical behaviour so we need a special case in the step
function to handle this.
2022-10-31 16:15:09 +00:00
Harry Callahan
d59ed9ab38 Increase delay between irq stimulus for nested_interrupt_test 2022-10-31 16:11:03 +00:00
Harry Callahan
36d0d3089d Bump up timeout for irq_stimulus to accomodate fetch_enable changes
The recent change to add the fetch_enable sequence in to every regression
can very-rarely cause the 3000 cycle timeout for the irq_stimulus check to fail.
This only happens with a large randomized length of the fetch being disabled,
and long latency for memory accesses.
Increase this timeout.
2022-10-31 16:06:57 +00:00
Harry Callahan
b06fb42ab8 Change defaults for bad_intg on uninit accesses for Dmem/Imem
Imem : never create bad_intg on uninit access
Dmem : by default, enable bad_intg on uninit access. Plusarg to change behaviour.
2022-10-31 16:06:57 +00:00
Harry Callahan
352f83fc74 Add new uvm test to hit hardware breakpoints coverpoints
Overrides some riscv-dv classes to create a custom debug_rom for this test,
which is used to setup the breakpoint registers.
I have found it difficult to get stimulus of this hardware feature without
a more directed test. Improvements or ideas are welcome here.

Test-specific timeout of 5min within which I see >90% pass rate.
2022-10-31 16:06:57 +00:00
Harry Callahan
a670743bde Redefine ECALL handler to no-longer jump to 'write_tohost:'
This prevents the simulation from entering an infinite loop which it can no
longer detect and terminate from.
2022-10-31 16:06:57 +00:00
Harry Callahan
1a9ab8bd82 Generate test_done: and test_fail: sections using handshake mechanism
Adding this behaviour to ibex_asm_program_gen allows all test to benefit
from the option of jumping directly to these label. Previously, ECALL was
used to provide a single path to this code.
2022-10-31 16:06:57 +00:00
Greg Chadwick
eca86aef03 [rtl] Fix id_exception_o signal
Previously it was asserted when an instruction in ID would cause an
exception but an earlier instruction in WB also causes an exception
which takes priority.

This didn't cause a functional bug as the `id_exception_o` signal was
used in a single place ORed with `wb_exception_o`. However it was
confusing behaviour and could cause killed instructions to appear on the
RVFI causing false cosim mismatches.
2022-10-31 14:29:59 +00:00
Harry Callahan
0c0626ebbf Update google_riscv-dv to google/riscv-dv@be9c75f
Update code from upstream repository https://github.com/google/riscv-
dv to revision be9c75fe6911504c0e6e9b89dc2a7766e367c500

* Reserve one extra word when pushing GPRs to kernel stack (Harry
  Callahan)
* Store user-stack-pointer on kernel stack when pushing/popping GPRs
  (Harry Callahan)

Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
2022-10-28 17:33:53 +01:00
Canberk Topal
179b776dfb [dv,fcov] MPRV Effect Cross improvements
Removed unnecessary autogenerated bins with using iff more effectively.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-10-28 17:25:45 +01:00
Canberk Topal
2c8ff3b6d8 Extend illegal bin for None config in M-Mode
It is illegal to see an execution/read/write denied while in Machine
mode if MML is disabled. Add this combination to our illegal bin list.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-10-28 17:25:45 +01:00
Greg Chadwick
ed927be387 [cov] Remove ignored_csrs coverpoints
These related to unimplemented CSRs. These are already captured by one
of the illegal instruction categories.
2022-10-28 11:59:58 +01:00
Greg Chadwick
727f920c9a [cov] Add waived CSRs IGNORED_CSRS
It has been agreed we are waiving coverage of accessing these CSRs for
V2. They may be removed from list later. See
https://github.com/lowRISC/ibex/issues/1795
2022-10-28 11:59:58 +01:00
Greg Chadwick
57e691507d [cov] Fix debug_wfi_cross
It was triggered only on the debug wakeup actually occurring, so in
particular would never capture debug activity around entering sleep. Now
it just considers if there's something that would trigger debug wakeup.
2022-10-28 11:59:58 +01:00
Greg Chadwick
5e77ccc51a [cov] Add some illegal bins related to instruction categories 2022-10-28 11:59:58 +01:00
Greg Chadwick
bb92ea6df4 [cov] Remove pointless cross
This cross wasn't much use as many of the transitions it was crossing
with instruction types only occur when the pipeline is empty (so there's
no instruction type to check).

The remaining interesting cases are already covered by other crosses
(e.g. `debug_if_entry_instr_cross` and `pipe_flush_instr_cross`).

Also adds an assertion to check the pipe is empty when we transition to
IRQ_TAKEN (we need this condition to hold to ensure we don't need extra
coverage for instruction types on this transition).
2022-10-28 11:59:58 +01:00
Greg Chadwick
2f9fd69ec4 [rtl] Remove unused transition in ibex_controller FSM
When in the FLUSH state we cannot have `csr_pipe_flush` set as it
depends upon `instr_executing` being set (within `ibex_id_stage`) and
that is only set in the DECODE stage.
2022-10-28 11:59:58 +01:00
Marno van der Maas
5f5a70fca9 Tweak regressions around PMP, allow for double_faults, uninit_accesses
Add 180s timeout for pmp_full_random tests (this sees a reasonable pass-rate)

Tweaked to latest api for double_fault detector

Squashed changes from Marno's ongoing work:
[pmp] Adjust full random PMP to use random memory addresses
[pmp] Enable double fault detecter for MML read only test
[dv,pmp] Add double fault pass flag
[dv,pmp] Different parameters for pmp full random test
2022-10-27 15:01:23 +01:00
Greg Chadwick
bbda68a0df [dv] Disable bad integrity on uninitialised memory for selected tests
From an initial triage and test regression run these tests benefit from
this.
2022-10-26 22:08:32 +01:00
Greg Chadwick
1d4cf9b207 [dv] Add single step over exception coverpoint 2022-10-26 12:13:19 +01:00
Greg Chadwick
bfe71faf5f [dv] Remove cp_insn_trigger_exception coverpoint
This coverpoint does not make sense. The hardware breakpoint is
triggered as the instruction moves into the ID/EX stage so it never has
a chance to take an exception (it effectively never begins executing).
2022-10-26 12:13:19 +01:00
Greg Chadwick
1851e86113 [rtl] Fix ebreak debug cause
We should only indicate an ebreak debug cause if an ebreak leads to a
debug entry (otherwise when single stepping over an ebreak that traps to
an exception we incorrectly enter debug mode with an ebreak cause).
2022-10-26 12:13:19 +01:00
Harry Callahan
659dc458f2 Fix bug in passing cosim_agent handle to the data_intf_seq
The handle was passed before the cosim was constructed, so when it came to use
the handle it caused a null pointer exception.
2022-10-25 16:07:57 +01:00
Harry Callahan
639f563a47 Update google_riscv-dv to google/riscv-dv@ada58fc
Update code from upstream repository https://github.com/google/riscv-
dv to revision ada58fc57a6bc1265e6c261b0f468a79c946a640

* [pmp] Fix plusarg detection for MML and MMWP (Marno van der Maas)
* [pmp] Add missing line return (Marno van der Maas)
* [pmp] Improve formatting of PMP addresses for debug (Marno van der
  Maas)
* [pmp] Add a register for loop counter in PMP traps instead of
  mscratch (Marno van der Maas)
* [pmp] Add illegal TOR and NAPOT address mode constraints (Marno van
  der Maas)
* [pmp] Try to skip instruction if no PMP match and in MMWP (Marno van
  der Maas)
* [pmp] Store and load faults caused by locked PMP regions now skip to
  next instruction (Marno van der Maas)
* [pmp] Check for MML before modifying PMP entry in trap handler
  (Marno van der Maas)
* [pmp] Allow already configured addresses to be overwritten with
  plusargs (Marno van der Maas)
* [pmp] Use kernel_inst_end for end of code entry (Marno van der Maas)
* [pmp] Add end of kernel stack to stack entry (Marno van der Maas)
* [pmp] Put signature and stack in last PMP entries (Marno van der
  Maas)

Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
2022-10-25 16:07:33 +01:00
Pirmin Vogel
28935490c2 [rtl] Protect core_busy_o with a multi-bit encoding
This commit protects the core_busy_o signal using a multi-bit encoding
to reduce the chances of an adversary for glitching this signal to low,
thereby putting the core to sleep and e.g. not handling an alert.

Without this commit, the glitch would only be detected once both the
main core and the shadow core wake up again and the comparison of the
core_busy_o signals continues.

This resolves lowRISC/Ibex#1827.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2022-10-25 12:52:01 +02:00
Greg Chadwick
f385d4d6b1 [dv] Add cpuctrlsts writes to riscv_rand_instr_test
This will have the effect of randomly enabling/disabling

 - The ICache
 - Dummy instruction insertion
 - Data independent timing
2022-10-22 20:30:49 +01:00
Greg Chadwick
a0fe5ea3b7 [dv] Fix RVFI stage valid logic
Previously if a dummy instruction entered the pipeline whilst it
wouldn't make RVFI stage 0 valid, it would make RVFI stage 1 valid.

Now stage 1 can only become valid if stage 0 was valid.
2022-10-22 20:30:49 +01:00
Greg Chadwick
4effc487e0 [cosim] Implement double fault detection
This adds an implementation of the double_fault_seen and sync_exc_seen
fields in cpuctrlsts.
2022-10-22 20:30:49 +01:00
Harry Callahan
e38f534ac2 Add wall-clock timeout within rtl simulation to gracefully end
Use a DPI call to unix 'date' to implement a wall-clock timeout entirely within
a simulation. This allows the UVM environment to gracefully end when the
threshold is reached, and for things like logs and coverage databases to be
generated correctly.
Previously, a process-level timeout was used, which gave the running simulation
no time to commit any logs/databases to disk before ending. Hence we would not
gather any coverage from timed-out tests.

A plusarg 'test_timeout_s' can be specified to each test to set the timeout. The
default timeout is 1800s.
2022-10-21 17:22:09 +01:00
Harry Callahan
0b2a7c4f4e Add mechanism for test-specific timeout
Adding the key 'timeout_s' to the testlist.yaml file for each test
now sets the timeout for all iterations of that test. Value in seconds.

e.g.
Set all iterations of the pmp_full_random test to have a 10s timeout.
```
- test: riscv_pmp_full_random_test
  timeout_s: 10
```
2022-10-21 17:22:09 +01:00
Harry Callahan
a44d9827d7 Fixup mem_intf seq to update cosim mem on DMEM uninit accesses
Give the sequence a handle to the cosim_agent, upon which it can call a method
to update the cosim memory model directly.
This required a small restructure of the mem_intf packages to prevent a circular dependency.
2022-10-21 17:13:18 +01:00
Harry Callahan
ee0fd38e7d Change ibex_mem_intf_response_seq to handle uninit memory differently
Reading uninit DMEM returns a random value.
Reading uninit IMEM returns returns {2{C.unimp}}.

Inserting intg errors upon uninit accesses is now gated with a plusarg
"+enable_bad_intg_on_uninit_access=1"

Fix missing update of the rtl mem_model when returning random data.
2022-10-21 17:13:18 +01:00
Marno van der Maas
a376f85f26 [lint] Shellcheck bash scripts in repo 2022-10-21 14:52:42 +01:00
Andreas Kurth
ce536ae476 [rtl] Assert that dummy instructions only write R0
Signed-off-by: Andreas Kurth <adk@lowrisc.org>
2022-10-19 10:50:01 +01:00
Marno van der Maas
73e46b4fc7 [fcov,pmp] Illegal PMP write coverpoints check dside request error not low 2022-10-19 10:20:32 +01:00
Canberk Topal
33f1d0a702 Update google_riscv-dv to google/riscv-dv@e0eae9e
Update code from upstream repository https://github.com/google/riscv-
dv to revision e0eae9e0ca69770c519c82c48421005f65521eac

* [sv] Explicit type casting for VCS compability (Canberk Topal)

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2022-10-17 11:00:35 +01:00