Commit graph

361 commits

Author SHA1 Message Date
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
udinator
4cb3fc4ce6
update riscvOVPsim.ic for semihosting mode (#681)
Signed-off-by: Udi <udij@google.com>
2020-03-10 16:50:29 -07:00
Rupert Swarbrick
7b97d21b42 Respect --lsf_cmd when compiling TB in sim.py 2020-03-10 09:16:16 +00:00
Rupert Swarbrick
73658abb63 Fixup module docstring in sim.py
The copyright notice should surely be in a comment, rather than the
docstring. And change the docstring itself to match what the file
does.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
b90a24f00c Tidy-ups in sim.py's compare function
This is mostly just adding comments and docstrings and pulling the
guts of the comparison into its own function.

I've also got rid of the subprocess calls for appending to a log file
and now calculate the pass/fail count from the return codes of the
checkers rather than grepping in the regression log (hopefully it
gives the same result!)
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
c6400cccc0 Remove unnecessary DV_DIR variable in dv/uvm/core_ibex/Makefile
Since we're not doing stuff with 'make -f path/to/Makefile', we always
know that DV_DIR (as computed) is the current directory, so we can get
rid of it completely.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
08fc2a4af6 Various cleanups in sim.py's rtl_sim function
This is a bit more verbose, but I think it's a bit more obvious what's
going on, and quite a lot of the added lines are docstrings explaining
the code.

We now split "find the list of commands to run" from "run the
commands" with or without LSF.

The other major change is that the --lsf_cmd parameter defaults to
None, rather than the empty string. The patch also updates the
Makefile accordingly.

Finally, since we're now a little more careful with passing paths
around, we don't have to change cwd for each run. I'm not convinced
that the LSF mode actually worked before, since we needed to run each
command in a different directory. It should probably work now, but I
don't have access to LSF to check.

The only sad thing is that UVM leaves a 'tr_db.log' file lying around
in the current directory. I don't think we really care about the
contents, but can't see how to disable it, so I've added it to
gitignore.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
cbe58b36ab Pick a seed per run in sim.py
Before this patch, the default behaviour picked a different random
seed for each test run (and didn't store it anywhere). I think this is
a bit confusing: you can't reproduce the test without digging around
in log files. Now, we pick a seed at the start of the program, print
it, and use it for each test (not as crazy as this sounds: the seed
controls things like random stalls, but the tested program will be
different each time).

Note that this patch won't actually have any effect, since we
currently only use sim.py from dv/uvm/core_ibex/Makefile, which
specifies the seed every time.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
54bce35816 Remove last use of re library in sim.py
We were only ever using this for searching for, and replacing, literal
strings. Using str.replace instead.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
f9ea35d22b Remove --riscv-dv-root argument from sim.py
This is set to what you'd expect in the Makefile and it seems a little
odd anyway: surely we should use the same directory as the code we're
running?
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
04b5cb2d46 Clean up --en_cov and --en_wave in sim.py
Since these are boolean flags "enable this, please", we use argparse's
support for them.

Command line change:

  Before: --en_cov=0
  After:

  Before: --en_cov=1
  After:  --en_cov

and similar for en_wave
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
d934a4485b Tidy up path name arguments in sim.py
Now the defaults for --testlist and --simulator_yaml should work, no
matter where it's called from.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
00bc7ca038 Tidy up command substitution in sim.py
This generally tidies up and documents how we substitute options and
environment variables in get_simulator_cmd. It's now slightly laxer,
so it won't moan about a missing environment variable or option if
it's not actually used in the command.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
341abb9a7a Move main program of sim.py into a function
This means we can wrap main() in a try/except block. That way, future
patches can change code that fails to throw an exception, rather than
having to do the ugly "write to stderr; exit 1" dance.

This also catches a global (cwd) which we were passing implicitly to
rtl_sim. Fortunately, we already have that value in _CORE_IBEX, so can
just use that.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
411ee3f458 Tidy up imports in sim.py
We now put sys.path back after importing things and no longer import
'*' from anything (which means static analysis tools can now spot when
we've got a name wrong).
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
ca61654261 Re-indent sim.py
This should have no functional change: it just indents the code with
4-space indents and wraps any long lines.
2020-03-10 09:16:16 +00:00
danghai
32ba3cd92e It should give error message instead of info message for failure 2020-03-10 09:16:16 +00:00
udinator
ea654b7681
[ml] fix irq test for ML (#675)
Signed-off-by: Udi <udij@google.com>
2020-03-09 18:55:33 -07:00
udinator
b54ef5b1e0
[dv] update timeout for INITIALIZED response (#672)
Signed-off-by: Udi <udij@google.com>
2020-03-09 15:54:13 -07:00
udinator
753e76549d
[ml] add condensed test targets for ML (#659)
Signed-off-by: Udi <udij@google.com>
2020-03-09 12:59:47 -07:00
danghai
6fc0a667e2 Add support for Qrun Questa 2020-03-09 14:36:05 +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
e4b8851b4b Revert "Re-instate an 0x in dv/uvm/core_ibex/Makefile"
This reverts commit c32a088f0c.

The bug fixed by this was also fixed in riscv-dv leading to two 0x being
inserted into generated .S files.

Fixes #661
2020-03-06 13:55:12 +00:00
Noam Gallmann
11a5fc24d4
Merge pull request #624 from ganoam/fpga-opt-perf-mon-pr
Modifiy Performance Counter for DSP Inference
2020-03-06 12:49:51 +01:00
Rupert Swarbrick
c32a088f0c Re-instate an 0x in dv/uvm/core_ibex/Makefile
The --end_signature_addr argument doesn't go to Verilog; instead it
makes it through run.py (vendored-in, so hard to change) and
eventually gets inserted into some assembly code.

Before this patch,

    make ITERATIONS=1 TEST=riscv_csr_test ISS=spike SEED=123

failed with:

  out/seed-123/instr_gen/asm_tests/riscv_csr_test_0.S: Assembler messages:
  out/seed-123/instr_gen/asm_tests/riscv_csr_test_0.S:526: Error: illegal operands `li x2,8ffffffc'
  out/seed-123/instr_gen/asm_tests/riscv_csr_test_0.S:533: Error: illegal operands `li x2,8ffffffc'
2020-03-05 16:09:03 +00:00
danghai
88f1a7e38f Fix qrun compile warning 2020-03-05 14:59:25 +00:00
Rupert Swarbrick
98c8cd39ea Add missing flop to bus error checking in riscv_testutil.sv
This caused a (verbose!) combinatorial loop error in Verilator.
2020-03-03 11:35:07 +00:00
Rupert Swarbrick
ddb34bcb75 Avoid two combinatorial loop warnings in riscv_compliance suite
We do this by pulling the definition of host_addr_o and host_req_o out
of an always_comb process in riscv_testutil.sv.

When set inside the process, Verilator warns about a combinatorial
loop. This happens because a read request could go out on the bus and
appear again (combinatorially) on the slave interface, setting
read_signature_and_terminate. This doesn't actually happen (because
read_signature_and_terminate only takes effect when we are in state
WAIT), but Verilator's sensitivity tracking isn't fine-grained enough
to notice.
2020-03-03 11:35:07 +00:00