Commit graph

243 commits

Author SHA1 Message Date
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
38d6932a6a Improve docs for getting started in verification.rst
The important change is that we now tell the user to configure spike
with --enable-misaligned. This is needed because Ibex handles
misaligned loads and stores rather than jumping to a trap handler (the
default behaviour in spike).

There's also a little more information about where you can find the
various tools and how to set them up.

Note that the existing deep links to riscv-dv's documentation
bit-rotted at the start of February.
2020-02-28 09:47:38 +00:00
Tobias Wölfel
77c93f1e54 [doc] Fix reference link 2020-02-20 15:50:53 +00:00
Philipp Wagner
dfd7f9e437 Doc: Fix broken table in integration docs 2020-02-12 15:57:40 +00:00
Philipp Wagner
b1af9174dc Doc: Documented supported tool versions
Add a section on supported tools to the Ibex documentation. Populate it
with my knowledge about tools we've tried. That's a starting point: we
need to add more version numbers and other information as we collect
more data points.

The Verilator version is taken from the new tool_requirements.py file
and inserted into Sphinx.
2020-02-12 15:57:40 +00:00
Philipp Wagner
db62f5b0c2 Doc: Cleanup Sphinx config file
- Add a license header
- Explicitly specify language
- Remove unused HTML help section
- Reorganize some commands around the version number generation
2020-02-12 15:57:40 +00:00
ganoam
48c4b6a5ea [rtl] Add Single Cycle Multiplier targeting FPGA
* Integrate option to implement a multiplier using 3 parallel 17 bit
        multipliers in order to compute MUL instructions in 1 cycle
        MULH in 2 cycles.

* Add parameter SingleCycleMultiply to select single cycle
        multiplication.

The single cycle multiplication capability is intended for FPGA
targets. Using three parallel multiplication units improves performance
of multiplication operations at the cost of DSP primitives. For ASIC
targets, the area consumed by the multiplication structure will grow
approximately 3-4x.

The functionality is selected within the module using the parameter
`SingleCycleMultiply`. From the top level it can be chosen by setting
the parameter `MultiplierImplementation` to 'single_cc'.

Signed-off-by: ganoam <gnoam@live.com>
2020-02-11 16:09:41 +01:00
Stefan Mach
ba2240f138 Reduce latency of slow multiplier
- The slow multiplier is modified to terminate iterations early instead
  of always going the full 32 iterations for `MUL` instructions.
- Multiplications now terminate early after clog2(`op_b`) iterations.
- The slow multiplier can be further optimized by swapping the smaller
  operand into `op_b` when in the `MD_IDLE` state.
2020-02-10 18:28:14 +01:00
Pirmin Vogel
b22fca7bbe Ignore all interrupts in NMI mode, clarify interrupt documentation
This is related to lowRISC/ibex#557, lowRISC/ibex#469 and
lowRISC/ibex#434.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2020-01-31 13:09:09 +01:00
Greg Chadwick
3fcede8a13 [rtl] Comment and naming tweaks 2020-01-31 09:32:20 +00:00
Greg Chadwick
639964514c [RTL] Added seperate ALU for branch target
On branches now compute target same cycle as the condition.  This
removes a stall cycle from all taken conditional branches.
2020-01-31 09:32:20 +00:00
ganoam
7969cb722b [rtl] Add FPGA Register File
This commit adds a register file designed to be synthesized into FPGA
synchronous-write / asynchronous-read design elements.

For the artya7-100 example, the register file is implemented by 12
RAM32M primitives, conserving approximately 600 Logic LUTs and 1000
flip-flops at the expense of 48 LUTRAMs.

Signed-off-by: ganoam <gnoam@live.com>
2020-01-14 16:21:58 +01:00
Greg Chadwick
9c6ddae626 [rtl] Don't elaborate unused mhpmcounter flops
Refactors performance counters so only flops that are required from the
given parameters are explicitly elaborated without relying on
optimization to remove unused flops.

