Commit graph

1456 commits

Author SHA1 Message Date
Philipp Wagner
a28170d6a7 [doc] Fix paths in verification documentation
The files moved; also add an explicit `cd` to the command listing to
help people only skimming the docs.
2020-03-12 11:05:05 +00:00
Greg Chadwick
4f31a0e6e8 [rtl] Fixes for single-cycle mutiply
* single cycle multiplier configuration needlessly stalled for a cycle
* mult_hold wasn't being set in mult state machine in single cycle
  multiplier
2020-03-11 11:53:54 +00:00
Tom Roberts
6be55207f3 [rtl] Refactor some IF/ID stage registers
- Rewrite the ID instr flops to be clock gate friendly
2020-03-11 11:43:40 +00:00
Tom Roberts
2a90ef94ed [rtl] IF stage timing fix
- ready_i input to the prefetch buffer factored both it's own valid_o
  output and the pc_set branch signal, neither of which are required.
- Refactoring the ready_i signal to just id_in_ready_i improves timing
  significantly for the icache.
- Also removed offset_in_init signal which appeared to serve no purpose.
2020-03-11 11:43:40 +00:00
Rupert Swarbrick
16e81f7a74 Fix typo in uvm/core_ibex/Makefile
Reported in issue 674.
2020-03-11 09:56:19 +00:00
Rupert Swarbrick
ee2729d9bf Add missing Makefile dependencies on testlist.yaml
This adds a dependency on $(TESTLIST) (which is that file) for each
target that depends on $(TEST_OPTS), a set of command line options
that includes --testlist=$(TESTLIST).

