Commit graph

1878 commits

Author SHA1 Message Date
Udi Jonnalagadda
5d4c9aebe2 [ibex/dv] return non-zero exit code upon failure
Currently the Ibex run scripts return 0 no matter what the test result
is.
To get Ibex sims correctly integrated into CI, the Makefile needs to
return 1 upon seeing a log comparison failure to indicate an error.

Signed-off-by: Udi Jonnalagadda <udij@google.com>
2020-10-23 13:43:45 -07:00
Philipp Wagner
931b291749 [doc] Mark icache verification as "done for now"
The icache verification is complete until new bugs are found, let's mark
it as such in the docs.
2020-10-23 11:51:33 +01:00
Tobias Wölfel
4431023516 Add support for additional HW breakpoints
Add parameter `DbgHwBreakNum` to configure the number of HW breakpoints.
The parameters controls the number of trigger registers available if
debug support is enabled with `DbgTriggerEn`.

Closes #1070
2020-10-19 13:20:08 +02:00
Tom Roberts
dbd92c5d4b [rtl] Fix illegal write to DCSR cause field
- This field is read-only to software, and so should retain its previous
  value on a write. This fixes #1134.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-10-14 17:35:00 +01:00
Tom Roberts
1a9545baaf [rtl] Add CSR module and instantiate
- This change should have no functional impact on the design
- Adding the separate module will allow easy parameterization
  of security hardening for individual CSRs in the future
- As a side benefit, clock gating is added for CSRs that didn't
  previously have it
- Note that this change makes the cpuctrl register always present,
  rather than individual bits being added depending on parameterized
  features. This is not ideal, but the parameterization becomes rather
  messy otherwise.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-10-14 15:53:33 +01:00
Tom Roberts
8953d82ca4 [rtl] Various security feature bugfixes
- Document that SecureIbex cannot be used without a multiplier and add
  an assertion in the rtl. This fixes #1080.
- Move the PC checking hardware onto its own parameter to match all the
  other individual security features.
- Make the PC increment behavior more sensible on fetch errors (and make
  it match the icache behavior). Factor this into the PC increment check
  to prevent false triggering, fixes #1094.
- Stop the PC mismatch checker firing on dummy instructions, fixes
  #1095.

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-10-14 15:46:10 +01:00
Tom Roberts
adc574b8b0 [rtl] Fix missing else branch in decoder
- Without the B extension, a gorci instruction should decode as an
  illegal instruction.
- Relates to #1129

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-10-14 09:49:30 +01:00
Tobias Wölfel
bcbf1a7adf [rtl] Add plusarg to disable trace log
Option to control the state of the Ibex tracer.
Defaults to enable, but allows a setting to disable the trace log.

In long running simulations this file can get quite big and the contents
might not be needed. Use the argument `+ibex_tracer_enable=0` to prevent
the creation of the file.
2020-10-13 15:23:22 +02:00
Philipp Wagner
0106ba80a0 [ci] Update install-build-deps.sh script for Ubuntu 18.04 2020-10-09 16:46:08 +02:00
Alex Bradbury
abff9a886a [doc] Fix broken link to examples description
The documentation restructure in #1119 resulted in a new URL for the
documentation on Ibex system examples. This commit updates the in-tree
link to reference that new URL.

Signed-off-by: Alex Bradbury <asb@lowrisc.org>
2020-10-02 15:03:19 +01:00
Tobias Wölfel
cb2ef15442 [doc] Fix image link 2020-09-29 09:27:19 +01:00
Philipp Wagner
830b7f7206 Restructure documentation
Restructure the existing documentation to group the content by intended
audience. This produces four sections:

* An introduction section, relevant to "newcomers" to Ibex.
* An user guide, intended for hardware designers (integrators) and
  software developers who want to integrate Ibex, and develop software
  for it.
* A reference guide, which provides background information on the
  design. This section is essential when working on Ibex, and also
  documents our design decisions.
* A developer guide aimed at people modifying Ibex itself. It consists
  mostly of process and tool documentation: how to run the verification
  after a code change, how to use GitHub, etc.

This commit is large, but text is mostly unchanged. A couple of
introductions and tables of content were added, but no significant
changes to the text have been made. These will be done in follow-ups.

