Commit graph

136 commits

Author SHA1 Message Date
Greg Chadwick
8b2e191780 [simple-system] Add ICache parameters
Simple system fails to build without these when using parameters from
ibex_config.py

Signed-off-by: Greg Chadwick <gac@lowrisc.org>
2020-11-02 17:04:49 +00:00
Luka Macan
999140ded8 Fix lint issues 2020-10-30 20:38:08 +00: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
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
Greg Chadwick
6123ac7719 [rtl] Introduce static branch prediction 2020-08-27 11:25:17 +01: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
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
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
Pirmin Vogel
ac51db259d Set FPGA_XILINX define whenever Vivado is used
This commit makes sure that whenever Vivado is used, the Verilog
define `FPGA_XILINX` is set. This define can be used to enable Xilinx
specific pragmas in the RTL code. It is currently used to implement
the performance counters with DSP slices (incl. integrated output
registers for counter widths <= 32) which helps to save logic resources
and FFs (-7% and -15% when using e.g. 10 counters).

Previously, we had to set this parameter in every single top-level .core
file using Ibex.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-08-04 12:36:27 +02:00
Yuichi Sugiyama
120fbcb2ae Fix typo in examples/sw/benchmarks/README.md 2020-07-30 16:34:03 +01:00
Tom Roberts
aae437d75b [rtl] Add alert outputs
- Add a major and minor alert output which can be used by the system to
  react to fault injection attacks

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-07-15 09:50:23 +01:00
Tom Roberts
a9642cfb48 [params] Add SecureIbex option to simple system
Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-07-15 09:50:23 +01:00
Greg Chadwick
6b9165fa66 [doc] Update READMEs with best CoreMark results 2020-07-10 13:49:19 +01:00
Greg Chadwick
adafa73ca8 [sw] Enable choice of -march= string for CoreMark 2020-07-10 13:49:19 +01:00
Dawid Zimonczyk
14f85d3ee3 update readme for Riviera-PRO 2020-07-10 10:29:24 +01:00
Philipp Wagner
85d0ce36cb Specify data type for all parameters in simple_system
Fixes a lint warning.
2020-07-07 16:21:48 +01:00
Philipp Wagner
f688c79565 Clarifications to the README of the simple system
* Mention the need to install `libelf-dev`. Thanks to Bert Pieters for
  reporting this.
* Guide users to install our Python dependencies, including fusesoc and
  edalize, from `python-requirements.txt`, to ensure they have the
  right version.
* Prefer ELF files for Verilator simulations. This makes it easier to
  use existing ELF files from another software build system.

Fixes #1019
2020-07-07 15:35:55 +01:00
Pirmin Vogel
414ff7eeb0 [doc] Fix spelling of CoreMark
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-07-06 12:30:02 +02:00
Rupert Swarbrick
d7284c2cbd Handle --help properly in simple_system top-level 2020-07-06 10:31:58 +01:00
Philipp Wagner
f98ddabee1 Use the Xilinx primitives for the Arty board
Use Xilinx-specific implementations for primitives, such as RAM and the
clock gate (which will now be implemented using a BUFGCE macro, and no
longer with a latch).

Verified in Vivado synthesis to pick up the Xilinx primitive now.
2020-07-06 10:20:39 +01:00
Philipp Wagner
0335b69e26 Clean up Verilator sections in core files
- The "PINCONNECTEMPTY" waiver is part of our normal waiver file, no need
  to add it to the tool invocation.
- Recent versions of Verilator choose good defaults for MAKE_OPTS,
  passing it explicitly overrides the settings.
- All Verilator code is now lint clean, we can remove `-Wno-fatal`.
- FST traces are not much slower then VCD traces any more in recent
  Verilator versions, remove the respective comment.
- Align comment about the compile/sim time for tracing with other files
  and OpenTitan.
2020-07-03 17:54:41 +01:00
Philipp Wagner
a10df87daa ibex_simple_system: Add lint target 2020-07-03 16:18:31 +01:00
Rupert Swarbrick
006617f95a Fix SRAM initialisation for fpga/artya example
This now gets passed to the underlying primitive as a
parameter (instead of a define).
2020-07-03 16:06:48 +01:00
Rupert Swarbrick
a8cc0a9ef6 Get simple_system working for VCS
This should probably work for Riviera-PRO too, but that hasn't been
tested.
2020-07-03 15:42:39 +01:00
ganoam
1aa4d5a32b [bitmanip] Optimizations and Parametrization
This commit contains some final optimizations regarding the bit
manipulation extension as well as the parametrization into a balanced
version and a full performance version.

