Commit graph

2477 commits

Author SHA1 Message Date
Philipp Wagner
b99da424ff [style] Indent package bodies
The style guide requires the package body to be indented with two
spaces.
2021-08-31 15:30:28 +02:00
Philipp Wagner
a25790abf9 [style] Indent module header with two spaces
Both the parameter and the port list in a module header should be
indented with two spaces, according to our style guide.
2021-08-31 15:30:28 +02:00
Philipp Wagner
87bcd13a12 [style] Use logical operators for reset 2021-08-31 15:30:28 +02:00
Philipp Wagner
be27bc8bcf [style] Fix whitespace issues around operators
Our style guide typically require a single whitespace around operators.
2021-08-31 15:30:28 +02:00
Philipp Wagner
b5011ecec6 [style] Format module instantiations in tabular format
The style guide mandates tabular format in port expressions in module
instantiations
(https://github.com/lowRISC/style-guides/blob/master/VerilogCodingStyle.md#module-instantiation).

The style guide also mandates a two-space indentation for ports and
parameters in module instantiations.

Apply the formatting produced by verible-format to match our style
guide.
2021-08-31 15:30:28 +02:00
Tom Roberts
48f11c6733 [rtl] Add bus integrity checking
Extra bits are added alongside read/write data for the instruction and
data buses to facilitate data integrity checking.

Ibex testbench extended to generate the expected bits.

All other top-levels modified to add the new signals (which are mostly
ignored).

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-08-26 16:55:26 +01:00
Pirmin Vogel
14115ea3a8 [util] Document minimal requirement for Xilinx Vivado
This is related to lowRISC/Ibex#1425.
2021-08-26 14:42:26 +02:00
Greg Chadwick
3f9022a16d [rtl] Fix mtval for unaligned accesses
Previously the raw incremented address was used which is the calculated
address + 4. This is confusing as it refers to a byte that wouldn't be
accessed (e.g. a lw at 0x8000009e which faults on the access to
0x8000000a0, would report an mtval of 0x8000000a2). With this change
mtval will refer to the first byte on the other half of the word
boundary the unaligned access crosses.
2021-08-13 15:45:29 +01:00
Tom Roberts
65bf9c94f9 [rtl] Add LFSR permutation option
Random constants are sent through the hierarchy as parameters in-line
with other OpenTitan modules.

Further detail on this mechanism can be found in lowrisc/opentitan#2229

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-08-10 16:13:02 +01:00
Greg Chadwick
dbc2b6f5dc [rtl/doc] Update ePMP CSR addresses and documentation
mseccfg and mseccfgh have changed their addresses. This updates to the
newly allocated values.

The ePMP specification is now available as a versioned PDF,
documentation is updated to point to that removing the local PDF copy.
2021-08-05 08:01:56 +01:00
Canberk Topal
9af580f6d9 [fpga] Add power analysis scripts to FPGA example
This commit adds power analysis scripts to the Arty A7
example design. They can be used by setting the newly
added `FPGAPowerAnalysis` parameter to 1.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2021-08-03 16:51:16 +01:00
Canberk Topal
1b1247e1de [fpga] Changed to 2p_ram for FPGA top level
1-Port RAM is removed because of both execution and performance
issues. CLKIN1_PERIOD parameter is defined in clkgen module
for Vivado simulations.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2021-08-03 16:51:16 +01:00
Canberk Topal
4b54d79fb4 [sw/fpga] coremark/link.ld update for FPGA sim
This commit updates link.ld RAM length to include max BRAM capacity
for Arty A7-35. It also changes coremark makefile to include a .vmem
output, which then can be used for FPGA implementations.

Signed-off-by: Canberk Topal <ctopal@lowrisc.org>
2021-08-03 16:51:16 +01:00
Tom Roberts
7c0b1ff160 [rtl] Add register slice on output of shadow core
This decouples the shadow core from any timing paths and so should ease
implementation.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-08-03 13:47:00 +01:00
Tom Roberts
4d729e20e5 [rtl] Buffer cleanup in top-level
A minor change to use the Width parameter of prim_buf. No functional
impact but stops the hierarchy from being cluttered with hundreds of
generate contexts in the top level.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-08-03 13:47:00 +01:00
Dawid Zimonczyk
d44966373e Added cast to enum 2021-07-26 09:48:41 +01:00
Tom Roberts
a1902004f9 [rtl] Add ResetAll parameter
This parameter forces a reset of all registers inside the core. This is
required to guarantee a common starting point for lockstep and thus
prevent spurious lockstep failure alerts.

Another minor change in this commit rearranges the writeback stage
multiplexing to gate incoming lsu write data when not valid. This stops
any X values from the data bus propagating to the register file
signalling (and thus to the lockstep comparison) which would cause the
lockstep alert to be X. It has the side effect of possibly reducing
power consumption in the register file.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-07-22 16:53:27 +01:00
Philipp Wagner
44777dc16d Copy verible-format configuration from OpenTitan
This configuration is the closest we can get to our style guide right
now, so let's go with that.
2021-07-22 13:17:21 +01:00
Philipp Wagner
d003d479ff Update lowrisc_ip to lowRISC/opentitan@da3ac7c4e
Update code from upstream repository
https://github.com/lowRISC/opentitan to revision
da3ac7c4eb23a92194874ad2daf2e5f9e3330572

* [memutil] Allow use without scrambled memories (Philipp Wagner)
* [prim_prince] Fix comment (Philipp Wagner)
* [memutil] Fix width mismatch (Philipp Wagner)
* [prim] Allow disabling SVAs ensuring REQ is held until ACK at run
  time (Pirmin Vogel)
* [prim] Fix typo that caused fifo_async to get stuck (Timothy Chen)
* [prim] Add a missing ROM_CFG_DEFAULT to prim_rom_pkg.sv (Rupert
  Swarbrick)
* [dvsim] Do not assume the build failed if "ERROR" is printed
  (Philipp Wagner)
* [prim_subreg_shadow] Invert meaning of SWACCESS in shadow/stage regs
  (Michael Schaffner)
* [prim_arb_tree/rv_plic_target] Remove TODOs due to a Vivado tool bug
  (Michael Schaffner)
* [primgen] Remove unused import (Philipp Wagner)
* [primgen] Add shebang (Philipp Wagner)
* [primgen] Make primgen "portable" again (Philipp Wagner)
* [dv] Small optimization in memutil (Philipp Wagner)
* [tools/ascent] updated ascent to use the --job-prefix option (Rasmus
  Madsen)
* [otp_ctrl] Remove invalid command error (Michael Schaffner)
* [tlul] Add some missing dependencies (Michael Schaffner)
* [otbn/otp_ctrl] Replicate dmem scrambling keystream (Michael
  Schaffner)
* [adc_ctrl] Various preparation steps for d2 (Timothy Chen)
* [tools/dvsim] Fix some VCS flags (Guillermo Maturana)
* Revert "[prim] Do remove prim_esc.core from the dependencies"
  (Rupert Swarbrick)
* [prim] Remove dependency of prim:esc on a hardware block (Rupert
  Swarbrick)
* [lint] prim_ram_1p_scr verilator lint fixes (Greg Chadwick)
* [dv] Add scrambled_ecc32_mem_area for memutils (Greg Chadwick)
* [dv] Add C++ memory scrambling model (Greg Chadwick)
* [tools/dsim] Fix non-LRM compliant code (Guillermo Maturana)
* [prim] Do remove prim_esc.core from the dependencies (Michael
  Schaffner)
* [dv/dv_utils] Improvement on `max` function (Cindy Chen)
* [alert_handler] Implement reverse ping feature (Michael Schaffner)
* [prim_esc] Split the prims into their own core file (Michael
  Schaffner)
* [dvsim] Fix GUI mode and launcher creation fixes (Srikrishna Iyer)
* [dv/common] Stress_all_with_rand_reset apply reset concurrently
  (Cindy Chen)
* [dv/all] update scoreboard `csr_addrs` accesses (Udi Jonnalagadda)
* [dv/csr_utils] update unmapped_addr calculation (Udi Jonnalagadda)
* [dv] Update intg alert names (Weicai Yang)
* [dv, flash_ctrl] Fix the intr test (Srikrishna Iyer)
* [prim_fifo_async] Fix a width calculation issue in case of Depth = 1
  (Michael Schaffner)
* [dv] Update VCS opt for uvm_hdl_* (Weicai Yang)
* [dv, util] Make poll_for_stop() opt-in (Srikrishna Iyer)
* [dvsim] Separate publish report option [PART1] (Cindy Chen)
* [dv/kmac/sram] reduce iterations of smoke test (Udi Jonnalagadda)
* [dv/stress_all_with_reset] Revert back IPs that uses apply_reset
  (Cindy Chen)
* [dv/edn_reset] Fix apply_reset to concurrently deassert resets
  (Cindy Chen)
* [dv] Update VCS cov merge opts (Srikrishna Iyer)
* [dv] Add TL integrity error test for CSR (Weicai Yang)
* [dv, chip] Remove USB clk driver (Srikrishna Iyer)
* [script/dvsim] Update output folder (Cindy Chen)
* [dv/edn_reset] Update IPs that overrides apply_reset task (Cindy
  Chen)
* [dv/edn_reset] Fix stress_all_with_rand_reset error (Cindy Chen)
* [dv/dv_base_scoreboard] remove duplicated code (Cindy Chen)
* [otbn,dv] Teach otbn_memutil to track expected end address (Rupert
  Swarbrick)
* [dv, dv_utils_pkg] Fix common int typedefs (Srikrishna Iyer)
* [prim_lfsr] Fix spyglass lint warnings (Michael Schaffner)
* [prim_clock_gating] Target 7series Xilinx devices (Philipp Wagner)
* [dv/edn_rst] Add coverage to collect edn reset and dut reset (Cindy
  Chen)
* [otp_ctrl/lc_ctrl] Add LC TAP register to control OTP test
  mechanisms (Michael Schaffner)
* [prim_alert*/prim_esc*] Rework placement of size_only bufs/flops
  (Michael Schaffner)
* [dv] fix a typo in tl_device_access_types_testplan (Weicai Yang)
* [prim_otp] Rework generic model to match new error behavior (Michael
  Schaffner)
* [dv/tlul_common_test] Add a testplan for TLUL integrity check (Cindy
  Chen)
* [dvsim] Allow recursive testplan import (Srikrishna Iyer)
* [primgen] Use verible-verilog-syntax for parsing (Mariusz Glebocki)
* [prim] Break always_comb block to avoid apparent loop (Rupert
  Swarbrick)
* [dvsim] Fix testplan bugs (Srikrishna Iyer)
* [fpv] update secded_gen (Cindy Chen)
* [dv/template] small fixes on index.md format (Cindy Chen)
* [prim_otp] Add a waiver for power signal unused in generic prim
  (Michael Schaffner)
* [simutil_verilator] Improve timeout handling (Rupert Swarbrick)
* [testplans] Rename entries with testpoints (Srikrishna Iyer)
* [dvsim/testplan] Fix the rendered testplan (Srikrishna Iyer)
* [dv/cov] exclude prim_lfsr and prim_prince (Udi Jonnalagadda)

Signed-off-by: Philipp Wagner <phw@lowrisc.org>
2021-07-20 13:44:11 +01:00
Philipp Wagner
270cd91b38 Fix the verible-format CI job
The toplevel core file got renamed, but the experimental verible-format
CI job wasn't updated in sync. Fix that.
2021-07-15 15:47:57 +01:00
Philipp Wagner
ed46a5c9f5 [ci] Update dependencies to match OpenTitan
Use the same dependencies as we use in OpenTitan to make it easier to
diagnose potential issues. No change in behavior expected.
2021-07-14 11:12:09 +01:00
Tobias Wölfel
7032df0d8b [formal] Read Verilog files in Yosys
All files read at this point should be Verilog and not SystemVerilog.
Do not use the SystemVerilog specifier for reading files.
2021-07-14 11:02:46 +01:00
Tobias Wölfel
e1eaa1c804 [formal] Switch to new top level
Use `ibex_top` instead of `ibex_core`.
2021-07-14 11:02:46 +01:00
Rupert Swarbrick
594c2368c3 Get riscv-formal flow working again
No guarantees that this actually does anything useful, but at least
the Makefile works again.
2021-07-14 11:02:46 +01:00
Leon Woestenberg
7506d4da2a [sw] Fix GNU GCC toolchain component substitution for file path case.
This invocation would break:

make -C examples/sw/led/ CC=/opt/lowrisc-toolchain-gcc-rv32imc-20210412-1/bin/riscv32-unknown-elf-gcc

because the "-gcc" occurence inside the directory name would also be replaced.

Fix by first deriving CROSS_COMPILE from CC, then conditionally build other tool file names/paths.

Signed-off-by: Leon Woestenberg <leon@sidebranch.com>
2021-07-12 12:53:53 +01:00
Dawid Zimonczyk
a0582afb4e Avoid premailer 3.9.0 due to API breakage
From OpenTitan pull request #6769
2021-07-12 10:27:29 +01:00
Rupert Swarbrick
90ff7ca6c3 [dv,core_ibex] Only write sim.log once
We're already redirecting stdout to sim.log in run_rtl.py. Specifying
'-l' as well meant that VCS opened sim.log in a separate FD.
Suprisingly enough, this mostly worked, but not always! Just write
once :-)
2021-06-29 14:55:22 +01:00
Greg Chadwick
8ec65d02f8 [dv] Newline tweaks for regression logging 2021-06-29 14:08:01 +01:00
Greg Chadwick
ef545a8bd8 [dv] Improve results reporting
This commits adds a yaml based intermediate format for test results.
compare.py serialises a TestRunResult (a named tuple type) into this
format for each test run it checks. collect_results.py reads them all
back in to produce reports.

