SpinalHDL icon indicating copy to clipboard operation
SpinalHDL copied to clipboard

The missing initialization of signals in simulation is better to be checked and warned.

Open Readon opened this issue 3 years ago • 8 comments

The existing simulation engine allows the presence of uninitialized signals without prompting. The uninitialized signals will be assigned a random value determined by the seed, thus the errors will be overwritten or cause the simulation to fail.

It would be a good solution to check the uninitialized signals through the engine at the beginning of the simulation.

Readon avatar Jan 04 '23 09:01 Readon

And suggest the user to use .randomize() to explicitly have random values ?

numero-744 avatar Jan 04 '23 09:01 numero-744

Uninitialized signal ? or register ? Do you mean x-propagation ?

Dolu1990 avatar Jan 04 '23 10:01 Dolu1990

Ah I supposed it was about DUT inputs, but maybe I'm wrong

numero-744 avatar Jan 04 '23 11:01 numero-744

Ah I supposed it was about DUT inputs, but maybe I'm wrong

You're right, what I mean is the DUT's inputs.

Readon avatar Jan 04 '23 11:01 Readon

I don't see this as a deficiency, more of an annoyance if you forget. If anything I'd like 9 value support at the simulation level. The red X's make it easier to see errors :P

kleinai avatar Jan 05 '23 22:01 kleinai

I don't see this as a deficiency, more of an annoyance if you forget. If anything I'd like 9 value support at the simulation level. The red X's make it easier to see errors :P

Sometimes, the work flow is "Design->Debug with simulation->...... long time later -> Changes -> Check if it is pass". During this process, the wave file is not expected to be checked each time. However, the simulation fails not caused by the design changes but an uninitialized signal.

Readon avatar Jan 06 '23 05:01 Readon

Could add a hash map to check that all inputs were assigned at least once, else generate a warning, but to me, it seems very specific, and shouldn't be turned on by default.

Dolu1990 avatar Jan 16 '23 12:01 Dolu1990

Could add a hash map to check that all inputs were assigned at least once, else generate a warning, but to me, it seems very specific, and shouldn't be turned on by default.

I have met this kind of problems several times, and I could not know which signals have been assigned during the simulation. Especially when xxxDriver, xxxAgent are used. I have to check the signals each time when I use it.

There are too much way to assign values to signals, so things would get complicated.

Readon avatar Jan 17 '23 05:01 Readon