Commit graph

688 commits

Author SHA1 Message Date
Udi
321a3d267f [dv] fix spurious LSF enabling
Signed-off-by: Udi <udij@google.com>
2020-04-23 15:15:41 -07:00
Rupert Swarbrick
cf33bfeae0 Temporarily disable PMP/MEM errors in icache testbench
This allows tests to run to completion. Unfortunately, the core agent
currently has a bug in how it handles errors (if a sequence item
terminates with an error and is followed by a 'req' sequence item, the
test hangs).

I'll fix that in a separate patch soon (and revert this commit), but
don't want the memory agent changes to depend on the fix.
2020-04-23 11:12:45 +01:00
Rupert Swarbrick
5cd874ea71 Initial memory agent for ICache UVM testbench
As with the core agent, this doesn't yet have any proper monitoring,
and the testbench has no scoreboard, so we're not actually checking
anything.

However, it *does* implement a slave agent which can respond to
instruction fetches from the icache. This runs a test to completion,
try:

   make -C dv/uvm/icache/dv run WAVES=1

Note that the timeout in the hjson file was too small, so this bumps
it to a larger value. A later patch will replace the timeout with a
heartbeat monitor, which should be much cleaner.

The exact dance for the UVM reactive slave is complicated. See
dv/uvm/icache/dv/ibex_icache_mem_agent/README.md for the details.
2020-04-23 11:12:45 +01:00
Udi
d0ea6fe449 [dv] update directory paths for riscv-dv coverage
Signed-off-by: Udi <udij@google.com>
2020-04-22 00:46:00 -07:00
Tom Roberts
dc8ba83de4 [memutils] Add support for > 32b memories
Pack > 32bit memory loads into wider RAM instances. Fixes #790

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-04-20 16:04:43 +01:00
Udi
b4e5d91842 [dv] fix PMP compile option, update basic pmp test
Signed-off-by: Udi <udij@google.com>
2020-04-18 15:02:01 -07:00
Dawid Zimonczyk
f8f68945c0 update yaml file for riviera 2020-04-17 09:05:21 -07:00
Rupert Swarbrick
5a188342e7 Add clocking blocks to the ibex_icache_core_agent
Since this agent doesn't currently do any monitoring (will be
addressed in a later patch), the monitor_cb clocking block doesn't do
very much at the moment.

The driver_cb clocking block *is* used, though. The input lines are just
those needed to drive things correctly (ready is needed to do
ready/valid signalling properly; err is needed to abort instruction
fetches and do a branch after an error).

I've marked the output signals as negedge: this doesn't really make
any difference to simulation results, since the design samples
everything on posedge, but makes it rather easier to read dumped
waves.
2020-04-17 09:15:08 +01:00
Rupert Swarbrick
bce473b1dc Fix variable names in icache scoreboard code 2020-04-17 09:15:08 +01:00
Rupert Swarbrick
a93fc88f6f Fix scratch-root in icache/dv/Makefile 2020-04-17 09:15:08 +01:00
Rupert Swarbrick
5c51bc7e4d Rename ibex_icache_agent -> ibex_icache_core_agent
There is more than one icache-specific agent that we need for the
icache testbench, so "ibex_icache_agent" isn't a very helpful name.
This commit was pretty much automated, except for a few spacing
cleanups, with commands like:

    git grep -l ibex_icache_agent | \
      xargs sed -i 's!ibex_icache_agent!ibex_icache_core_agent!g'

(and then rename the directory and files).
2020-04-15 10:52:04 +01:00
Rupert Swarbrick
38422a03bc Minimal code for the 'core agent' in icache UVM testbench
This fills in the sequencer, driver etc. to actually drive signals.
You can "run" a test with

  make -C dv/uvm/icache/dv run

This won't do anything useful (it will stop with a timeout) because
there is no memory agent yet.
2020-04-15 10:04:03 +01:00
Rupert Swarbrick
754a8f3d09 Add a simple Makefile to wrap running dvsim for icache tests
This patch also includes a hacky test timeout. We'll remove this (or
at least make it bigger) when we start actually running data through
the tests, but this is handy for now because it means simulations
finish without having to pkill them.
2020-04-15 10:04:03 +01:00
Rupert Swarbrick
ba9b137488 Switch from 'bool' to 'int' parameters in fusesoc core files
Fusesoc has an unfortunate bug[1] where a boolean parameter which has
default true can't be disabled. For now, just make all our boolean
parameters back into integers again. In the future, when that's fixed,
maybe we should switch things back.

[1] https://github.com/olofk/fusesoc/issues/392
2020-04-14 15:30:26 +01:00
Greg Chadwick
aeb92bc7d4 Add RV32B parameter to ibex_core_tracing/ibex_riscv_compliance 2020-04-14 15:08:00 +01:00
Tom Roberts
97a50d7f12 [rtl] Add fixed time execution of branches
- A new parameter and a run-time control bit (DataIndTiming and
  data_ind_timing) enabling different behaviour for running security critical
  code sections.
- In the new mode, all branches act as if taken, with not-taken
  branches executing as a branch to the next instruction.
- This should give similar execution time/power characteristics
  regardless of the branch condition.
- Note that with the BranchTargetALU, branches stall an extra cycle in
  secure mode to avoid factoring the branch-taken decision into the
  branch target address mux.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-04-13 14:27:40 +01:00
Udi
58c0e33334 [dv] fix timing issue in ebreakmu_test
Signed-off-by: Udi <udij@google.com>
2020-04-09 09:06:32 -07:00
Rupert Swarbrick
98046adfbc Initial icache testplan
This doesn't list all that many entries, possibly because the icache
doesn't really have many modes of operation (enabled/disabled;
invalidating).
2020-04-09 13:09:12 +01:00
Rupert Swarbrick
e1bb1ed82e Fill out an initial DV plan for the icache
This currently has quite a lot of TBD sections, but should hopefully
describe my plan for the UVM testing reasonably well.
2020-04-09 09:22:13 +01:00
Greg Chadwick
f73da9ef3b [dv] Remove IUS support
IUS lacks support for certain language features used in Ibex (such as
use of $clog2 in localparam definitions) so remove it as a simulator
that can be used by dv.
2020-04-08 18:17:34 +01:00
Udi
47678a855a [dv] Fix running on LSF
Signed-off-by: Udi <udij@google.com>
2020-04-08 09:21:09 -07:00
Greg Chadwick
1d2959e00a [dv] Record failure on log processing error
Previous to this change the entire process would die on an issue with
processing a single log. This alters it so this will just add to the
failure count with the error logged and the log processing continued to
its end.
2020-04-07 09:47:57 +01:00
Greg Chadwick
75148da58c [dv] Quit on UVM errors by default 2020-04-07 09:47:57 +01:00
Greg Chadwick
4f39160843 [dv] Define `UVM for DV sim compiles
Without `UVM defined assertion failures don't result in regression
failure as they do not produce UVM reports.
2020-04-03 11:18:13 +01:00
udinator
e1b3cd1842
[dv] fix DSim simulation command options (#760)
Signed-off-by: Udi <udij@google.com>
2020-04-02 09:35:40 -07:00
udinator
add91d544d
[dv] fix timing issue in single_step test (#749)
Signed-off-by: Udi <udij@google.com>
2020-03-31 11:59:01 -07:00
Greg Chadwick
04ceda5267 [rtl] Add RV32B to various core files & top-levels 2020-03-31 16:49:08 +01:00
Rupert Swarbrick
f90877b766 Fix destination for dumped waves in dv/uvm
The previous code correctly dumped to "waves.fsdb" if you had Verdi
installed. Unfortunately, it dumped to the same file name if you
didn't, which was rather confusing.

This patch passes a "DUMP_BASE" environment variable, rather than
"DUMP_FILE", which doesn't include the extension. Then it appends the
correct extension at runtime in the TCL, when we tell VCS what sort of
dumping to do.

The code now also checks for all environment variables before reading
them, allowing defaults if they don't exist. The defaults might not be
what you want, but a syntax error at this point causes VCS to sit
waiting for terminal input (with no stdin!), which is kind of annoying.

I've also removed the copy-pasted Verdi documentation. Apart from
anything else, this is probably copyright, so we shouldn't have a copy
in the repo!
2020-03-31 09:28:25 +01:00
udinator
e92b51e188
[dv] move all SV interface includes into ibex_dv.f (#747)
Signed-off-by: Udi <udij@google.com>
2020-03-27 11:38:32 -07:00
udinator
f69c6fbabd
[dv] initial icache testbench (#711)
* [dv] add vendor .hjson files for dv tools

Signed-off-by: Udi Jonnalagadda <udij@google.com>

* Update common_ifs to lowRISC/opentitan@0d7f7ac7

Update code from subdir hw/dv/sv/common_ifs in upstream repository
https://github.com/lowRISC/opentitan to revision
0d7f7ac755d4e00811257027dd814edb2afca050

Signed-off-by: Udi Jonnalagadda <udij@google.com>

* Update csr_utils to lowRISC/opentitan@0d7f7ac7

Update code from subdir hw/dv/sv/csr_utils in upstream repository
https://github.com/lowRISC/opentitan to revision
0d7f7ac755d4e00811257027dd814edb2afca050

Signed-off-by: Udi Jonnalagadda <udij@google.com>

* Update dv_lib to lowRISC/opentitan@0d7f7ac7

Update code from subdir hw/dv/sv/dv_lib in upstream repository
https://github.com/lowRISC/opentitan to revision
0d7f7ac755d4e00811257027dd814edb2afca050

Signed-off-by: Udi Jonnalagadda <udij@google.com>

* Update dvsim to lowRISC/opentitan@0d7f7ac7

Update code from subdir util/dvsim in upstream repository
https://github.com/lowRISC/opentitan to revision
0d7f7ac755d4e00811257027dd814edb2afca050

Signed-off-by: Udi Jonnalagadda <udij@google.com>

* Update uvmdvgen to lowRISC/opentitan@0d7f7ac7

Update code from subdir util/uvmdvgen in upstream repository
https://github.com/lowRISC/opentitan to revision
0d7f7ac755d4e00811257027dd814edb2afca050

Signed-off-by: Udi Jonnalagadda <udij@google.com>

* Update dv_utils to lowRISC/opentitan@0d7f7ac7

Update code from subdir hw/dv/sv/dv_utils in upstream repository
https://github.com/lowRISC/opentitan to revision
0d7f7ac755d4e00811257027dd814edb2afca050

Signed-off-by: Udi Jonnalagadda <udij@google.com>

* [dv] initial icache testbench

Signed-off-by: Udi Jonnalagadda <udij@google.com>

* [dv] add top_pkg and its core file to icache/dv

Signed-off-by: Udi Jonnalagadda <udij@google.com>

* [dv] update ibex_core and ibex_icache corefile dependencies

Signed-off-by: Udi Jonnalagadda <udij@google.com>

* [dv] add .vpd support for wave-dumping

Signed-off-by: Udi Jonnalagadda <udij@google.com>
2020-03-27 11:02:47 -07:00
Greg Chadwick
1926318c1a Update .core files to add full parameter support
- Switch to boolean parameters where this makes sense
- Add MultiplierImplementation
2020-03-27 10:30:46 +00:00
Udi
74816ae124 [dv] update mtvec alignment in Makefile
Signed-off-by: Udi <udij@google.com>
2020-03-27 09:52:01 +00:00
udinator
8aae0ba31a
[dv] remove return value from the compare() step (#732)
Signed-off-by: Udi <udij@google.com>
2020-03-25 15:01:16 -07:00
Rupert Swarbrick
e70213d0ef Fix incorrect indentation in sim.py 2020-03-25 14:13:43 +00:00
Dawid Zimonczyk
2bf6f5fca2 correct passing argument for sim_opts 2020-03-25 13:52:01 +00:00
Dawid Zimonczyk
a6504e9111 added simulation option, added sv_seed in sim cmd 2020-03-25 13:52:01 +00:00
udinator
3af3e72b2f
[dv] fix irq timing in irq_in_debug_mode_test (#720)
Signed-off-by: Udi <udij@google.com>
2020-03-23 12:16:32 -07:00
Tom Roberts
c054a63c3d [rtl] Instantiate instruction cache
- Add parameters and actual instantiation of icache
- Add a custom CSR in the M-mode custom RW range to enable the cache
- Wire up the cache invalidation signal to trigger on fence.i

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-03-23 12:57:31 +00:00
Luís Marques
e9171001c3 [verilator] Fix --term-after-cycles
The option to limit the verilator simulation's maximum number of cycles was
implemented in terms of the `time_` variable, which counts half cycles. This
patch makes the limit respect the requested number of full cycles.

The patch divides `time_` by 2, instead of multiplying `term_after_cycles_`
by 2, as that better conveys the intended semantics, and slightly increases
the range of the limit. Related computations were modified for consistency.
2020-03-19 10:59:31 +00:00
udinator
56e4f48b58
[dv] workaround for dsim compile error (#716)
Signed-off-by: Udi <udij@google.com>
2020-03-18 16:20:36 -07:00
udinator
c800ae957b
[cov] remove unnecessary forward slash in makefile (#710)
Signed-off-by: Udi <udij@google.com>
2020-03-16 15:54:22 -07:00
udinator
4b952c8264
[dv] coverage generation (#704)
Signed-off-by: Udi <udij@google.com>
2020-03-16 09:07:50 -07:00
Greg Chadwick
3927fd8d2a [rtl/sw] Add multiply and divide wait counters 2020-03-13 14:48:29 +00:00
Rupert Swarbrick
efbfecbb38 Add missing dependencies in uvm/core_ibex/Makefile
When we run sim.py, we get commands to run the simulator from the YAML
file named by the --simulator_yaml argument, which defaults to
yaml/rtl_simulation.yaml.

This patch makes the argument explicit in the Makefile and adds a
dependency on that file for commands that read it.
2020-03-13 14:19:18 +00:00
Rupert Swarbrick
5773a1cd78 Explicitly pass directory for waves to VCS's UCLI TCL
This fixes a bug mentioned in issue #674, where dumped wave files were
ending up in dv/uvm/core_ibex, rather than a test-specific output
directory.

It turns out that this is because of my change in commit 08fc2a4,
which runs the simulator in the top core_ibex directory, rather than
changing directories each time. We have to do this to make the
parallel LSF flow work (which presumably has never actually been run,
otherwise we'd have noticed it was broken).

There are two ways I can think of getting this to work. Probably the
cleanest approach is to generate a script for each test, which looks
something like "cd test_dir; setup_stuff; run_simulator". This would
work (and is how I've seen it done in the past), but doesn't really
fit in with the string interpolation/YAML stuff we've got here.

Instead, this patch goes for a hackier approach, where we prefix the
simulation command with "env SIM_DIR=<out>" and then use the SIM_DIR
environment variable in the TCL scripts to figure out where to put the
wave file. This is kind of icky long-term, but should work for now.

I've also got rid of the code that appends some extra plusargs and a
log argument to the simulation command; now, the relevant variables
get substituted in and the actual command is found in
rtl_simulation.yaml.
2020-03-13 14:18:55 +00:00
Rupert Swarbrick
fd0d93ddf7 Explicitly use bash in UVM Makefile
This fixes issue #700
2020-03-13 13:36:25 +00:00
danghai
89318059cd Resolve Questa: Defaulting port to var rather than wire
For packed structs used as input/output port, Questa reports
"Defaulting port 'irqs_i' kind to 'var' rather than 'wire'
due to default compile option setting of -svinputport=relaxed."

The relevant help message says:

```
verror 13314:

vlog Message # 13314:
An input port that is declared with a type but without the 'var' keyword
should default to 'wire' for strict LRM conformance. The default compile
option of -svinputport=relaxed is not LRM compliant, and only defaults
4-state scalar or 4-state single dimension vector types to 'wire'.
Consider using -svinputport=net for strict conformance. See the vlog -help
text for other behaviors available with the -svinputport option.
```

In our code base we can rely on the LRM-compliant handling of this
construct and opt into that using `-svinputport=net`.

Fixes #670
2020-03-13 10:58:53 +00:00
danghai
39ce39e332 Questa qrun: Extra checking for conflicts with
always_comb and always_latch variables is done
at vopt time.

Suppress warning vlog-2583 to silence warning
Fixed: #696
2020-03-12 22:09:17 +00:00
Rupert Swarbrick
16e81f7a74 Fix typo in uvm/core_ibex/Makefile
Reported in issue 674.
2020-03-11 09:56:19 +00:00
Rupert Swarbrick
ee2729d9bf Add missing Makefile dependencies on testlist.yaml
This adds a dependency on $(TESTLIST) (which is that file) for each
target that depends on $(TEST_OPTS), a set of command line options
that includes --testlist=$(TESTLIST).

In practice, we could actually just add the dependency to the
$(metadata)/instr_gen.gen.stamp target, since all the other affected
targets transitively depend on that, but this seems a little confusing
so I've made the dependency explicit.
2020-03-11 09:25:42 +00:00