Commit graph

1282 commits

Author SHA1 Message Date
Philipp Wagner
71a635ec6b Reverse return code of simutil_verilator_set_mem()
All functions in simutil_verilator return booleans to indicate
success/failure, where 1 == true, and 0 == false.
simutil_verilator_set_mem() returns an int due to DPI interface
restrictions. Before, 0 meant success, and 1 meant error.

To keep things nice and consistent, turn things around and align with
the bool meaning.
2019-11-28 18:45:11 +00:00
Tobias Wölfel
ce7e38351e [DV] Add Verilator memory initialization from ELF
Support initialization of memory by loading content from ELF files.
All segments of the ELF file with the type `PT_LOAD` are merged into a
temporary buffer and then forwarded to a predefined memory.
This is an addition for setting the memories with VMEM files.

Memories must implement `simutil_verilator_set_mem` to support the
setting of values with a width of 32 bits. A return value of 0 must
indicate a successful operation and 1 an error.

Memories are defined by a call to `RegisterMemoryArea()` before the
execution of the simulation, at which point the arguments are parsed and
the initialization is started. The memories are identified by unique
name. The design specific location is used to set the SystemVerilog
scope.

Registered memories can be printed by using `-l list`. The unique name
is used for `-l name,file.elf` together with the file path.
An optional part of the argument is the type of the file, `elf` or
`vmem`, and if not provided it is attempted to detect the type by
looking at the file extension.
The memory specific arguments which already existed accept now also ELF
files. They use predefined names and are included to keep the interface
stable.