Three reports are output:
- regr.log - plain text report much like the one previously produced
- regr_junit.xml, regr_junit_merged.xml - JUnit report format, the
  _merged version batches together multiple tests to appear to be a
  single test case under a test suite. This gives better results with
  Azure's JUnit reporting.
2021-06-25 18:31:21 +01:00
Tom Roberts
6daae3509a [rtl] Modify fetch_en_i behavior
This signal used to be a one shot enable out of reset. We need an option
to pause execution for OpenTitan, so fetch_enable is extended to cover
that.

The signal is already driven low by the testbench at the end of test.
This is moved after the performance counter reads to ensure they can
complete.

Fixes #1105

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-06-23 09:16:27 +01:00
Tom Roberts
8a4c1b9e6d [dv/uvm/core] Fix a minor reset issue
Fix the reset polarity in the irq driver (clears irq signals to zero
on reset rather than them being x) plus remove an unused signal.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-06-23 09:16:27 +01:00
Tom Roberts
62aa2bcab8 [dv/uvm/core_ibex] Fix timeout issue in wfi tests
The test loops around waiting for the core to sleep then sending
interrupts to wake it. In some cases, the sequence sends an interrupt
that isn't enabled. It never gets back to try again with a new interrupt
since the test is waiting to see wfi first. This change removes that
requirement since it is redundant anyway (have to see wfi to sleep).

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-06-18 17:36:38 +01:00
Rupert Swarbrick
8dd21e491f Append logs for tests to regr.log
Commit 700f29b changed things so that details of the various tests
that ran ended up in separate files. This is nice (and important for
running things in parallel), but isn't massively helpful if you use
regr.log to understand what happened from a CI run!

