For instance in this thread - How to NOT use while() loops in verilog (for synthesis)?, Brian Carlton mentions that instead of using for and while loops in Verilog, one should use an always loop. I was wondering what are the ways to break out of an iteration if a particular condition is satisfied. I was wondering if the following could be used :
always @ (posedge clk or var == 3)`
Where var is a variable in the module or block?
For instance, how would I convert the following code into something which can be synthesized by XST.
//******************************************************
//Check whether randp is prime or not
//******************************************************
for(i = 0; i < 100; i = i+1)
begin
assign PRIME_CHECK = randp;
assign sqroot = PRIME_CHECKED;
for(i = 0 ; i <= sqroot ; i=i+1)
begin
if((sqroot%i) == 0)
begin
break;
end
end
break;
randp = RANDP;
end