05.07.2013 Views

Xilinx Synthesis Technology User Guide

Xilinx Synthesis Technology User Guide

Xilinx Synthesis Technology User Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

While Loops<br />

Verilog Language Support<br />

When using always blocks, use the "while" statement to execute<br />

repetitive procedures. A "while" loop executes other statements until<br />

its test expression becomes false. It is not executed if the test<br />

expression is initially false.<br />

• The test expression is any valid Verilog expression.<br />

• To prevent endless loops, use the "-iteration_limit" switch.<br />

The following example shows the use of a While Loop.<br />

Example 7-5 While Loop Description<br />

parameter P = 4;<br />

always @(ID_complete)<br />

begin : UNIDENTIFIED<br />

integer i;<br />

reg found;<br />

unidentified = 0;<br />

i = 0;<br />

found = 0;<br />

while (!found && (i < P))<br />

begin<br />

found = !ID_complete[i];<br />

unidentified[i] = !ID_complete[i];<br />

i = i + 1;<br />

end<br />

end<br />

XST <strong>User</strong> <strong>Guide</strong> 7-15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!