Altera_Forum
Honored Contributor
13 years agoFor loop
hello I want to check an array. which one is quicker? using for loop or using a counter that counts up at the "posedge" of the clock. thanks
Let's go back to your original ambiguous post.
--- Quote Start --- I want to check an array. --- Quote End --- Check it for what? I'm going to assume you mean you want to examine each element of the array and compare it with another value to see if that value matches any elements. --- Quote Start --- which one is quicker? --- Quote End --- Quicker in terms of what? Shortest propagation delay within one clock cycle? or least number of clocks cycles with the shortest clock period? Or maybe something else. --- Quote Start --- using for loop or using a counter that counts up at the "posedge" of the clock. --- Quote End --- A for loop is a programming concept - it does not exist on an FPGA. When you synthesize it, the loop get unrolled into parallel hardware blocks, and it all depends on what is inside the for loop to know how that affects the timing.