mciepluc / cocotb-coverage

Functional Coverage and Constrained Randomization Extensions for Cocotb
BSD 2-Clause "Simplified" License
100 stars 15 forks source link

Constraint on fixed-sizes arrays? #51

Closed edcote closed 3 years ago

edcote commented 3 years ago

Not an issue as much as a feature request and/or guidance to potentially help with such request.

What would be needed to support such a structure:

self.my_very_own_array = [0] * 16
for i in range(16)
  self.add_rand(f'my_very_own_array[{i}]', [0, 1])
mciepluc commented 3 years ago

@edcote I am sorry I have missed you created an issue. A general comment is that if all you want to do is a simple randomization in an array, you should not bother the constraint solver with this. That's why post_randomize() function is in there. Check here. If you face specific problem with this feature, please let me know.