Randomizing 2 D dyanamic array range

Hello,
I have randomized the 2 dimensional dynamic array size by following code

rand logic address[][];
constraint c_address {
address.size() inside {[8:10]};
foreach(address[i]) {
address[i].size() inside {[8:10]};
}
}

I am able to constrain the size of array but, unable to constrain the range of the array i.e I want my address to be within range of 0-20.
I tried by further adding the constraint as

constraint d_address {
address[i] inside {[8:10]};
}

this is giving me an error : “(vlog-2728) Inside operator requires a singular type.”
Next I tried by adding

constraint range{foreach(address[i,j]) address[i][j] inside{[5:9]};} 

then error : randomization is failing
I also used inline constrains in test

seq.randomize() with {address<=7} or seq.randomize() with {address[i]<=7}

for both of the above codes it gives an error: “Cannot mix packed and unpacked types in this operation”
can anyone please help me in sorting this out…

In reply to duggi bhavya:

The reason for your constraint failure is you declared a 2-D unpacked array of single bits.

Change your declaration to

rand logic [31:0] address[][];

Then your range constraint works.

In reply to dave_59:

Sorry for late response,
As u suggested the above format do works but, it doesn’t meet my requirement because by above code 2-d array each of 32 bit is being randomized but, I want randomize 2-d dynamic array each of one bit because I am using this in I2C_Protocol where single bit transmission should take place.
I want to constraint the address locations to verify each address location i.e if I want to send an 8 bit address i should be able give its range to be between 0-20 so eight bits should be in this range.
Think I am clear in framing in my doubt if there is any ambiguity please let me know,
Thank you.

In reply to duggi bhavya:

I think you need to study the difference between packed an unpacked arrays and then maybe come up with a different approach to what you are doing.