Signed-off-by: Philipp Wagner <phw@lowrisc.org>
2020-09-28 22:30:00 +01:00
Tom Roberts
2cb1efb953 [simple-system] Add missing linker sections
Adding the "small" sections to the example linker script. This ensures
that all sections of memory needing to be zeroed are captured.

Fixes #1092

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-09-23 14:28:31 +01:00
Sam Elliott
f9f0cb1133 [simple_system] Update CSR Access for LLVM and GCC
At some point in the future, the version of binutils we're using, and
the released version of LLVM, will coincide to use the correct name. In
the meantime, this change just uses the number which is supported by
both compilers.

This is, as I understand it, the only stumbling block to compiling the
in-repo C benchmark code with both GCC and LLVM. Being able to do so
would make it much easier for us to do comparisons on the benchmarks for
both compilers.

Signed-off-by: Sam Elliott <selliott@lowrisc.org>
2020-09-22 16:57:14 +01:00
Rupert Swarbrick
7bbd806a60 In util, restrict mypy linting to sv2v_in_place.py
The other scripts in the directory don't have typing annotations.
2020-09-17 15:51:40 +01:00
Tobias Wölfel
1553636a7d [formal] Add check for multdiv cycle consumption
Check that the number of cycles are always as specified for the current
configuration for data independent operations.

The required input signals for each arithmetic operation are split into
different files which are included into the testbench.
For each combination of operation and configured configuration
(slow/fast/single) a define stores the number of cycles in a separate
file. A target exists for each combination.
For a convenient execution the targets are grouped together in a
makefile.

The implementation is based on the formal/icache checks.

For the selection of the single cycle multiplication with the fast
multiplication the parameter is set directly to the enum integer value.
2020-09-16 16:30:20 +01:00
Tobias Wölfel
c8d4f2d950 Move sv2v script into standalone core file
FuseSoC script to run sv2v can be reused with this change.
2020-09-16 16:30:20 +01:00
Tom Roberts
8edcb088da [syn] Add script to print kGE equivalent
Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-09-15 08:45:30 +01:00
Tom Roberts
2c22c1ee01 [rtl] Fix debug step over EBREAK issue
- If there is a request to enter debug mode (either due to a halt
  request or single stepping mode) on the same cycle as an EBREAK
  instruction, continue with the EBREAK and capture the ID PC rather
  than the IF PC.
- relates to #1106

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-09-14 14:19:35 +01:00
Rupert Swarbrick
c31d066130 Fix "no invalidate" logic in ICache sequence
Some sequences run in "no invalidate" mode. Unfortunately, sometimes
we *have* to invalidate, either because we have a stale seed, or
because we're at the start of a sequence.

It turns out that "no invalidate" is a soft requirement, so we can
weaken it here. This patch also renames the flag to
"avoid_invalidation" to make it clear that this is allowed to be
violated occasionally.

