Rerun the Verilator build without warnings disabled. For now
leave the -language
flag indicating IEEE 1364-2001.
make verilate COMMAND_FILE=cf-baseline-5.scr VFLAGS="-language 1364-2001"
156 warnings are given, as follows:
%Warning-CASEX: ../orp_soc/rtl/verilog/or1200/or1200_alu.v:207: Suggest casez (w ith ?'s) in place of casex (with X's) %Warning-CASEX: Use "/* verilator lint_off CASEX */" and lint_on around source t o disable this message. %Warning-CASEX: ../orp_soc/rtl/verilog/or1200/or1200_alu.v:278: Suggest casez (w ith ?'s) in place of casex (with X's) ... %Warning-UNOPTFLAT: Example path: ../orp_soc/rtl/verilog/or1200/or1200_sprs .v:384: ALWAYS %Warning-UNOPTFLAT: Example path: ../orp_soc/rtl/verilog/or1200/or1200_sprs .v:202: v.or1200_top.or1200_cpu->or1200_sprs.write_spr %Error: Exiting due to 156 warning(s) %Error: Command Failed /home/jeremy/tools/verilator/verilator-3.700/verilator_bi n -language 1364-2001 -Mdir . -sc -f v-processed.scr
The first 19 of these are about
CASEX
. Verilator will warn if the design
contains Verilog casex
statements. This is
considered a risky coding system in synthesizable code, because of
the ease of matching a stray unknown signal. In 4-state logic,
signals can be initialized to X, but in the 2-state logic of
Verilator only 0 and 1 are available.
There is less risk with casez
. Only
initialization to a high-impedance value causes a problem. Thus,
used with caution, casez
is suitable for
synthesizable code.
For more explanation see the SNUG 1999 papers by Clifford Cummings and Don Mills [2] [1].
There are two possible approaches to this problem. The first is to
ignore it, either globally by using the -Wno-CASEX
flag, or individually by use of
verilator lint_off CASEX
and
verilator lint_on CASEX
each case
statement.
The second case is to replace each casex
by
casez
. This is the approach we have taken here,
allowing us to measure the effect on performance. More commonly in
existing RTL this warning would just be ignored.
It is of course perfectly acceptable to mix both approaches—ignore some warnings and fix others.
The files affected are mostly in the OpenRISC 1200 CPU (
or1200_alu.v
,
or1200_lsu.v
,
or1200_operandmuxes.v
,
or1200_genpc.v
,
or1200_sprs.v
,
or1200_except.v
,
or1200_reg2mem.v
,
or1200_du.v
,
or1200_mult_mac.v
), along with one in the
Ethernet (eth_wishbone.v
) and one in the UART
(uart_transmitter.v
). Modified versions are
placed in the local directory and the command file
(cf-optimized-1.scr
) altered to use them.
To get a performance figure, the revised model is run with all warnings disabled (the other warnings have not yet been dealt with):
make verilate COMMAND_FILE=cf-optimized-1.scr \ VFLAGS="-Wno-lint -Wno-COMBDLY -Wno-UNOPTFLAT -language 1364-2001" \ NUM_RUNS=1000
The run gives the same result as before and takes the same number of
cycles. Simulation performance was 42.76 kHz, not significantly
different to the previous run. The CASEX
warning
is primarily about coding style rather than performance benefits.