Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Specman generate (for each in)

Status
Not open for further replies.

loglong

Newbie level 5
Newbie level 5
Joined
Jun 17, 2008
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,352
Hi,

In e language, i want generate array_my in [0..0xf] but the item in array don't overlap, does the following rules meet my requirement? If not, how can I generate the non-overlap item in array?

array_my[4] : list of uint;
keep for each in sram_addr_offset {
it in [0..0xf];
};
 

ljxpjpjljx said:
it can only gurantee each one is in the scope of 0-0xf

Maybe you misunderstand my requirement.

I want to generate in [0-0xf], but the item in array must unique.
for example:
there're 3 items in array_my[3] which in [0-0xf];
then I want 0,2,4 or any unique value, but can't be 0,2,2

how to constraint it?
 

loglong said:
ljxpjpjljx said:
it can only gurantee each one is in the scope of 0-0xf

Maybe you misunderstand my requirement.

I want to generate in [0-0xf], but the item in array must unique.
for example:
there're 3 items in array_my[3] which in [0-0xf];
then I want 0,2,4 or any unique value, but can't be 0,2,2

how to constraint it?

Hi,
If i understood your problem correctly , you want to generate unique numbers in the rage 0..0xF , i.e there will not be any repetition of the generated numbers.

OK , the solution goes like this..
Please follow the steps :

a) Generate any random number in the range 0..F and add into the list(say list name is list_name)
v.i.z say the generated value is 0xD. So the list_name will contain 0xD
b) Next time when you will generate the number , set the contraint such that the generated value doesn't lies in the list.

gen random_data keeping {
it not in list_name;
};

So it will generate any number in 0..F other than D(as D is present in the list)

Hope it will help to solve your problem

Thanks
Deb
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top