Forum Discussion
Altera_Forum
Honored Contributor
19 years agowhile loops in quartus
Hi there, Just wondering if anyone out there could help. I wrote the following code in verilog r = r-1; while(r != 0) begin r = r-1; end When I simulate the code in Quartus...
Altera_Forum
Honored Contributor
19 years agoMain issue here is that you think of Verilog as a programming language, which it is not.
Every line of Verilog is not "executed" by Quartus, but "interpreted" to build a circuit. The resulting circuit does not always correspond to the code you wrote line by line, neither is it supposed to, according to the Verilog for Synthesis standard Quartus simulator simulates the resulting circuit, not your code. Therefore, you should use Quartus RTL Viewer (Tools->Netlist Viewers->RTL Viewer) to see the circuit that was actually produced, and revise your code to produce the circuit you want. I suggest you find a good book that describes Verilog for synthesis. You might want to look up what textbooks good engineering schools use, and go from there.