Contents of an ELF segment which has a bigger memory size than file size
are not set. This is typically required for BSS sections for zero-ing
the memory.
2019-11-27 11:35:07 +00:00
Greg Chadwick
11749c7e4d [rtl] Implement FENCE.I
Fixes #391
2019-11-27 08:47:26 +00:00
Tobias Wölfel
e5ee5fa81a [make] Add CS Register testbench targets
New targets to build and run the testbench.
Minor cleanup for parallel make runs.
2019-11-26 15:02:37 +01:00
Tobias Wölfel
845c9aa38c Update gitignore to include simple system files 2019-11-25 14:13:17 +01:00
Tobias Wölfel
bbca883c25 Update gitignore for tag file 2019-11-25 14:13:17 +01:00
udinator
bb7acbdb7a
Update google_riscv-dv to google/riscv-dv@d691906 (#491)
Update code from upstream repository https://github.com/google/riscv-
dv to revision d69190682078470bc6d5661d72f873ae9850ae53

* enable CSR randomization only for csr instructions (google/riscv-
  dv#321) (udinator)
* fix csr test script pathname (Udi Jonnalagadda)

Signed-off-by: Udi <udij@google.com>
2019-11-22 10:17:24 -08:00
udinator
1a2270ce40
[DV] streamline Makefile gen flow (#488)
Signed-off-by: Udi <udij@google.com>
2019-11-21 16:51:41 -08:00
udinator
1040d5e7e9 [DV] Update flow to match RISCV-DV changes (#487)
Signed-off-by: Udi <udij@google.com>
2019-11-21 16:22:49 -08:00
udinator
6a582cc11f
Update google_riscv-dv to google/riscv-dv@39ca859 (#486)
Update code from upstream repository https://github.com/google/riscv-
dv to revision 39ca85903eea94350d3a610256307346da407e5b

* Add directed stream to access higher privilege CSRs (google/riscv-
  dv#316) (udinator)
* add config knob for mstatus.tw (Udi Jonnalagadda)
* Fix ovpsim floating point instruction parsing issue (google/riscv-
  dv#313) (taoliug)
* Fix SATP configure issue (google/riscv-dv#312) (taoliug)
* Support import testlist (google/riscv-dv#311) (taoliug)
* Add a rand address load/store test (google/riscv-dv#310) (taoliug)
* Fix ovpsim log parsing issue (google/riscv-dv#309) (taoliug)
* Add a generic approach to check command return value (google/riscv-
  dv#308) (taoliug)
* Fix compile issue (google/riscv-dv#307) (taoliug)
* Basic U-mode support (Udi Jonnalagadda)

Signed-off-by: Udi <udij@google.com>
2019-11-21 11:22:34 -08:00
udinator
2a01d1ce4c [DV] Test accesses to higher privileged CSRs (#483)
Signed-off-by: Udi <udij@google.com>
2019-11-21 11:18:39 -08:00
Tom Roberts
0b87370ee0 [dv] Prepare CS registers TB for CI
- Switch from Makefile calling fusesoc to fusesoc calling Makefile
- Pass parameters through DPI rather than as env variables

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2019-11-21 09:55:40 +00:00
Tobias Wölfel
a264ee6e7f [make] Add Makefile for common tasks
Instead of copying the commands from the documentation or using the
shell history to find the commands use a Makefile as a convenience to
run some common tasks.
A shell's completion system can make use of the targets and provide tab
completion.
2019-11-20 12:12:06 +01: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
Pirmin Vogel
d117b24a17 [rtl] Do not update CSRs upon exceptions in debug mode
In debug mode, exceptions shall not update any CSRs including `mcause`,
`mepc`, `mtval`, `dpc` and `mstatus`, see Debug Spec v0.13.2, p.39.

This resolves lowRISC/ibex#168.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-11-19 15:15:42 +01:00
udinator
8112ba5a24
[DV] umode_tw test (#481)
Signed-off-by: Udi <udij@google.com>
2019-11-18 13:43:02 -08:00
Tobias Wölfel
21f2a842d8 [DV] Add exit check for setup call
Check the return value and exit program execution.
2019-11-18 12:31:38 +01:00
Philipp Wagner
7465a68615 Fix typo in comment 2019-11-18 10:30:14 +00:00
Tom Roberts
88158e6fa8 [csr tb] Declare registers as a macro list
All CSR addresses supported by the TB are now delared as an X
macro list. This list is then used to autogenerate the enum
type, string print helper and an array of all addresses.

The array of addresses can now be used by the randomize generator
to turn an arbitrary integer index into an address. This removes
the restriction on only generating contiguous address ranges noted
in #443.

Add missing signal csr_restore_dtret_i

Signed-off-by: Tom Roberts <tomroberts@lowrisc.org>
2019-11-18 09:16:42 +00:00
Pirmin Vogel
40d6368983 [dv] Remove clock gating primitive in dv/uvm/tb
This commit removes a copy of the dummy clock gating primitive from
tree previously used for UVM-based DV. There is another, identical copy
of the same primitive in `shared/rtl` that can be used instead.

This resolves lowRISC/ibex#213.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-11-16 00:25:32 +01:00
Pirmin Vogel
aefbcdceb3 [rtl] Add new assertions
Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-11-15 10:23:03 +01:00
Pirmin Vogel
40e3db5f23 [rtl] Rework assertions
This commit modifies the assertions to not fire as long as the reset
is active. Also, it updates some assertions.

This resolves lowRISC/ibex#274.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-11-15 10:23:03 +01:00
udinator
c05634cfdf
[DV] Enable user-mode in DV environment, add basic tests (#471)
Signed-off-by: Udi <udij@google.com>
2019-11-14 16:11:32 -08:00
Tobias Wölfel
103b7357f0 Update fusesoc usage 2019-11-14 13:20:19 +01:00
Tobias Wölfel
76f6a3d4c3 Use shared code for Arty A7-100T example
Move Xilinx specific code into shared folder so it can be re-used by
different examples.
Use the shared RAM code and make use of byte enable signal.
Fixes lowrisc/ibex#144
2019-11-14 13:20:19 +01:00
Tobias Wölfel
6be1e8aff3 Delay simulator finish
The tracer needs time to log the final instruction.
Introduce a counter to delay calling the simulation finish.

Fixes lowrisc/ibex#468
2019-11-14 11:57:12 +00:00
Pirmin Vogel
9738b6c703 [rtl] Rework core_busy signals, remove feedback to clk
This commit reworks the generation of the `core_busy` signal used to
control the main clock gate of the core. Without this commit, the
controller generates a separate `first_fetch` signal only asserted in
the FIRST_FETCH state that directly controls `core_busy` and thus the
main clock gate. This is problematic as it introduces a feedback to
from the controller state into the clock.

This commit removes the problematic signal and changes the generation of
`ctrl_busy` in the FIRST_FETCH state of the controller. This signal is
now used to control the main clock gate in all states (previously all
except FIRST_FETCH) but it gets registered, thus it does not introduce
the feedback into the clock.

This resolves lowRISC/ibex#211.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-11-14 12:55:16 +01:00
Tom Roberts
0243e08111 [rtl] Switch to M mode on debug entry
- Core should operate as if in M-mode while in debug mode
- Previous priv level is restored from dcsr on DRET
- Fixes #463
2019-11-14 09:37:02 +00:00
Tobias Wölfel
0927f085ee Use gitignore for software directory 2019-11-13 14:30:53 +01:00
Tobias Wölfel
ef96678d65 Update load instruction 2019-11-13 14:30:53 +01:00
Pirmin Vogel
52b03f3637 [rtl/controller] Remove redundant check in EBREAK handling
This commit removes a redundant for `ebrk_insn` in the `DBG_TAKEN_ID`
state. If this signal is not set, the controller does not enter this
state in the first place. This is not changing functional behavior,
but removes a `MISSING_ELSE` coverage hole reported by @udinator.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-11-13 13:12:15 +01:00
Pirmin Vogel
6a5ee22395 [rtl/controller] Remove redundant check in execption handling
This commit turns the last case in the exception handling if/else block
from an `else if` to an `else`. This is not changing functional
behavior as the same condition is checked previously, but removes a
`MISSING_ELSE` coverage hole reported by @udinator.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-11-13 13:12:15 +01:00
Pirmin Vogel
d538261c78 [rtl] Ignore LSB only for writes to dpc
Without this commit, writes to `dpc` with the LSB set are completely
ignored. This commit changes the implementation to ignore the LSB only.
This is the same behavior as seen required for `mepc`. This resolves
lowRISC/ibex#444.

Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
2019-11-13 13:11:22 +01:00
Marek Pikuła
9b390c5d4e Fix formatting of table in simple system
Fixes #454
2019-11-13 11:09:05 +00:00
udinator
6ce8b6ecf2
Update google_riscv-dv to google/riscv-dv@4b333ba (#462)
Update code from upstream repository https://github.com/google/riscv-
dv to revision 4b333ba1ef285ec4508c606efa64610136154a5e

* cg instantion based on supported_isa (google/riscv-dv#303)
  (udinator)
* Fix coverage collection issue, change default target to rv32imc
  (google/riscv-dv#302) (taoliug)
* Integrate whisper(swerv-ISS) (google/riscv-dv#301) (taoliug)
* Fix cov.py, set UVM_VERBOSITY to UVM_HIGH for verbose mode
  (google/riscv-dv#299) (taoliug)
* Fix jalr handling issue for ovpsim (google/riscv-dv#298) (taoliug)
* Add noclean option, change default output directory of coverage
  collection (google/riscv-dv#297) (taoliug)
* Enable using core trace logs for coverage collection (google/riscv-
  dv#291) (udinator)
* Fix isa/mabi setup issue for RV64GC target (google/riscv-dv#296)
  (taoliug)
* fixed line widths (x2) and check error returns for any questa
  simalator (google/riscv-dv#293) (simond-imperas)
* Unknown instruction fix (google/riscv-dv#290) (simond-imperas)
* Fix ovpsim log process issue (google/riscv-dv#289) (udinator)
* adding riscvOVPsim vector instruction trace to csv processing -
  start (3rd Attempt) (google/riscv-dv#288) (simond-imperas)

Signed-off-by: Udi <udij@google.com>
2019-11-12 14:39:22 -08:00
Tobias Wölfel
1cc4831480 Add rv32Zicsr target in azure
Fixes lowrisc/ibex#459
2019-11-12 21:59:40 +00:00
Tobias Wölfel
87b05b6f0e Update expected failure for riscv-compliance
[riscv-compliance] changes the tests for rv32i.
Update the expected output.

[riscv-compliance]: df18fa8d95
2019-11-12 21:59:40 +00:00
udinator
7ea79ae366
[funct_cov] Fix GPR assignment bug (#456) 2019-11-12 10:07:12 -08:00
udinator
2ee9828a78
[Doc] Update verification documentation (#449) 2019-11-12 10:06:41 -08:00
udinator
2a3c6c6430
[funct_cov] Update Makefile options for coverage (#455) 2019-11-11 15:07:20 -08:00
udinator
23589f5a91
[funct_cov] Update Ibex log parsing (#453) 2019-11-11 13:52:47 -08:00
Pirmin Vogel
0a1a8514c4 [rtl] Rework access to performance counter CSRs
This commit reworks the code section describing how the performance
counter CSRs are accessed by CSR instructions. Instead of using an
address mask inside the default case, and excluding CSRs in the same
address range previously handled (like `mcycle(h)`, `minstret(h)`,
`mcountinhibit`), all performance counter CSRs are now explicitly
enumerated. This enhances readability of the code and enhances
compatibility with some tools without changing behavior or causing
lint problems.

This commit is based on suggestions from @MarekPikula. It replaces the
proposal in lowRISC/ibex#336.
2019-11-11 19:01:49 +01:00
Greg Chadwick
2041f10c69 Added simple system
Simple system is a basic verilator top-level testbench for running
 executables.  It has functionality for outputting text to a log file
 and for the software to terminate the simulation
2019-11-09 07:48:47 +00:00
Greg Chadwick
31d423ae47 Added top-level shared directory
shared is to be used for RTL/Code that is used by multiple parts of the
directory tree or does not fit neatly under other places in the tree.
2019-11-09 07:48:47 +00:00
udinator
502b5a951e
[DV] clean up stale TODOs (#448) 2019-11-04 16:52:01 -08:00
udinator
498786aef5 Update google_riscv-dv to google/riscv-dv@44bec76 (#447)
Update code from upstream repository https://github.com/google/riscv-
dv to revision 44bec7695fd2399166e181fa84b66a608b5f745f

* Re-enable custom OVPsim configuration files (google/riscv-dv#282)
  (udinator)
2019-11-04 13:41:36 -08:00
udinator
098fb7d847
[DV/flow] Integrate with RISCV-DV (#446) 2019-11-04 13:22:47 -08:00
udinator
f3f3f3de09
Update google_riscv-dv to google/riscv-dv@cce71d2 (#445)
Update code from upstream repository https://github.com/google/riscv-
dv to revision cce71d24b56f641d994fbf69b8b50aa3756b9322

* Add handshake documentation (Udi)
* Fix coverage debug mode (google/riscv-dv#281) (taoliug)
* Fix coverage script issue (google/riscv-dv#280) (taoliug)
* code block highlight (google/riscv-dv#279) (taoliug)
* Replace setting directory with a default target (google/riscv-
  dv#278) (taoliug)
* fixed trace handling issues (google/riscv-dv#274) (eroom)
* Allow running the script from other directory (google/riscv-dv#277)
  (taoliug)
* Add dummy writes to status and ie CSRs (Udi)
* Script typo fix (google/riscv-dv#272) (Dan Petrisko)
* Fix misa setup issue (google/riscv-dv#271) (taoliug)
* Enable mie.mtie for timer interrupts (Udi)
* Update illegal system instr generation (Udi)
* Fix duplicate (google/riscv-dv#268) (taoliug)
* Add experimental instruction distribution control (google/riscv-
  dv#267) (taoliug)
* Update README to clarify the flow setup instructions (google/riscv-
  dv#265) (taoliug)
* Remove debug logging (google/riscv-dv#264) (taoliug)
* Fix compressed instruction test setup (google/riscv-dv#263)
  (taoliug)
* adding __init__ in the scripts dir since python3.7 requires that for
  directories to be recognized as modules (google/riscv-dv#252)
  (Jielun Tan)
* Fix riscvOVPsim.ic (google/riscv-dv#261) (taoliug)
* Fix ovpsim sim problem (google/riscv-dv#260) (taoliug)
* Add alternative command options for directed instruction stream
  (google/riscv-dv#254) (taoliug)
* Fix dsim compilation issue (google/riscv-dv#253) (taoliug)
2019-11-04 10:48:02 -08:00
Tom Roberts
48adda0b47 [verilator] Fix a few verilator DV issues
- Speed up compile time by only optimizing hot code
- Fix some incorrect references in tb_cs_registers
- Add a comment for FST vs VCD tracing
2019-11-01 16:02:46 +00:00