Hi All,
I have some set of registers in RAL model.I want to randomize them with following constraints as follows
For example:
R1 is 16-bit register, which has 5 fields
Bit [15] - a;
Bit [14:13] - b;
Bit [12:10]. - c;
Bit [9] - d;
Bit [8:0]. - e;
R2, R3, R4, R5, R6, R7, R8 are the similar registers with similar fields.
Constraints
1) Each value in 'c' field corresponds to 5ps. Total values 'c' can take is [0-7]. Eg, if it is 2, it takes 2*5ps = 10ps
2) Each Value in 'd' field corresponds to 2ps. Total Values 'd' can take is [0-1]. Eg, if it is 1, it takes 1*2ps = 2ps.
3) Each value in 'e' field corresponds to 1ps. Total values 'e' can take is [0-511]. Eg, if it is 250, it takes 250*1ps = 250ps.
4) Summation of c+d+e should not exceed 100ps. Preference should be given for 5ps, next 2ps and next 1ps. Fpr eg: if i want to generate 42ps, we have many ways but mentioning only 2 scenarios
a) make c =8, d=1, e=0. so we get 8*5ps + 1*2ps = 42ps.
b) make c=8, d=0, e=2. so we get 8*5ps + 2*1ps = 42ps.
In the above point a should be given preference instead of point b.
5) When a =1 & b= some_value, e field becomes e = e+b; Eg: e=10, b=2, a=1, then e = e+b = 10+2 = 12*1ps= 12ps.
6) When a =0, e remains same.
7) The difference between values generated by any two registers should lie between 10ps and 40ps. Eg: R2 generates 100ps and R7 generates 70ps, |R2-R7| = |R7-R2| = |100ps -70ps| = 30ps.
I have a solution by constraining them using inline constraints while caling R1.randomize(). But it is becoming cumbersome. So Iam looking for an effective solution to randomize all these R1 to R8 registers and not disturbing other registers in my RAL Model.
Looking forward for best solutions.
Thanks