Improve Verilator compatibility
Created by: StMiky
Improve Verilator compatibility
This pull request applies some changes to the RTL to avoid compilation errors with Verilator. In particular:
- Use explicit comparison in test statements on parameters (e.g.,
if (DEBUG != 0)
instead ofif (DEBUG)
) - Use unpacked array definition when both concurrent and continuous assignments are performed on the same signal
- Use downward ranges in signal definitions (e.g.,
logic [N-1]
instead oflogic [N]
Component
RTL:
rtl/cv32e40x_core.sv
rtl/cv32e40x_cs_registers.sv
rtl/cv32e40x_debug_triggers.sv
rtl/cv32e40x_pma.sv
Revision
The fixes are currently applied to revision f17028f (v0.9.0).
Limitations
This PR only solves a subset of suppressible Verilator warnings (e.g., through waiver files). In particular, the following waivers are known to be necessary to compile with no warnings:
lint_off -rule PINCONNECTEMPTY -file "*/carus_cpu_subsystem.sv" -match "Cell pin connected by name with empty reference: '*'"
lint_off -rule PINCONNECTEMPTY -file "*/cv32e40x_if_stage.sv" -match "Cell pin connected by name with empty reference: '*'"
lint_off -rule PINCONNECTEMPTY -file "*/cv32e40x_load_store_unit.sv" -match "Cell pin connected by name with empty reference: 'core_align_err_o'"
lint_off -rule DECLFILENAME -file "*/cv32e40x_sim_clock_gate.sv" -match "Filename '*' does not match MODULE name: '*'"
lint_off -rule UNUSED -file "*/cv32e40x_*.sv" -match "Parameter is not used: '*'"
lint_off -rule UNUSED -file "*/if_xif*.sv" -match "Parameter is not used: '*'"
lint_off -rule UNUSED -file "*/if_xif.sv" -match "Signal is not used: 'compressed_*'"
lint_off -rule UNUSED -file "*/if_xif.sv" -match "Signal is not used: 'mem_*'"
lint_off -rule UNUSED -file "*/cv32e40x_*.sv" -match "Bits of signal are not*used: *"
lint_off -rule UNUSED -file "*/cv32e40x_*.sv" -match "Signal is not*used: *"
lint_off -rule WIDTH -file "*/cv32e40x_*.sv" -match "Operator * expects *"
lint_off -rule LITENDIAN -file "*/cv32e40x_*.sv" -match "Little bit endian vector: left < right of bit range: *"
lint_off -rule UNOPTFLAT -file "*/cv32e40x_*.sv" -match "Signal unoptimizable: *"
lint_off -rule UNOPTFLAT -file "*/if_xif*.sv" -match "Signal unoptimizable: *"
lint_off -rule BLKANDNBLK -file "*/cv32e40x_csr.sv" -match "Unsupported: Blocked and non-blocking assignments to same variable: *"
lint_off -rule UNDRIVEN -file "*/cv32e40x_align_check.sv" -match "Bits of signal are not driven: 'core_resp_o'[2]"
lint_off -rule COMBDLY -file "*/cv32e40x_sim_clock_gate.sv"
Status
The included changes are currently applied to the cv32e40x
core in X-HEEP
. No bugs related to these changes are currently known.