How do I make "randomize with" has the value it's only 4 bytes unit

Hi,

I’m trying to make a “randomize with” has the value it’s only 4 bytes unit.

For example,
If I implement with “randomize() with inside ” then I can randomize it and get the one value which has range 0x00000000 to 0x0000ffff.
But I want to get the randomized value which has only 4 byte unit such as 0x0, 0x04, 0x08…0xfffC not 0x01 and 0x02…

 

if(!req.randomize() with { HADDR inside {[32'h00000000:32'h0000FFFF]};})


how do I make “randomize with” has the value it’s only 4 bytes unit?

Looks like you are looking to generate word aligned addresses for AHB.

Just add another constraint { HADDR[1:0] == 2`b0 }

That should do the trick