opentitan icon indicating copy to clipboard operation
opentitan copied to clipboard

[dv] Unexplained X on internal Ibex signal 'alu_op_a_mux_sel_o'

Open GregAC opened this issue 6 years ago • 7 comments

Whilst vendoring in the latest Ibex I encountered an issue with an ASSERT_KNOWN firing. This has uncovered some behaviour I can't explain with Xs. I am seeing Xs on various internal Ibex signals that shouldn't be X and looking at the RTL there is no obvious code-path that allows them to be. alu_op_a_mux_sel_o in hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv is one example.

It's assigned inside an always_comb block. It has a default assignment at the top of the block with a case statement that can make other assignments depending on the instruction input. The case statement (and statements nested inside it) appear to use default: as required by the style guide.

If a chip sanity test is run with dvsim:

./util/dvsim.py -w ./hw/top_earlgrey/dv/chip_sim_cfg.hjson -i sanity

And the resultant waves are examined alu_op_a_mux_sel_o is x at time 0 and continues to be x for the first few clocks of the simulation.

Inside the Ibex DV environment this behaviour is not seen (alu_op_a_mux_sel_o is set to a valid value at time 0). I have also setup a small wrapper testbench for the decoder to run stand-alone in VCS. It also shows a valid value on alu_op_a_mux_sel_o at time 0 even when all of the module inputs are x (which is the expected behaviour).

So I think there's something about the OT DV environment that is causing this, uncertain if that's our fault or if we're hitting a VCS bug.

I did try using interactive debugging in VCS to track down the source of the x assignment but the feature that allows you to break into debug on any signal change didn't seem to work in this instance. Placing breakpoints on every assignment of alu_op_a_mux_sel_o also didn't reveal much. Though I did observe the odd behaviour of the simulation hitting all of those breakpoints on time 0 where you would expect it to hit none of them apart from the assignment at the top of the always_comb block as the instruction being x means none of the case labels (other than default:) should be triggered. This behaviour was not observed in my stand-alone ibex_decode only testbench.

As a first step it would be useful to know if this is seen in other simulators when running the OT DV environment or if it's just in VCS.

GregAC avatar Mar 20 '20 16:03 GregAC

@weicaiyang @sriyerg @udinator any ideas?

GregAC avatar Mar 23 '20 09:03 GregAC

Will take a look sometime today. Thanks for reporting.

sriyerg avatar Mar 23 '20 15:03 sriyerg

At a first glance, I'd guess this is showing up in the OT DV environment because x-propagation is enabled - I haven't enabled x-prop in the Ibex DV environment just yet. I"ll also take a look.

udinator avatar Mar 23 '20 19:03 udinator

Aah, yes. This does sound like something X-propagation would catch. @udinator, please try enabling it in Ibex DV and see if you can reproduce it in the meantime.

sriyerg avatar Mar 23 '20 19:03 sriyerg

After enabling xprop in the Ibex environment, I can confirm I see the same issue that @GregAC is seeing, as well as an Illegal instruction warning about the very first PC being all X's.

udinator avatar Mar 23 '20 20:03 udinator

Yes I can reproduce in my small test with xprop turned on, thanks for the help @sriyerg and @udinator.

I think this has some implications for what we say about X in the style guide. I'll open an issue there to discuss. I will close this one as possible fixes will depend upon what we decide in the style guide discussion.

GregAC avatar Mar 24 '20 10:03 GregAC

See style guide discussion here: https://github.com/lowRISC/style-guides/issues/31

GregAC avatar Mar 24 '20 11:03 GregAC