Commit graph

1524 commits

Author SHA1 Message Date
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
0852120462 [rtl] Fix xprop issues in cs_registers
Alter how logic for csr_wreq was written to not propagate X when using
certain more pessimistic modes of x propagation in simulation.
2020-04-07 09:08:26 +01:00
Greg Chadwick
cb8afccb7c [rtl] Modify ASSERT_KNOWN uses to work with xprop
When xprop is enabled various case and if/else constructs will propagate
X leading to failures in ASSERT_KNOWN. This introduces enable terms to
various ASSERT_KNOWN uses that would otherwise fail without them.

prim_assert.sv changes copied across from OpenTitan respository.
2020-04-07 09:08:26 +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
Philipp Wagner
f8aacd15be [doc] Add Ibex Concierge documentation
Add a document how we plan to run the Ibex Concierge duty.

Signed-off-by: Philipp Wagner <phw@lowrisc.org>
2020-04-01 18:16:23 +01: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
7dae33abc2 [ci] Mark configs using experimental features 2020-03-31 16:49:08 +01:00
Greg Chadwick
230e879651 [ci] Add Ibex with RV32B to configurations
Note this doesn't introduce any testing of the RV32B instructions,
simply runs existing tests on a configuration with the RV32B extension
enabled.

Fixes #745
2020-03-31 16:49:08 +01: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
Tom Roberts
08f2271c75 [rtl] Unify top-level parameter declaration
- Make parameter declaration order and default values in
  ibex_core_tracing.sv match the documentation

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-03-27 17:28:15 +00:00
Tom Roberts
9f9ff3ee8e [doc/icache] Document the err_plus2_o signal
Add a few sentences to describe the behaviour/meaning of the err_plus2_o
signal, and how it is used by the core.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-03-27 17:27:54 +00:00
Tom Roberts
ea2ffe82f1 [rtl/pmp] Fix PMP error prioritization
- Region matches should be prioritized from 0 - N as stated in the RISCV
  Privileged Spec v1.11

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-03-27 16:43:35 +00:00
ganoam
8a26111f40 [bitmanip] Add ZBB Instruction Group
This commit implements the Bit Manipulation Extension ZBB instruction
group: clz, ctz, pcnt, slo, sro, rol, ror, rev, rev8, orcb, pack
packu, packh, min, max, andn, orn, and xnor.

* Bit counting instructions clz, ctz and pcnt can be implemented to
        share much of the architecture:

        clz: Count Leading Zeros. Counts the number of 0 bits at the
                MSB end of the argument.
        ctz: Count Trailing Zeros. Counts the number of 0 bits at the
                LSB end of the argument.
        pcnt: Counts the number of set bits of the argument.

        The implementation uses:

        - 32 one bit adders, counting the set bits of a signal
                bitcnt_bits, starting from the LSB end.

        - For pcnt the argument is fed directly into bitcnt_bits.

        - For clz, the operand is reversed such that leading zeros are
                located at the LSB end of bitcnt_bits.

        - For ctz and clz: counter enable signal for 1-bit counter i
                is high, if the previous enable signal, and
                its corresponting bitcnt_bit was high.

* Instructions sll[i], srl[i],slo[i], sro[i], rol, ror[i], rev, rev8
        and orc.b are summarized as shifting instructions and related:

        The following instructions are slight variations of the
        existing base spec's sll, srl and sra instructions.

        - slo[i] and sro[i]: shift left/right ones: similar to
                shift-logical operations from base spec, but shifting
                in ones instead of zeros.

        - rol and ror[i]: rotate left/right ones: circular shift
                operations. shifting in values from the oposite end
                of the operand instead of zeros.

        Those instructions can be implemented, sharing the base spec's
        shifting structure. In order to support rotate operations, a
        64-bit shifting structure is needed.

        In the existing ALU, hardware is described only for right
        shifts. For left shifts the operand is initially reversed,
        right shifted and the result is reversed back. This gives rise
        to an additional resource sharing oportunity for some more
        zbb operations:

        - rev: bitwise reversal.

        - rev8: byte-order swap.

        - orc.b: byte-wise reverse and or-combine.

* Instructions min, max:
        For the B-extension's min/max instructions, we can share the
        existing comparison operations. The result is obtained by
        activating the comparison structure accordingly and
        multiplexing the operands using the comparison result.

* Logic-with-negate instructions andn, orn, xnor:
        For the B-extension's logic-with-negate instructions we can
        share the structures of the base spec's logic structures
        already present for 'xnor', 'or' and 'and' instructions as
        well as the conditionally negated b operand generated for
        subtraction operations.

* Instructions pack, packu, packh:
        For the pack, packh and packu instructions I don't see any
        opportunities for resource sharing. However, the architecture
        is quite simple.

        - pack: pack the lower halves of rs1 and rs2 into rd, with rs1
                in the lower half and rs2 in the upper half.

        - packu: pack the upper halves of rs1 and rs2 into rd, with
                rs1 in the lower half and rs2 in the upper half.

        - packh: pack the LSB bytes of rs1 and rs2 into rd, with rs1
                in the lower half and rs2 in the upper half.

Signed-off-by: ganoam <gnoam@live.com>
2020-03-27 17:13:26 +01:00
Rupert Swarbrick
158e9b9714 Clarify a couple of points in icache documentation
When a PMP error comes in, the cache doesn't quite behave as if the
request was granted (if it did: it would wait forever for a response).
Hopefully this version is a bit clearer.

Also, this makes explicit that the upper bits of a 16-bit instruction
fetch can be bogus.
2020-03-27 14:34:02 +00:00
Philipp Wagner
1002b83ae3 Factor out ibex_pkg.sv into a separate core file
The ibex_pkg.sv file is effectively a "header" with useful defines;
we need them in ibex_tracer_pkg.sv, and in other places around Ibex.
Currently, the dependency between ibex_tracer_pkg.sv and ibex_pkg.sv
wasn't covered in a FuseSoC core file, leading to unstable behavior.

This patch adds this dependency by
- factoring out the ibex_pkg.sv file into a separate core file,
  ibex_pkg.core, and
- adding a dependency on the new ibex_pkg core to the ibex_tracer core.
2020-03-27 10:44:09 +00:00
Philipp Wagner
209d7e0eaf Fix description of ISA extensions in core file 2020-03-27 10:44:09 +00:00
Greg Chadwick
dba0529156 [ci] Introduce multiple-configuration CI 2020-03-27 10:30:46 +00:00
Greg Chadwick
e1aac0735c [rtl] Lint fixes 2020-03-27 10:30:46 +00: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
Philipp Wagner
cef7b4d154
Remove unused ibex_pkg from tracer (#737)
Signed-off-by: Philipp Wagner <phw@lowrisc.org>
2020-03-26 14:14:24 -07:00
Philipp Wagner
38c3d19a0f Correct PMP granularity equation
The `+2` part should have been part of the exponent, as indicated by the
RISC-V spec.
2020-03-26 10:02:06 +00:00
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