Balanced Version:
        * Supports ZBB, ZBS, ZBF and ZBT extensions
        * Dual cycle instructions:
          ror[i], rol, cmov, cmix fsl, fsr[i]
        * Everything else completes in a single cycle.

Full Version:
        * Supports all 32b sub extensions.
        * Dual cycle instructions:
          ror[i], rol, cmov, cmix fsl, fsr[i], crc32[c], bext, bdep
        * Everything else completes in a single cycle.

Notable Changes:
        * bext/bdep are now multi-cycle: Sharing additional register
          with multiplier module
        * grev/gorc instructions are implemented in separate structures
          rather than sharing the shifter or butterfly network.
        * Speed up decision on using rs1 or rs3 for alu_operand_a by
          introducing single-bit register, to identify ternary
          instructions in their first cycle.
        * Introduce enumerated parameter to chose bit manipulation
          implementation

Signed-off-by: ganoam <gnoam@live.com>
2020-06-26 14:43:24 +02:00
Rupert Swarbrick
33ad42debb Spelling fix: seperate -> separate 2020-06-05 11:37:37 +01:00
Greg Chadwick
023d86d912 [sw] Fix typo in simple system exception handler
Signed-off-by: Greg Chadwick <gac@lowrisc.org>
2020-06-02 13:45:46 +01:00
Philipp Wagner
8b42024cd5 Use vendored-in primitives from OpenTitan
Instead of using copies of primitives from OpenTitan, vendor the files
in directly from OpenTitan, and use them.

Benefits:

- Less potential for diverging code between OpenTitan and Ibex, causing
  problems when importing Ibex into OT.

- Use of the abstract primitives instead of the generic ones. The
  abstract primitives are replaced during synthesis time with
  target-dependent implementations. For simulation, nothing changes. For
  synthesis for a given target technology (e.g. a specific ASIC or FPGA
  technology), the primitives system can be instructed to choose
  optimized versions (if available).

  This is most relevant for the icache, which hard-coded the generic
  SRAM primitive before. This primitive is always implemented as
  registers. By using the abstract primitive (prim_ram_1p) instead, the
  RAMs can be replaced with memory-compiler-generated ones if necessary.

There are no real draw-backs, but a couple points to be aware of:

- Our ram_1p and ram_2p implementations are kept as wrapper around the
  primitives, since their interface deviates slightly from the one in
  prim_ram*. This also includes a rather unfortunate naming confusion
  around rvalid, which means "read data valid" in the OpenTitan advanced
  RAM primitives (prim_ram_1p_adv for example), but means "ack" in
  PULP-derived IP and in our bus implementation.

- The core_ibex UVM DV doesn't use FuseSoC to generate its file list,
  but uses a hard-coded list in `ibex_files.f` instead. Since the
  dynamic primitives system requires the use of FuseSoC we need to
  provide a stop-gap until this file is removed. Issue #893 tracks
  progress on that.

