Following example shows the declaration of Verilog FOR loop.
First of all FOR loop is completely synthesizable construct. These are used when
speed of digital hardware is critical and there is not much limitation on hardware
utilization. With FOR loops we are basically instantiating same hardware circuit
Verilog FOR loop. Can it be used to design hardware?
FOR loops in digital design. Most commonly asked questions for Verilog and SystemVerilog are listed below.
initialbegin for(i=0; i <4; i=i+1) $display("%d:%h", i, data[i]); end
Digital design always involves trade-off between speed and area. In case of FPGA’s the resources are limited and its recommended to carefully evaluate the use of FOR loops. Alternate approach is to pipeline design, its discussed on FCD at link. Complete usage is discussed is complete rtl example.
Question. Can we synthesize FOR loops to replicate hardware or fpga ? Question. Is it valid or smart coding style to freely use FOR loops in RTL? Can we do increment using for loops? (yes) Answer to above questions is elaborated below: