Commit graph

1496 commits

Author SHA1 Message Date
udinator
dbbb98f433
Update google_riscv-dv to google/riscv-dv@7675315 (#733)
Update code from upstream repository https://github.com/google/riscv-
dv to revision 76753158d940fffc53fbb92942ae5d1d768a7cdc

* configurable mtvec alignment (google/riscv-dv#527) (udinator)
* Update b-extention (google/riscv-dv#526) (weicaiyang)

Signed-off-by: Udi <udij@google.com>
2020-03-25 23:56:30 -07: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
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
624ef41462 [rtl] Extend BT ALU to be used for all jumps
- Create separate operand muxes for the branch/jump target ALU
- Complete jump instructions in one cycle when BT ALU configured

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-03-25 15:25:22 +00: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
Philipp Wagner
bdfe8de0f7 Update GCC to include bitmanip patches
Use a toolchain in CI which has support for experimental bitmanip
patches. This toolchain is based on GCC 9.2.0 with additional bitmanip
patches, and reports itself as 10.0 experimental.

The toolchain was prepared by Luís Marques in
lowRISC/lowrisc-toolchains#11. Thanks!

Addresses part of #703
2020-03-24 21:25:20 +00:00
Tom Roberts
3c561e4106 [rtl/icache] Fix an inconsistency in data output
- valid_o could be asserted for one cycle then dropped when receiving
  rvalid data for a request which has branched into  the middle of a
  line.
- This fix keeps valid_o asserted by using the offset version of
  fill_rvd_cnt_q (fill_rvd_beat) to compare against fill_out_cnt_q
  (which is also offset by the branch).

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-03-24 13:47:57 +00:00
Tom Roberts
f8f8560563 [rtl] Remove stall cycle with BT ALU
- Branches don't need to stall with the branch target ALU

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-03-24 13:47:25 +00:00
udinator
2c198383a3
Update google_riscv-dv to google/riscv-dv@5baf82a (#723)
Update code from upstream repository https://github.com/google/riscv-
dv to revision 5baf82a24347dae3cb71c8ab66a66494666d2291

* Fix illegal func3/func7 instruction generation for B-extension
  (google/riscv-dv#525) (taoliug)
* more tightly constrain pmpaddr values (google/riscv-dv#524)
  (udinator)
* Update style check (Weicai Yang)
* Bump verible (Tomasz Gorochowik)
* Add target for B-extension (google/riscv-dv#521) (taoliug)
* [cov] tag coverage database directories with <test_id> (Udi
  Jonnalagadda)
* Add bit manipulation (google/riscv-dv#518) (weicaiyang)
* Don't change input file in spike_log_to_trace_csv.py (google/riscv-
  dv#504) (Rupert Swarbrick)
* Fix ius constraint solver failure (google/riscv-dv#515) (taoliug)
* Fix AMO sequence address generation issue (google/riscv-dv#514)
  (taoliug)
* Remove alignment constraint (google/riscv-dv#513) (taoliug)
* Add section for each data region (google/riscv-dv#512) (taoliug)

Signed-off-by: Udi <udij@google.com>
2020-03-23 13:33:38 -07: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
0a540cffb3 [rtl/icache] Fix a couple of icache bugs
- Speculative requests observing a PMP error shouldn't increment the
  external request counter
- Remove redundant logic on fill_rvd_exp

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-03-23 12:57:54 +00: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
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
Tom Roberts
8bb649e4ab [rtl/icache] Fix PMP error logic
Instruction requests triggering PMP errors have their external request
suppressed. The beat counting logic therefore needs to know that these
requests will never receive any rvalid data responses.

This fix stops the external request counter from incrementing, and marks
all external requests complete as soon as any error is received.

The data in the cache line beyond the error is not required since the
core cannot access it without consuming the error first.
2020-03-18 12:53:09 +00:00
Tom Roberts
ef17d4fcc2 [rtl] Add Icache ECC
- Add modules for ecc generation and checking
- Add supporting logic to icache module

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-03-18 11:28:06 +00:00
Tom Roberts
fe00eb46e9 [rtl] Icache RAM primitive changes
- Bring in a version of ram primitive with configurable width similar to
  the OT RAM primitive.
- Change the RAM banking structure to be a single bank of LineSize (64
  bits) to match the upcoming ECC granularity.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-03-18 11:28:06 +00: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
Philipp Wagner
1ac5a74a83 Enable the use of Verible through fusesoc
Run

```
fusesoc --cores-root . run --no-export --target=format --tool=veribleformat lowrisc:ibex:ibex_core
```

to format all source code with Verible's verilog_format tool.
2020-03-16 16:54:41 +00:00
Philipp Wagner
4fcf72db60 Add Verible lint as one lint option
This extends the core file to be able to call Verible for lint.

This requires an updated version of edalize with
https://github.com/olofk/edalize/issues/95 fixed. For the time being, we
use the same 'ot' branches of those tools as we do in OpenTitan. Once
Verible becomes officially supported we need to ensure that released
versions of fusesoc and edalize exist, and that this requirement is
properly documented.
2020-03-16 16:54:41 +00:00
udinator
4b952c8264
[dv] coverage generation (#704)
Signed-off-by: Udi <udij@google.com>
2020-03-16 09:07:50 -07:00
Tom Roberts
854faeda39 [rtl/icache] Make age matrix more consistent
The design currently relies on fill_done remaining set in the cycle
after the fill buffer completes to ensure the fill_older_q entry gets
cleared (when a fill buffer completes in the same cycle that one is
allocated). This fix makes the behaviour a bit more consistent and easy
to reason about.
2020-03-16 13:12:19 +00:00
Greg Chadwick
e03aeb1f4f [CI] Add explicit trigger for branches/PRs
Azure pipelines has stopped triggering, the issue is being fixed but
this works around it for now.
2020-03-16 10:19:16 +00: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
Rupert Swarbrick
0a0a18c2cb Notes on the ICache specification
This also adds a couple of comments splitting up the ports in
ibex_icache.sv that I found helpful when working out what everything
did.
2020-03-13 13:13:19 +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
29e6656ef7 Ignore modelsim.ini generated from Questa tool 2020-03-13 10:58:53 +00:00
Philipp Wagner
1c82c20132 Remove property from assert message
Assert macros in prim_assert.sv report the asserted property as part of
the error message if the assertion fails. Doing that requires us to
stringify the property. If the property is multi-line in the source
code, this produces a multi-line string. According to the
SystemVerilog standard, a multi-line string requires a backslash (`\`)
at the end of a line. Adding this backslash through a macro is not
possible (at least to my knowledge), giving us no way to produce a
standards-compliant implementation of the `ASSERT` macros that report
the property as string.

This commit therefore removes the property from the error message if an
assertion fails. It makes these messages less useful, but the
information can still be recovered in a less convenient way through the
name of the assertion, and the file and line numbers. File and line
number were missing from the non-UVM code path before, this commit adds
them there as well.

Fixes #669
2020-03-13 10:47:40 +00:00
Philipp Wagner
80269c82ab Align prim_assert.sv with OpenTitan
OpenTitan commit ce974659db7b2b99a75ac407eadefbf2912b8539 slightly
modified prim_assert.sv, copy over these changes to align the two
implementations.
2020-03-13 10:47:40 +00:00
Philipp Wagner
73c0b810a9 Use a syntax compatible with Verible
Verible doesn't do real pre-processing currently, and fails to parse
code if define sections span across headers of blocks, as we did.

Use another syntax instead for the one case where we did that to work
around this limitation. The code isn't less readable as result, making
this an acceptable trade-off.

Works around https://github.com/google/verible/issues/228
2020-03-13 10:34:12 +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
134f515e4f Add missing space after code-block directive
Without this, Sphinx spits out a warning message and swallows the
block.
2020-03-12 16:51:21 +00:00
Greg Chadwick
e89a939b0a [syn] Place result directories in sub-directory
syn/ filling up with result directories is a little annoying, this sets
up the default so everything ends up generated under syn/syn_out/. Flow
users can easily change this to meet their personal requirements.
2020-03-12 13:44:09 +00:00
Rupert Swarbrick
b6dfb71927 Ignore Emacs backup files 2020-03-12 11:46:14 +00:00
Philipp Wagner
a28170d6a7 [doc] Fix paths in verification documentation
The files moved; also add an explicit `cd` to the command listing to
help people only skimming the docs.
2020-03-12 11:05:05 +00:00
Greg Chadwick
4f31a0e6e8 [rtl] Fixes for single-cycle mutiply
* single cycle multiplier configuration needlessly stalled for a cycle
* mult_hold wasn't being set in mult state machine in single cycle
  multiplier
2020-03-11 11:53:54 +00:00
Tom Roberts
6be55207f3 [rtl] Refactor some IF/ID stage registers
- Rewrite the ID instr flops to be clock gate friendly
2020-03-11 11:43:40 +00:00
Tom Roberts
2a90ef94ed [rtl] IF stage timing fix
- ready_i input to the prefetch buffer factored both it's own valid_o
  output and the pc_set branch signal, neither of which are required.
- Refactoring the ready_i signal to just id_in_ready_i improves timing
  significantly for the icache.
- Also removed offset_in_init signal which appeared to serve no purpose.
2020-03-11 11:43:40 +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