G
Gokul
Guest
Hi all,
I have a Variable [Register] named var.
var is a 6-bit Register.So it can hold 0 to 63.
var is assigned as follows: var = {$random}
Now, I wanted the value in var to be even always.
var should be 0,2,4 ... 62.
Only if the var holds a even value, I should enter the loop.Or else I
should try for the next value using $random function.
Precisely, I wanted the following functionality.
until (var % 2 ) == 0;
var = {$random}
if (var %2 == 0)
begin
Loop begins
end
Is there any precise way to do this in Verilog ???
I have a Variable [Register] named var.
var is a 6-bit Register.So it can hold 0 to 63.
var is assigned as follows: var = {$random}
Now, I wanted the value in var to be even always.
var should be 0,2,4 ... 62.
Only if the var holds a even value, I should enter the loop.Or else I
should try for the next value using $random function.
Precisely, I wanted the following functionality.
until (var % 2 ) == 0;
var = {$random}
if (var %2 == 0)
begin
Loop begins
end
Is there any precise way to do this in Verilog ???