This patch adds the logs again, splitting them up so that failing
tests come before passing ones (since you usually just care about the
failures).
2021-06-18 15:08:04 +01:00
Tom Roberts
fd4fdc4519 [dv/uvm/core_ibex] Pass ISA from Makefile
This allows run.py to pass ISA options through to Spike. This relates to
the failure in #1369 (test inserts a bitmanip instruction which Spike
interprets as valid but the core treats as invalid depending on config).

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-06-18 11:09:39 +01:00
Tom Roberts
1a46c4ede6 [dv/uvm/core_ibex] Update CSR description file
The CSR tests don't currently support multiple configurations
(see #1333). Since the OpenTitan configuration is the only one currently
being run, update this file to pass with that for now.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-06-18 11:09:39 +01:00
Tom Roberts
a8e17579e2 [rtl] Fix decode values for B Operand mux select
With data-independent timing enabled and BranchTargetALU configured,
branches will stall for a cycle causing an illegal value to be decoded
for the B Operand. No functional impact of this, but an assertion fires
so we might as well tie it off properly.

Fixes #1367

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-06-18 11:09:39 +01:00
Tom Roberts
f3b163af35 [rtl] Add reset to lockstep delayed inputs
In tests with multiple resets, these signals could hold onto spurious
values through reset (since the clock is also gated) which caused
assertion failures on resumption.

Fixes #1368

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-06-18 11:09:39 +01:00
Rupert Swarbrick
2ce6653c65 [core_ibex,dv] Allow running RTL simulations in parallel 2021-06-16 14:37:10 +01:00
Rupert Swarbrick
6a07438cc5 [uvm,core_ibex] Add missing dependency in Makefile
We can't run coverage until the simulation is complete.
2021-06-15 16:48:51 +01:00
Rupert Swarbrick
700f29b7b3 [uvm,core_ibex] Run comparisons in parallel
This patch teaches Make which tests we're actually running (via the
list_tests.py script), which means that we can compare the ISS and RTL
results in parallel rather than serially.

There's a bit of duplicated code (both list_tests.py and sim.py
currently contain the code to get a list of tests and then filter by
Ibex configuration), but this should go away with a later patch that
runs the RTL simulations in parallel in a similar way.

Note: This might seem a little silly: trace comparison takes way less
time than the RTL simulation! The point is that it's probably easier
to work "from the bottom" than to start by parallelising the
simulations themselves.
2021-06-15 16:48:51 +01:00
Rupert Swarbrick
b40f5b8f55 [core_ibex,dv] Name RTL runs by seed, not iteration index
This makes path calculations a bit easier when it comes to loading
stuff up for comparison (allowing us to move more into the Makefile).
Long-term, it might also allow us to change how we track things
entirely, getting rid of the start-seed part of the output directory
structure.
2021-06-15 16:48:51 +01:00
Rupert Swarbrick
d611de9a60 [uvm] Remove --seed argument from sim.py
This isn't used any more: we use --start_seed instead. Remove support
for it, which simplifies the code quite a bit.
2021-06-15 16:48:51 +01:00
Rupert Swarbrick
6c44070bf5 [dv] Fix icache formal tb after recent parameter changes 2021-06-15 15:03:08 +01:00
Dawid Zimonczyk
e716b5add8 Add the Width parameter to prim_buf module
The prim_buf.sv file in Ibex is a manual copy of a file which is
typically auto-generated by FuseSoC/primgen. However, Ibex DV doesn't
yet run FuseSoC, and we provide a pregenerated copy instead. The
auto-generated file and its copy got out of sync. Fix that by adding the
new Width parameter.
2021-06-10 10:00:15 +01:00
Tom Roberts
7071b04a66 [rtl] Fix typo in MCOUNTEREN
DbgTriggerEn has no impact on whether this is an illegal csr op.