Closes #1101.
2020-09-07 13:54:15 +01:00
Rupert Swarbrick
fb5d87b2bf Port ICache formal core file to final Edalize design
The PR that I pushed up to add sby support to
Edalize (https://github.com/olofk/edalize/pull/173) ended up with a
different input format from the one it started with.

That's now merged into master, so this patch updates the Ibex code to
match the final syntax.
2020-08-31 15:40:44 +01:00
Rupert Swarbrick
3703a3ad8e [ci] Force setuptools not to use version 50.0.0 for now
There's a long and painful discussion on the setuptools issues
list (I count 9 issues raised the day after the release). This is all
to do with how Debian/Ubuntu installs stuff with pip.

There's an "official" workaround that involves setting things in your
environment, but that looks a bit fiddly with the Azure pipelines
stuff and this has been such a disaster that I'm pretty certain the
setuptools maintainers will release something more sensible soon.

See e.g.
https://github.com/pypa/setuptools/issues/2350#issuecomment-683512526
for a careful description of what's going on.
2020-08-31 15:15:18 +01:00
Tom Roberts
f30e84ba00 [rtl] Remove outdated assertion
- The core does not rely on instr_err_i being always valid, and most bus
  protocols don't support that

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-08-27 11:40:28 +01:00
Greg Chadwick
2f1b95d214 [doc] Document branch prediction configuration 2020-08-27 11:25:17 +01:00
Greg Chadwick
6123ac7719 [rtl] Introduce static branch prediction 2020-08-27 11:25:17 +01:00
Udi
b1531f2e38 [ibex/rtl] Remove duplicate check for irq_fast[5]
Currently in ibex_controller.sv when generating the ID of any fast
interrupts, irq_fast[5] is checked for twice.
This is a redundant line, and so this PR simply removes it.

Signed-off-by: Udi <udij@google.com>
2020-08-21 13:03:24 -07:00
Pirmin Vogel
9eebf52590 Fix RegFile parameter overriding in ArtyA7 example
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-08-21 14:06:36 +01:00
Philipp Wagner
62109d4044 List all Python requirements for dvsim
dvsim needs two more Python packages to run, which are not yet listed in
the python-requirements.txt file.
2020-08-21 14:06:01 +01:00
Pirmin Vogel
9559bbb6ff Add RegFile parameter for selecting register file implementation
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-08-21 14:20:34 +02:00
Tom Roberts
23e21c9494 [rtl] Fix FENCE comment in decoder
- Clarify FENCE treatment rationale
- Update comment around ICache flushing
- Fixes #1048

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-08-21 11:09:12 +01:00
Philipp Wagner
e145a49b32 Add private CI trigger
The ci/azp-private.yml file is a skeleton and only used to trigger an
Azure Pipelines run which integrates into the ibex repository. All real
job description is in a private repository for licensing reasons.
2020-08-21 09:59:32 +01:00
Philipp Wagner
d534af7c84 CI: Factor out installation of build dependencies
Put all build dependencies into a CI-specific script
(ci/install-build-deps.sh). No effort has been made to make this script
suitable for non-CI users.
2020-08-21 09:59:32 +01:00
Philipp Wagner
c4a0c9d3bf CI: Script to convert CI variables
Add a script to convert the contents of ci/vars.yml to Azure Pipelines
logging commands, which effectively set runtime variables in a pipeline.

We need this script as a workaround for a missing Azure Pipelines
feature: variables are not inherited in extended templates, and reading
the vars.yml file in a "extends" template isn't possible either (at
least not if we want to use the exact revision of the ibex repository
which triggered CI).
2020-08-21 09:59:32 +01:00
Philipp Wagner
190518dacc Add lowRISC-specific version of Spike to CI config
We use a lowRISC-internal build of Spike following the instructions at
https://ibex-core.readthedocs.io/en/latest/verification.html in private
CI. Add the version number to the CI variables file.
2020-08-21 09:59:32 +01:00
Philipp Wagner
6fca2c4aac Factor out CI variables into separate file
This helps to re-use these variables in different pipelines.
2020-08-21 09:59:32 +01:00
Philipp Wagner
ab1e6d4dc6 Fix PRJ_DIR in DV Makefile
PRJ_DIR is presumably meant to point to the root of the git repository;
instead, it was pointing one directory higher up in the hierarchy. This
worked as long as the repository was checked out into a directory called
"ibex" -- but not otherwise, as in CI.
2020-08-20 19:13:22 +01:00
Philipp Wagner
f53ee9b09f Update google_riscv-dv to google/riscv-dv@2e52518
Update code from upstream repository https://github.com/google/riscv-
dv to revision 2e5251846efb5fa42882a2b6b571ef8693e8cd60