Fixes #473
2020-01-07 10:23:12 +00:00
Tom Roberts
b2bbe50704 [doc] Add a comment on mhpmcounter optimization
- fixes #473

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2019-12-11 15:02:29 +00:00
Tom Roberts
088cd11593 [dbg] Add minimal hardware breakpoint support
- Add the minimum amount of trigger system to support GDB hbreak
- Only a single trigger is implemented
- Only instruction address matching
- Only break into debug mode (no native debug)
- Fixes #382

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2019-12-11 15:02:06 +00:00
Greg Chadwick
11749c7e4d [rtl] Implement FENCE.I
Fixes #391
2019-11-27 08:47:26 +00:00
Pirmin Vogel
99a12ff6d5 [doc] Update mhartid CSR description
This commit removes outdated bit-field descriptions for `mhartid` CSR.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-11-19 15:15:42 +01:00
Pirmin Vogel
46608d9f76 [doc] Document debug CSRs
This resolves lowRISC/ibex#307.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-11-19 15:15:42 +01:00
udinator
2ee9828a78
[Doc] Update verification documentation (#449) 2019-11-12 10:06:41 -08:00
Marek Pikuła
294849bb18 [RTL] Add MultiplierImplementation parameter in top level 2019-10-24 14:33:24 +01:00
udinator
c808fed7d1
[DV] testplan documentation (#409) 2019-10-21 11:45:40 -07:00
Greg Chadwick
6b1a7add5d [Doc] Added extra setup info for Verification 2019-10-17 10:31:18 +01:00
Philipp Wagner
59fdbb517f Licensing documentation: Add commercial support info
lowRISC provides commercial support for Ibex, mention that in the
licensing page if people are looking for such an offering.

Can be extended in the future as we know of more companies offering
support.
2019-10-16 15:08:45 +01:00
Philipp Wagner
2cc282aeee Improve copyright/licensing page
Rename the page to "Licensing", and improve its contents to be more
helpful to people not familiar with open source projects and the Apache
license.
2019-10-16 15:08:45 +01:00
Pirmin Vogel
5f0be50473 Remove non-ASCII characters from .sv and .rst files 2019-10-14 09:08:16 +01:00
Tobias Wölfel
73224d9c51 Remove reference to simulation
The testbench does not exist anymore.
2019-10-08 11:57:19 +02:00
Greg Chadwick
b1a0cac126 [Doc] Add more pipeline details 2019-10-04 11:36:24 +01:00
Greg Chadwick
29d66a7fa4 [Doc] Fix for table wrapping in RTD theme
This causes wide tables to wrap content within their cells rather than
producing a table with a scroll bar see
https://github.com/readthedocs/sphinx_rtd_theme/issues/117 for details.
2019-10-04 11:36:24 +01:00
Tom Roberts
6aae5fe975 [Doc] Fix some rendering issues in cs_registers
- fixes #306
2019-10-03 10:41:29 +01:00
Tom Roberts
2aacd2b98b [Priv modes] Add support for U-Mode
- General changes to suport U-mode (fixes #88)
- Update documentation
- Add priv mode flops to CSRs module
- Propagate correct priv mode to PMP module
- Implement CSR priv-mode permission checking
- Implement illegal U-mode instruction checking
- Add extra mstatus bits for U-mode (MPRV and TW)
2019-10-03 10:41:29 +01:00
Philipp Wagner
c58e02a16b Document new tracer implementation 2019-10-02 18:28:26 +01:00
Philipp Wagner
74780e7e17 Implement Verilator-compatible tracer, and use it
The ibex_tracer module implements an execution tracer, observing the
execution flow and writing a human-readable execution trace. The trace
information is coming from the RVFI signals, as specified at
https://github.com/SymbioticEDA/riscv-formal/blob/master/docs/rvfi.md.

The existing implementation was tailored for use in ModelSim and other
commercial simulators, and used SystemVerilog features which are not
supported in Verilator or Icarus Verilog, such as classes, queues and
non-standard format specifiers (e.g. the `-` specifier for right-aligned
output). Being unable to see an execution trace when using Verilator
significantly reduced productivity and its usefulness.

This commit refactors the tracer to only use SystemVerilog constructs
which are supported in Verilator. While doing so, multiple improvements
were made for correctness and style.

Major changes:

- Improve compatibility with Verilator. Remove many non-synthesizable
  SystemVerilog constructs, such as classes and queues.
  Use casez instead of casex for better Verilator support (Verilator
  doesn't support X).
- Make the decoded output of the tracer match objdump from binutils
  exactly. Doing so is beneficial for two reasons: we can easily
  cross-check the decoded output from the tracer against the disassembly
  produced by objdump (and we did that), and users don't need to get
  used to another slighly different disassembly format.
- A plusarg "+ibex_tracer_file_base=ibex_my_trace" can be used to set a
  different basename for the trace log file.

Smaller cleanups:

- Remove decoding of reg-reg loads, which were leftover from a PULP
  extension.
- Make better use of the data available on the RVFI. Pass all of RVFI
  to the tracer, and use the provided data instead of manually
  recreating it, e.g. to get register data or the jump target.
- Rename all "instr" abbreviations to "insn". "insn" is what RVFI uses
  (and we cannot change that), so for consistency we now always use this
  abbreviation across the file.

All CSR names have been imported from binutils' riscv-opc.h file, available at
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob_plain;f=include/opcode/riscv-opc.h
using this small C program:

  #include <stdio.h>

  #define STR(s) #s

  int main(int argc, char **argv) {
    printf("unique case (csr_addr)\n");
  #define DECLARE_CSR(name, csraddr) \
    printf("  12'd%d: return \"%s\";\n", csraddr, STR(name));
  #include "riscv-opc.h"
    printf("  default: return $sformatf(\"0x%%x\", csr_addr);\n");
    printf("endcase\n");
    return 0;
  }

The RISC-V compliance test suite for the RV32 I, M, and C extensions has
been executed and traced. The disassembly of all traces have been
compared against traces produced by objdump to ensure identical output.

This PR is based on work by Rahul Behl <raulbehl@gmail.com> in #280.
Thank you Rahul for providing a great starting point for this work!
2019-10-02 18:28:26 +01:00
Philipp Wagner
47505c21f6 Docs: Fix Sphinx warnings and errors 2019-10-02 10:19:29 +01:00
Tom Roberts
f2fccaadbc [Prefetch buffer] - various bug fixes
- Fix incorrect address output to mepc on interrupt (fixes #320)
- Fix instruction address changing before grant (fixes #296)
- Suppress requests and reg writes on fetch error (fixes #340)
- Remove excess address flops in fetch_fifo
- Remove restriction on outstanding requests
2019-10-01 08:23:08 +01:00
pbing
e2110e2a46 Instruction set extensions M and C may be swapped 2019-09-07 17:54:26 +01:00
Greg Chadwick
bec84ca2b1 Add core_sleep_o to ibex interface
Signals the core is totally idle (WFI with no outstanding memory
transactions).  Fixes #258
2019-09-06 08:44:48 +01:00
Tom Roberts
36db104160 [RTL] - Remove timing loop in LSU
- Relates to issue #265
- External signals data_rvalid_i and data_err_i were factored
  into the external data_req_o signal
- To improve timing, these signals are decoupled
- The second part of an unaligned transaction will now be issued
  even if the first received an error response
- The state machine will service the abandoned requests
- pmp_err_q fixed to only update at specific times
2019-09-05 08:35:54 +01:00
Greg Chadwick
d14312c3cc Replace cluster_id/core_id with hart_id (#29)
If you're migrating from the previous interface you can use

logic [31:0] hart_id;
assign hart_id = {21'b0, cluster_id_i[5:0], 1'b0, core_id_i[3:0]};

...

ibex_core #(
  ...
) u_core (
  ...

  // replace core_id_i and cluster_id_i
  .hart_id_i(hart_id),

  ...
);
2019-09-03 14:18:39 +01:00
Tom Roberts
892ad8a621 [RTL] - Add PMP module
- Instantiate generic PMP module
- Wire up I-side and D-side PMP faults
- The output of the PMP check is used to gate external bus requests from the
  I-side and LSU
- Each of those units progresses with their request as-if it was granted
  externally and registers the PMP error
- The error is then sent to the controller at the appropriate time to trigger
  an exception
2019-08-29 17:43:37 +01:00
Felix Yan
5d1f8e16bc Correct a typo in doc/verification.rst 2019-08-23 09:02:06 +01:00
Tom Roberts
44b033cf8b [rtl] Add support for instruction fetch errors
- Add required signals to top-level
- Propagate error through fetch stages
- Add new exception type
- Update documentation for new exception type
- Resolves issue #109
2019-08-09 10:44:37 +01:00
taoliug
48f77c6a2c
Fix broken links in the verification doc (#230) 2019-08-08 10:22:54 -07:00
Ivan Ribeiro
19ffe9ac1d Make BASE field of mtvec CSR writeable
This commit makes the BASE field of the `mtvec` CSR writable to
allow changing the trap-vector base address at runtime without
changing the boot address input. Similar to the boot address,
the trap-vector base address must always be aligned to 256 bytes.
At bootup, the trap-vector base address is initialized to the boot
address.

This commit resolves lowrisc/ibex#118.

Most of this work has been done by @ivanmgribeiro as part of
lowrisc/ibex#193.
2019-08-08 10:50:34 +01:00
Pirmin Vogel
47edb43889 Doc: correct description of reset input 2019-08-07 17:12:22 +01:00
Philipp Wagner
3c5e998445 Document specifications we aim to support
Fixes #124
2019-08-05 11:34:14 +01:00
taoliug
54fac2954a
Move DV README.md to doc/verification.rst (#208) 2019-08-02 15:05:02 -07:00
Pirmin Vogel
09aad340b1 Update documentation of interrupt framework 2019-07-24 14:22:00 +01:00
Philipp Wagner
62f3573f2b Rework how tracer is instantiated and called
This change is slighly painful, but a necessary cleanup around the
tracer.

- We now provide a separate core file for the tracer, called
  "ibex_tracer.core" (in line with "ibex_tracer.sv"). The core is called
  "lowrisc:ibex:ibex_tracer".
- The toplevel wrapper with tracing enabled got renamed to
  "ibex_core_tracing.sv", and the core file is correspondingly called
  "ibex_core_tracing.core. The core in it is called
  "lowrisc:ibex:ibex_core_tracing".
- Finally to keep symmetry, the toplevel of Ibex itself got renamed in
  the core file from "lowrisc:ibex:ibex" to "lowrisc:ibex:ibex_core".
  This ensures that we have the same name for the core file, the source
  entry point, and the core name.

IMPORTANT NOTE:
If you apply this change and use fusesoc, you need to adjust the name of
the core dependency from "lowrisc:ibex:ibex" to
"lowrisc:ibex:ibex_core".
2019-07-23 19:45:48 +01:00
Tobias Woelfel
6ebc0001ec Ibex example Arty A7-100T
Simple example of how Ibex can be used to run software on a FPGA target.
2019-07-11 16:09:49 +01:00
Tobias Wölfel
edccb325e4 Example for Ibex tracer usage 2019-07-11 13:25:18 +01:00