need some explanations for "–loop_iteration_limit&quot

Status
Not open for further replies.

Matrix_YL

Advanced Member level 4
Joined
Aug 19, 2005
Messages
108
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,298
Activity points
2,272
loop_iteration_limit

Hi all


I learn XST manual and meet some questions about While LOOPS
I found this in that manual

1.To prevent endless loops, use the "–loop_iteration_limit" switch.
2.While loops can have Disable statements. The Disable statement must be use inside a labeled block, since the syntax is "disable<blockname>."

who can give me some example for 2 and told how to set the "–loop_iteration_limit" switch:|

thank you very much !
 

set loop iteration limit

http://www.lavalogic.com/xlnx/xil_a...BV_EngineID=ccccaddfkjkfkhdcefeceihdffhdfjf.0
For 1 see the link above!

here goes example for 2..........
Code:
module test();
   integer i;
   initial i=0;
   // Print 0 to 100
   initial begin
      begin : my_block   // <-- this is the my_block we will disable 
         while(1) begin // infinite while loop
            if (i>100)
              disable my_block;
            else
              $display("%d",i);
            i=i+1;
         end
      end
   end
endmodule // test

Hope this helps!
 

    Matrix_YL

    Points: 2
    Helpful Answer Positive Rating
limit iterations in loop vba

Thanks
2.While loops can have Disable statements. The Disable statement must be use inside a labeled block, since the syntax is "disable<blockname>."

By the way ,The 2 always be used to testbench module ?
 

loop_iteration_limit en vhdl

This is the code for count leading zero's in input byte!!

Code:
module test(din, cnt);
   input [7:0] din;
   output [3:0] cnt;
   reg  [3:0] cnt;
   always @(/-*AS*-/din) begin
      cnt = 0;
      begin : my_block   // <-- this is the my_block we will disable
         integer i;
         i=7;
         while(i >= 0) begin // infinite while loop
            if (din[i] == 1'b1)
              disable my_block;
            else
              cnt = cnt + 1;
            i=i-1;
         end
      end
   end
endmodule // test
You can use it in synthesizable code but not recomended!!!
 

    Matrix_YL

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…