OSVVM icon indicating copy to clipboard operation
OSVVM copied to clipboard

Add InitSeed Overload to DelayCoveragePkg

Open SkydiverTricky opened this issue 11 months ago • 5 comments

The coverage package has and InitSeed function for all coverage models - I think it would be useful to have an overload in the DelayCoveragePkg. Currently, all 3 IDs in the DelayCoverageIdType have to be seeded separetely.

SkydiverTricky avatar Jan 15 '25 10:01 SkydiverTricky

Are you looking to set the seeds to something particular or just set them all to something different?

The call to NewID calls InitSeed and gives each coverage model a unique seed.

Otherwise what do you want InitSeed to do for the 3 IDs?

JimLewis avatar Jan 15 '25 18:01 JimLewis

I like to control all of the seeding in the TB - which usually comes from an external source - usually a generic, so that it can be run in CI with a different seed on each run to catch corner cases over time. I think for these it would be nice just to have a wrapper function that sets all 3 to the same seed as I dont think it will affect much. If anyone needs all 3 seeded differently, they can just manually set each one.

SkydiverTricky avatar Jan 15 '25 19:01 SkydiverTricky

Have you seen SetRandomSalt? It is intended for that application.

In your top-level testbench, do:

entity TestHarness is
  generic (DATE_STRING : string := "") ;
end entity TestHarness ; 
architecture structural of TbMemIO is 
  constant SaltIsSet : boolean := SetRandomSalt(DATE_STRING) ;
  . . . 

SetRandomSalt will hash its input value to create a single value that is added to the each seed as it is initialized. It is important that this is done before anything else. Hence, I am doing this in the declarative region of the highest level of the testbench - this makes sure it is elaborated before any other entity.

Not sure when packages get elaborated - in the event you create randomization seeds in them - usually I do not as packages can be shared and sharing seeds can result in instability of the simulation.

JimLewis avatar Jan 15 '25 20:01 JimLewis

I should note, I am ok with having a wrapper function.

The question is, what are its parameters:

  • Does it accept either 3 string or 3 integer values?
  • Alternately does it accept 1 parameter and derive the others some how (I would not like that - too many opportunities to get it wrong)

JimLewis avatar Jan 15 '25 20:01 JimLewis

Probably best to offer 3x string and 3x integer, to be consistent with all other initSeed options

SkydiverTricky avatar Feb 14 '25 10:02 SkydiverTricky