|
|
1 class frame_t {
2 enum size_t = RUNT,NORMAL,OVERSIZE;
3 rand bit [15:0] length;
4 rand size_t size;
5
6 constraint frame_sizes {
7 size == NORMAL => {
8 length dist {
9 64 : 127 := 10,
10 128 : 511 := 10,
11 512 : 1500 := 10
12 };
13 }
14 if (size == RUNT) {
15 length >= 0;
16 length <= 63;
17 } else if (size == OVERSIZE) {
18 length >= 1501;
19 length <= 5000;
20 }
21 }
22 }
23
24 program distribution {
25 frame_t frame = new();
26 integer i,j = 0;
27 for (j=0;j < 4; j++) {
28 printf("-------------------------------\n");
29 printf("Randomize Value\n");
30 i = frame.randomize();
31 frame.object_print();
32 }
33 printf("-------------------------------\n");
34 }
You could download file conditional_con.vr here
|