- Dynamic primitives depend no a not-yet-merged feature of FuseSoC
  (https://github.com/olofk/fusesoc/pull/391). We depend on the same
  functionality in OpenTitan and have instructed users to use a patched
  branch of FuseSoC for a long time through `python-requirements.txt`,
  so no action is needed for users which are either successfully
  interacting with the OpenTitan source code, or have followed our
  instructions. All other users will see a reasonably descriptive error
  message during a FuseSoC run.

- This commit is massive, but there are no good ways to split it into
  bisectable, yet small, chunks. I'm sorry. Reviewers can safely ignore
  all code in `vendor/lowrisc_ip`, it's an import from OpenTitan.

- The check_tool_requirements tooling isn't easily vendor-able from
  OpenTitan at the moment. I've filed
  https://github.com/lowRISC/opentitan/issues/2309 to get that sorted.

- The LFSR primitive doesn't have a own core file, forcing us to include
  the catch-all `lowrisc:prim:all` core. I've filed
  https://github.com/lowRISC/opentitan/issues/2310 to get that sorted.
2020-05-27 10:23:15 +01:00
Stefan Wallentowitz
8b8327d820 [dv] Change performance counter access to DPI
DPI access is suggested and more generic than Verilator direct signal
access. This changes the access to the performance counters from the
Verilator testbench to use DPI instead of directly accessing the
array.

Signed-off-by: Stefan Wallentowitz <stefan.wallentowitz@hm.edu>
2020-05-21 20:34:26 +01:00
Stefan Wallentowitz
b2dded5c27 Change simple system core file to provide default files
To allow other modules to reference the simple system, it must provide
default files. In particular this is useful in DV settings where bind
is used.

Signed-off-by: Stefan Wallentowitz <stefan.wallentowitz@hm.edu>
2020-05-21 20:17:30 +01:00
Tom Roberts
5fd3cad9a1 [config] Change default PMPNumRegions
Change default to 4 rather than 0. Makes no difference when PMPEnable==0
and gets rid of lint failures due to 0 array referencing (0 is an
unsupported value for this parameter).

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2020-05-15 11:12:31 +01:00
Greg Chadwick
00b46d9abe [cfg] Add PMP parameters to ibex_config.yaml
Also renames configs as part of this as they start to get unweildy if
all features get described in the config name.
2020-05-15 09:03:04 +01:00
Rupert Swarbrick
4f349a094e Specify "-xlrm uniq_prior_final" for VCS
As discussed in issue #845, this tells VCS to wait for signals to
settle in combinatorial blocks before checking uniqueness in
constructs like unique case.

Otherwise things like this can cause spurious warnings:

  always_comb b = ~in;

  always_comb c = in;

  always_comb begin
    unique case (1'b1)
      b: x = 1;
      c: x = 0;
      default: x = 0;  // not that it matters, but this won't happen
    endcase
  end

For example, on a falling edge of the in signal, if the processes are
executed in the order 1, 3, 2 then the unique case block will appear
to see both b and c true at the same time.
2020-05-07 10:22:01 +01:00
Tobias Wölfel
0c2e79a38f Add RV32B parameter option 2020-04-24 14:58:12 +02:00
Rupert Swarbrick
ba9b137488 Switch from 'bool' to 'int' parameters in fusesoc core files
Fusesoc has an unfortunate bug[1] where a boolean parameter which has
default true can't be disabled. For now, just make all our boolean
parameters back into integers again. In the future, when that's fixed,
maybe we should switch things back.

[1] https://github.com/olofk/fusesoc/issues/392
2020-04-14 15:30:26 +01:00
Greg Chadwick
04ceda5267 [rtl] Add RV32B to various core files & top-levels 2020-03-31 16:49:08 +01: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
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
Greg Chadwick
3927fd8d2a [rtl/sw] Add multiply and divide wait counters 2020-03-13 14:48:29 +00:00
Greg Chadwick
6fc4110acf [sw] Add Coremark makefile and support files
Signed-off-by: Greg Chadwick <gac@lowrisc.org>
2020-03-09 14:41:40 +00:00
Greg Chadwick
d20e65e0f2 [sw/simple_system] Add PCOUNT_READ macro 2020-03-09 14:41:40 +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
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
cb9413e38b Add a wrapper script to run a simple_system binary under Spike
The main point of this is that it's somewhere we can store what it
calls "ss_opts": the options that we must pass to Spike to tell it the
memory layout of the simple_system environment.

While we're at it, I've tried to make this reasonably pleasant to use.
So you can do

   spike-simple-system.sh <elf-file>

just to run the thing. To pass stuff to Spike without the
bash script getting in the way, use '--':

   spike-simple-system.sh -- my option -h --here <elf-file>
2020-03-03 17:09:08 +00:00
Rupert Swarbrick
210634586d Fix last verilator warning for ibex_simple_system; add waiver
If you just build simple_system a fusesoc line like

  fusesoc --cores-root=. run --target=sim --setup \
          --build lowrisc:ibex:ibex_simple_system

then the change to ibex_simple_system.sv suffices, but if you
explicitly set a parameter in fusesoc like this:

  fusesoc --cores-root=. run --target=sim --setup \
          --build lowrisc:ibex:ibex_simple_system \
		  --RV32M=1

then it overrides the default parameter with a literal 1. We declare
the parameter as an 'int', so I guess that's quite a reasonable
behaviour from fusesoc. Anyway, this check only triggers when a 1-bit
parameter is set with a literal 1, so should be safe. (If you do
something buggy like setting it to 2, it will still moan at you). This
patch adds a waiver file in examples/simple_system that silences the
warning.

This patch also makes the equivalent change to riscv_compliance,
adding a waiver file in dv/riscv_compliance/lint and fixing up the
default parameters.
2020-03-03 11:35:07 +00:00
Rupert Swarbrick
91d7721fa9 Make exiting from simple_system tests work with Spike 2020-03-02 15:45:47 +00:00
Rupert Swarbrick
59b3f7f476 Set the ELF entry point in simple system linker script
This is part of work to run binaries created for the simple system
under Spike. Spike's default behaviour (after a weird 'rom' trampoline
at 0x1000) is to obey the entry point given in the ELF file. So let's
set it correctly.
2020-02-28 10:02:56 +00:00