* Remove f strings for Python 3.5-compatibility (Philipp Wagner)
* Fix start-end pair mismatch in asm file (aneels3)
* Fix AMO instruction constraint issue (google/riscv-dv#682) (taoliug)
* - Adds support for the coverage report visualization (pyucis-viewer)
  - Adds CSR, opcode, rv32i_misc, and mepc_alignment covergroups
  (Hodjat Asghari Esfeden)
* fix Todo of directed_lib (aneels3)
* Added avail_regs_c constraint (ShraddhaDevaiya)
* Fix factory method implementation (aneels3)
* Add directed instr (aneels3)
* fix label issue (aneels3)
* fix randomization issue (aneels3)
* Fix typo (aneels3)
* add riscv_pseudo_instr (aneels3)
* add value_plusargs functionality (pvipsyash)
* add riscv_utils and fix minor issues (aneels3)
* modify for directed scenario (pvipsyash)
* Fix a minor issue with the instruction PC (Hodjat Asghari Esfeden)

Signed-off-by: Philipp Wagner <phw@lowrisc.org>
2020-08-20 18:09:11 +01:00
Pirmin Vogel
4c3f1e8a3b Doc support for overriding enum/string parameters at the top level
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-08-20 11:50:08 +02:00
Pirmin Vogel
2ef5e5e3f2 Add a single RV32M enum parameter to select multiplier implementation
This commit replaces the previous combination of `RV32M` bit parameter
used to en/disable the M extension and the `MultiplierImplementation`
used to select the multiplier implementation by a single enum parameter.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-08-20 11:50:08 +02:00
Pirmin Vogel
4127a5464b B extension: Correct doc and parameter usage
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-08-20 11:50:08 +02:00
Philipp Wagner
8364e356c2 Use a RV32IMCB toolchain in CI
This update also switches from GCC 9.2 to GCC 10 experimental, see
20200626-1
for more information about the toolchain builds.
2020-08-20 09:23:46 +01:00
Udi
9c09967196 [ibex/dv] Add dependency on bus_params_pkg
This patch updates the Ibex environment's dependency on the old top_pkg
to now depend on bus_params_pkg.

Signed-off-by: Udi <udij@google.com>
2020-08-17 12:05:31 -07:00
Udi
16ed993486 Update google_riscv-dv to google/riscv-dv@17d7984
Vendor in some updates to PMP test generation.

Update code from upstream repository https://github.com/google/riscv-
dv to revision 17d79847e376a591cb3dcaae7601c98b0e70e8ac

* Update pygen/pygen_src/isa/riscv_cov_instr.py (Hodjat Asghari
  Esfeden)
* Minor issues fixed in the functional coverage flow (Hodjat Asghari
  Esfeden)
* fix pmp offset constraint (Udi Jonnalagadda)
* Fix minor issues (aneels3)
* - Adds riscv_instr_cover_group file with a few covergroups -
  Confirms riscv_instr_cov_test script is up and running fine -
  Initializes the registers to 0 during their first gpr_state access
  (for ovpsim output log) (Hodjat Asghari Esfeden)
* update directed pmp sequence constraint (Udi Jonnalagadda)
* remove unreachable if...else statement (Udi Jonnalagadda)
* update post_process() (aneels3)
* add ecall_handler (aneels3)
* Fix post_process() issue (aneels3)
* Fix typo in post_process (aneels3)
* Completed riscv_cov_instr class (decoupled from riscv_instr_cov_test
  file) Added private _riscv_cov_instr module to manually retrieve
  format/category/group/imm_t based on the name of the instruction
  (Hodjat Asghari Esfeden)
* add post_process() (aneels3)

Signed-off-by: Udi <udij@google.com>
2020-08-17 11:53:34 -07:00
Rupert Swarbrick
d71aaeee06 Update lowrisc_ip to lowRISC/opentitan@92e92424
The shortlog from the vendor tool's automated patch is reproduced at
the bottom of this commit message.

The automated commit is squashed with one to update how we depend on
bus parameters. Before, we had to provide an "Ibex top package". This
behaved the same as OpenTitan's "lowrisc:constants:top_pkg", but
avoided having to vendor in that file.

On the OpenTitan side, this has been tidied up with commit
d266c68 ("[dv] Update dv_utils sources to use bus_params_pkg"). This
changes the dependency of dv_utils to
"lowrisc:opentitan:bus_params_pkg". We still have to provide our
own (now called "lowrisc:ibex:bus_params_pkg") and need to patch the
dv_utils dependency, but this is a bit cleaner because dv_utils is
less likely to accidentally include dependencies on OpenTitan
internals.

On our side, we have to update the vendoring patch for dv_utils (and
change its name). We also need an equivalent patch for dv_lib. Then we
rename our hacky "Ibex top package" to "bus_params_pkg". The ICache DV
environment also needs patching to use the bus parameters properly.
Phew!

* [dv] Update prim_present cov opt (Srikrishna Iyer)
* [dv] Align VCS and Xcelium cov var names (Srikrishna Iyer)
* [dv] Split coverage for functional and auto tests (Srikrishna Iyer)
* [dvsim] Do builds smartly (Srikrishna Iyer)
* [syn] Carry over synthesis flow updates from bronze (Michael
  Schaffner)
* [dvsim] Lint cleanup (Srikrishna Iyer)
* [dvsim] Allow testplan to be omitted (Srikrishna Iyer)
* [dvsim] Address lowRISC/opentitan#3071 comments (Srikrishna Iyer)
* [dvsim] lint cleanup (Srikrishna Iyer)
* [dvsim] Add support for second-level indirection (Srikrishna Iyer)
* [dvsim] Change cores-root to avoid conflicts with autogen'd core
  files (Michael Schaffner)
* [dvsim] Update `tests` key behavior in regressions (Srikrishna Iyer)
* [lint] Minor update of ERROR patterns in parser script (Michael
  Schaffner)
* [packer] Revise the implementation (Eunchan Kim)
* [flow] Remove lint makefile (Timothy Chen)
* [flows] Various updates to tools and documents to suppose top/ip
  select (Timothy Chen)
* [dv/shadow_reg] shadow_reg update error (Cindy Chen)
* [rtl/alert] change the naming from _en_i to _req_i (Cindy Chen)
* [dvsim] Tidy up config file loading in FlowCfg.py (Rupert Swarbrick)
* [dvsim] Make it simpler to derive from FlowCfg (Rupert Swarbrick)
* [lint] Update warning/error exclusions in parser scripts (Michael
  Schaffner)
* [dvsim] Fix for `--tool` override (Srikrishna Iyer)
* [dvsim] Bug fix in LintCfg.py (Srikrishna Iyer)
* [prim/dv] Integrate LFSR TB with dvsim (Udi Jonnalagadda)
* [uvmdvgen] Update template to reflect bind reorg (Srikrishna Iyer)
* [dv] remove prim_lfsr_bind (Srikrishna Iyer)
* [dv] Cleanup lint warnings in csr_utils_pkg (Srikrishna Iyer)
* [dv] Cleanup lint warnings in clk_rst_if (Srikrishna Iyer)
* [dvsim] Fix coverage dashboard link (Srikrishna Iyer)
* [prim] Rename prim_util_memload.sv to svh (Philipp Wagner)
* [lint/doc] Update linting readme to reflect recent updates (Michael
  Schaffner)
* [lint] Remove legacy Makefile flow for linting tools (Michael
  Schaffner)
* [dvsim/lint] Enable Verilator lint in Dvsim (Michael Schaffner)
* [prim_arbiter_fixed/fpv] Add generated FPV testbench (Michael
  Schaffner)
* [prim_arbiter_fixed] This adds a fixed priority arbiter (Michael
  Schaffner)
* [prim] Domain-Oriented Masking AND logic (Eunchan Kim)
* [dv] Update dv_utils sources to use bus_params_pkg (Srikrishna Iyer)
* [dv] Update mem_model to use bus-params_pkg (Srikrishna Iyer)
* [dv]  Update dv_lib sources to use bus_params_pkg (Srikrishna Iyer)
* [uvmdvgen] Support for setting vendor name in VLNV (Srikrishna Iyer)
2020-08-17 09:18:06 +01:00
Udi
4c813a0422 [ibex/dv] Update OVPsim to use 34-bit address range
Signed-off-by: Udi <udij@google.com>
2020-08-11 08:17:26 -07:00
Greg Chadwick
21ad662418 [rtl] remove lsu_req_in_id signal
This signal aimed to ensure loads/stores completed succesfully when an
interrupt or debug request appeared at the same time they were being
executed when the writeback stage is present. However other stall logic
suffices for this purpose (debug/interrupt will wait for instruction to
unstall in ID/EX which only happens once request has been sent out, then
first instruction of debug/interrupt handler will stall until load/store
response has been seen based on the generic stall logic for lsu requests
in the writeback stage).

With this signal in place debug single stepping was broken around loads
and stores.

Fixes #1029
2020-08-11 14:12:07 +01:00
Greg Chadwick
6df64c6f70 [doc] Fix table rendering in README 2020-08-11 14:00:46 +01:00
Udi
3706f5364c [ibex/ml] Update the ML testlist
Signed-off-by: Udi <udij@google.com>
2020-08-10 13:02:11 -07:00
Udi
5f899ecb19 [ibex] Update CSR description of cpuctrl/secureseed
Signed-off-by: Udi <udij@google.com>
2020-08-10 09:13:25 -07:00
Tom Roberts
35abca14ab [syn] Use latch-based register file in yosys
- Add a technology map for latches (only works with nandgate45 library
  at the moment)
- Add a real latch-based clock gating cell
- Update timing path reporting to differentiate between register and
  latch paths
- Update summary results in README to reflect the latch-based numbers,
  plus add numbers for a micro-riscy-style (RV32EC) config

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-08-10 13:36:32 +01:00