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
The first style requires the array to be implemented in logic elements. For an array size of 1024, this would be at least "impracticable", as mentioned by Tricky.
To implement an array in internal block RAM, the array elements must be accessed sequentially, but additional conditions must be met to allow RAM inference from the code. I doubt that the style 2) example will work as is, but somethinking of this kind should. The example reads and writes different array elements simultaneously, which refers to a dual port RAM. You should review the Altera RAM inference templates for the suggested syntax.