Misoptimization of case with string compares #1536
Labels
area: wrong runtime result
Issue involves an incorrect runtine result from Verilated model
resolution: fixed
Closed; fixed
Author Name: Philipp Wagner
Original Redmine Issue: 1536 from https://www.veripool.org
Original Assignee: Wilson Snyder (@wsnyder)
I have (simplified) code like this:
When I compile without WITH_DEFAULT being set, everything works as expected, and I get output like this:
But if I compile with WITH_DEFAULT set, I get this output; effectively, the default label is always taken.
The same behavior can be observed if I switch from case to if statements.
I put together a full testcase at https://github.com/imphil/verilator-case, it can be run by typing make.
The full code where we observed this behavior is at https://github.com/lowRISC/ibex/blob/2acb497d22a5da877a9c4350ef5693d0c767cc61/rtl/ibex_tracer.sv#L584
Looking at the generated C code, it looks like somehow the if/case statements get optimized out when compiling with default/else branches.
I'd appreciate any pointers on how to debug this further.
The text was updated successfully, but these errors were encountered: