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 agoAre you looking to make a test bench or synthesize logic? If it's the latter then I would make sure you know what your synthesis tool will give you. I've seen a few people use loops in their HDL and were surprised by what they ended up with.
For this reason I never use them. You can transform your HDL easily by just using your "r != 0" as the enable for the registering operation of "r = r - 1". That would give the same sequential behavior you would get out of synthesis. You can go into Quartus and select a template that gives you skeleton code for this type of construct.