Hi Frnd,
I tryed to use the syntax you have given but its printing different values
which are in not range
code follows here
-----------
module test();
reg a;
reg b;
reg c;
wire out;
reg[7] range;
always
repeat(24)
begin
#100
a = 1'b1;
b = 1'b1;
#100
a = 1'b0;
b = 1'b1;
end
always@(a or b)
begin
repeat(24)
begin
range = 55 + $random % 16;
end
$monitor(" ‰d ",range);
end
endmodule
output follows here
?d 66
# ?d 47
# ?d 58
# ?d 54
# ?d 67
# ?d 67
# ?d 48
# ?d 46
# ?d 57
# ?d 59
# ?d 64
# ?d 49
# ?d 63
# ?d 50
# ?d 69
# ?d 69
# ?d 42
# ?d 41
# ?d 62
# ?d 55
# ?d 55
# ?d 44
# ?d 51
# ?d 47
# ?d 41
# ?d 44
# ?d 42
Could you give me correct solution?
Thanks,
venkat k
Added after 1 hours 6 minutes:
Hi Frnd,
I got the solution for this
we have to use the random command like this.
we should use { } brackets like below.
range = 55 + {$random} % 16;
This gives values between 55 to 77
Thanks,
venkat k
Added after 5 minutes:
The above one gives value between 55 to 71
not 55 to 77...