Fixes #1379

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-06-09 14:59:33 +01:00
Rupert Swarbrick
7ceff60749 Describe where to find a RISC-V toolchain 2021-06-08 15:41:02 +01:00
Dawid Zimonczyk
047e1d6d22 [core_ibex] Update command to work with newer versions of Riviera
These changes match newer versions of Riviera. They work for all
versions >= 2020.04. Ibex itself only compiles successfully with
version 2021.04, so there's no need to maintain command-line
compatibility with older versions.
2021-06-07 10:50:46 +01:00
Rupert Swarbrick
514c096892 [core_ibex,dv] Don't compile coverage model if COV=0 2021-06-03 10:05:11 +01:00
Tom Roberts
93a76b3900 [config] Add an Opentitan configuration
This adds the configuration instantiated in Opentitan and adds
missing prim support to allow the TB to run that configuration.

Resolves #1362

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2021-05-26 16:23:33 +01:00
Rupert Swarbrick
e0b477069e Update lowrisc_ip to lowRISC/opentitan@7117c349d
Update code from upstream repository
https://github.com/lowRISC/opentitan to revision
7117c349d5465b5152d3bb774079013924a3e9ba

* [dv/common] Improve coverage exclusion method (Cindy Chen)
* [prim] Waive unused parameter warnings for an FPGA-specific param
  (Rupert Swarbrick)
* [dpi] Fix indexing bug in ecc32_mem_area (Rupert Swarbrick)
* [dv, xcelium] Dump covergroup report (Srikrishna Iyer)
* [dvsim] Testplanner refactor & covergroup support (Srikrishna Iyer)
* [otp_ctrl] Workaround for generated prim depending on generated prim
  (Michael Schaffner)
* [dpi_memutil] Fix bug in RegisterMemoryArea (Rupert Swarbrick)
* [rom_ctrl/dv] Add skeleton testbench (Tom Roberts)
* [dvsim/verilator] Remove FUSESOC_IGNORE (Michael Schaffner)
* [checklists] Update all checklists for consistency (Srikrishna Iyer)
* [dv] Add integrity generation to backdoor memory loading (Greg
  Chadwick)
* [prim_secded] Add C reference models for Hsiao encode (Greg
  Chadwick)
* [rtl/prim_async_fifo] Fix async fifo typo when depth <= 2 (Cindy
  Chen)
* [dv/unr] Fix unr clk rst ports (Cindy Chen)
* [pads] - added AnalogIn1 pads for OTP supply (Arnon Sharlin)
* [dv/common] add ECC support to mem_bkdr_if (Udi Jonnalagadda)

Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
2021-05-25 15:14:52 +01:00