In practice, we could actually just add the dependency to the
$(metadata)/instr_gen.gen.stamp target, since all the other affected
targets transitively depend on that, but this seems a little confusing
so I've made the dependency explicit.
2020-03-11 09:25:42 +00:00
udinator
4cb3fc4ce6
update riscvOVPsim.ic for semihosting mode (#681)
Signed-off-by: Udi <udij@google.com>
2020-03-10 16:50:29 -07:00
Rupert Swarbrick
7b97d21b42 Respect --lsf_cmd when compiling TB in sim.py 2020-03-10 09:16:16 +00:00
Rupert Swarbrick
73658abb63 Fixup module docstring in sim.py
The copyright notice should surely be in a comment, rather than the
docstring. And change the docstring itself to match what the file
does.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
b90a24f00c Tidy-ups in sim.py's compare function
This is mostly just adding comments and docstrings and pulling the
guts of the comparison into its own function.

I've also got rid of the subprocess calls for appending to a log file
and now calculate the pass/fail count from the return codes of the
checkers rather than grepping in the regression log (hopefully it
gives the same result!)
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
c6400cccc0 Remove unnecessary DV_DIR variable in dv/uvm/core_ibex/Makefile
Since we're not doing stuff with 'make -f path/to/Makefile', we always
know that DV_DIR (as computed) is the current directory, so we can get
rid of it completely.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
08fc2a4af6 Various cleanups in sim.py's rtl_sim function
This is a bit more verbose, but I think it's a bit more obvious what's
going on, and quite a lot of the added lines are docstrings explaining
the code.

We now split "find the list of commands to run" from "run the
commands" with or without LSF.

The other major change is that the --lsf_cmd parameter defaults to
None, rather than the empty string. The patch also updates the
Makefile accordingly.

Finally, since we're now a little more careful with passing paths
around, we don't have to change cwd for each run. I'm not convinced
that the LSF mode actually worked before, since we needed to run each
command in a different directory. It should probably work now, but I
don't have access to LSF to check.

The only sad thing is that UVM leaves a 'tr_db.log' file lying around
in the current directory. I don't think we really care about the
contents, but can't see how to disable it, so I've added it to
gitignore.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
cbe58b36ab Pick a seed per run in sim.py
Before this patch, the default behaviour picked a different random
seed for each test run (and didn't store it anywhere). I think this is
a bit confusing: you can't reproduce the test without digging around
in log files. Now, we pick a seed at the start of the program, print
it, and use it for each test (not as crazy as this sounds: the seed
controls things like random stalls, but the tested program will be
different each time).

Note that this patch won't actually have any effect, since we
currently only use sim.py from dv/uvm/core_ibex/Makefile, which
specifies the seed every time.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
54bce35816 Remove last use of re library in sim.py
We were only ever using this for searching for, and replacing, literal
strings. Using str.replace instead.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
f9ea35d22b Remove --riscv-dv-root argument from sim.py
This is set to what you'd expect in the Makefile and it seems a little
odd anyway: surely we should use the same directory as the code we're
running?
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
04b5cb2d46 Clean up --en_cov and --en_wave in sim.py
Since these are boolean flags "enable this, please", we use argparse's
support for them.

Command line change:

  Before: --en_cov=0
  After:

  Before: --en_cov=1
  After:  --en_cov

and similar for en_wave
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
d934a4485b Tidy up path name arguments in sim.py
Now the defaults for --testlist and --simulator_yaml should work, no
matter where it's called from.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
00bc7ca038 Tidy up command substitution in sim.py
This generally tidies up and documents how we substitute options and
environment variables in get_simulator_cmd. It's now slightly laxer,
so it won't moan about a missing environment variable or option if
it's not actually used in the command.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
341abb9a7a Move main program of sim.py into a function
This means we can wrap main() in a try/except block. That way, future
patches can change code that fails to throw an exception, rather than
having to do the ugly "write to stderr; exit 1" dance.

This also catches a global (cwd) which we were passing implicitly to
rtl_sim. Fortunately, we already have that value in _CORE_IBEX, so can
just use that.
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
411ee3f458 Tidy up imports in sim.py
We now put sys.path back after importing things and no longer import
'*' from anything (which means static analysis tools can now spot when
we've got a name wrong).
2020-03-10 09:16:16 +00:00
Rupert Swarbrick
ca61654261 Re-indent sim.py
This should have no functional change: it just indents the code with
4-space indents and wraps any long lines.
2020-03-10 09:16:16 +00:00
danghai
32ba3cd92e It should give error message instead of info message for failure 2020-03-10 09:16:16 +00:00
udinator
ea654b7681
[ml] fix irq test for ML (#675)
Signed-off-by: Udi <udij@google.com>
2020-03-09 18:55:33 -07:00
udinator
73c940a05c
Update google_riscv-dv to google/riscv-dv@3f584ad (#676)
Update code from upstream repository https://github.com/google/riscv-
dv to revision 3f584adef07b7f04edda8a6ba1dfc01a14df5d98

* update ebreak generation for ML test (Udi Jonnalagadda)

Signed-off-by: Udi <udij@google.com>
2020-03-09 18:55:17 -07:00
udinator
b54ef5b1e0
[dv] update timeout for INITIALIZED response (#672)
Signed-off-by: Udi <udij@google.com>
2020-03-09 15:54:13 -07:00
udinator
19173290e0
Update google_riscv-dv to google/riscv-dv@6344e95 (#673)
Update code from upstream repository https://github.com/google/riscv-
dv to revision 6344e951fef22b383551a85365ebb7d6aa74eb34

* fix incorrect initialization routine (Udi Jonnalagadda)
* Add coverage for single precision floating (Part 1) (google/riscv-
  dv#488) (weicaiyang)
* Add load/store shared memory test (google/riscv-dv#508) (taoliug)
* Fix hart id assignment for load/store instruction stream
  (google/riscv-dv#507) (taoliug)

Signed-off-by: Udi <udij@google.com>
2020-03-09 15:53:39 -07:00
udinator
753e76549d
[ml] add condensed test targets for ML (#659)
Signed-off-by: Udi <udij@google.com>
2020-03-09 12:59:47 -07:00
Greg Chadwick
57c97536ec [syn] Synthesis fixes
Correcting some small issues that cause newer versions of OpenSTA to
fail (previously it issued an error and continued).

- ABC/OpenSTA disagree how set_driving_cell command works so introduce
  seperate ABC SDC file
- Run clean before generating STA netlist, otherwise yosys generates
  some assignements to unused wires that OpenSTA's verilog parser dislikes
2020-03-09 15:08:10 +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
217261f599 Update eembc_coremark to eembc/coremark@0c91314
Update code from upstream repository https://github.com/eembc/coremark
to revision 0c91314d1a4fdfc157d623ad5cb6ac5aef746db1

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
2d1b07a5c6 [ci] Fix removal of vendored files from C/C++ lint 2020-03-09 14:41:40 +00:00
danghai
6fc0a667e2 Add support for Qrun Questa 2020-03-09 14:36:05 +00:00
Tom Roberts
82ebf6fd20 [I-Cache] Initial commit of prototype RTL
- Working prototype of RTL
- Initial documentation
- Still some TODOs to be dealt with
2020-03-06 16:34:48 +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
Greg Chadwick
e4b8851b4b Revert "Re-instate an 0x in dv/uvm/core_ibex/Makefile"
This reverts commit c32a088f0c.

The bug fixed by this was also fixed in riscv-dv leading to two 0x being
inserted into generated .S files.

Fixes #661
2020-03-06 13:55:12 +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
taoliug
3d827e1db1
Update google_riscv-dv to google/riscv-dv@4583049 (#660)
Update code from upstream repository https://github.com/google/riscv-
dv to revision 4583049cc2b3469ba9dea56b5e2d75809a89d8f3

* Allow running compile command in LSF (google/riscv-dv#506) (taoliug)
* improve documentation of config options (Udi Jonnalagadda)
* Update AMO region and data sections (google/riscv-dv#503) (taoliug)
* Avoid jumping to a sub program of other harts (google/riscv-dv#502)
  (taoliug)
* Use .section for data sections by default (google/riscv-dv#501)
  (taoliug)
* create PMP accessible region for exception handlers and start/end
  sections (Udi Jonnalagadda)
* minor change to signature_addr passed to generator (google/riscv-
  dv#497) (udinator)
* Solve before cconstraints modified (google/riscv-dv#476) (Dariusz
  Stachańczyk)
* Move instruction sections together for multi-harts (google/riscv-
  dv#495) (taoliug)
* add seed capability to CSR test generation (Udi Jonnalagadda)
* fix pmp/shifted_addr compile warning (google/riscv-dv#493)
  (udinator)
* User long jump to switch between different harts (google/riscv-
  dv#491) (taoliug)
* Fix s_region generation (google/riscv-dv#487) (taoliug)
* update rv32imc/riscv_pmp_test testlist options (google/riscv-dv#486)
  (udinator)
* Fix default value of num_of_harts (google/riscv-dv#485) (taoliug)
* Add shared memory region for multi-harts AMO (google/riscv-dv#484)
  (taoliug)
* Add a runtime option num_of_harts (google/riscv-dv#483) (taoliug)
* Add multi-thread support (google/riscv-dv#482) (taoliug)

Signed-off-by: Udi <udij@google.com>
2020-03-05 17:21:36 -08:00
Rupert Swarbrick
f870accab6 Remove stray semicolon
This seems to cause lint errors with ncsim (see bug #650).
2020-03-05 16:09:17 +00:00
Rupert Swarbrick
c32a088f0c Re-instate an 0x in dv/uvm/core_ibex/Makefile
The --end_signature_addr argument doesn't go to Verilog; instead it
makes it through run.py (vendored-in, so hard to change) and
eventually gets inserted into some assembly code.

Before this patch,

    make ITERATIONS=1 TEST=riscv_csr_test ISS=spike SEED=123

failed with:

  out/seed-123/instr_gen/asm_tests/riscv_csr_test_0.S: Assembler messages:
  out/seed-123/instr_gen/asm_tests/riscv_csr_test_0.S:526: Error: illegal operands `li x2,8ffffffc'
  out/seed-123/instr_gen/asm_tests/riscv_csr_test_0.S:533: Error: illegal operands `li x2,8ffffffc'
2020-03-05 16:09:03 +00:00
danghai
88f1a7e38f Fix qrun compile warning 2020-03-05 14:59:25 +00:00
Greg Chadwick
b932a8bbf3 [rtl] Break path from data_err_o -> instr_req_o
Fixes #649
2020-03-05 10:51:25 +00:00
Greg Chadwick
cc402d80b1 [lint] Fix lint waiver 2020-03-05 10:51:25 +00: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
98c8cd39ea Add missing flop to bus error checking in riscv_testutil.sv
This caused a (verbose!) combinatorial loop error in Verilator.
2020-03-03 11:35:07 +00:00
Rupert Swarbrick
ddb34bcb75 Avoid two combinatorial loop warnings in riscv_compliance suite
We do this by pulling the definition of host_addr_o and host_req_o out
of an always_comb process in riscv_testutil.sv.

When set inside the process, Verilator warns about a combinatorial
loop. This happens because a read request could go out on the bus and
appear again (combinatorially) on the slave interface, setting
read_signature_and_terminate. This doesn't actually happen (because
read_signature_and_terminate only takes effect when we are in state
WAIT), but Verilator's sensitivity tracking isn't fine-grained enough
to notice.
2020-03-03 11:35:07 +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
53ecd9770d Simplify the logic in check_ibex_uvm_log
Also fix a minor nit: if something had gone really weird and we saw
a pass message followed by a fail message, the previous code would
have treated the test as a pass. Now it is treated as a failure.
2020-03-03 09:04:34 +00:00
Rupert Swarbrick
88a1859616 Make ibex_log_to_trace_csv.py PEP8 compliant
This is mostly just re-indentation and being explicit about what we're
importing from what module, which allows Python lint tools (flake8 and
similar) to spot when there's a typo in a variable name or similar.
2020-03-03 09:04:34 +00:00
Rupert Swarbrick
d260dea927 Simplify usage of ibex_log_to_trace_csv.py
The previous version died with a confusing error if you ran it with no
arguments (because the compulsory input and output file paths are
specified as --option arguments).

I've left the arguments optional, but they now default to
stdin/stdout (which means you can now use this script in a pipe).

I've also reformatted the code I touched to look a little more like
PEP8 Python.
2020-03-03 09:04:34 +00:00