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
compare these two codes:
1)for(i=0;i<1024;i=i+1) if(array==1)array=0; 2)case(ps) ... 1:begin if(counter==1024) ns=2; else begin ns=1; if(array[counter]==1) array[i]=0; count=1; end end ... always@(posedge clk) if(count==1) counter=counter+1; which one is running faster? if they have same clock. you know what I want to know?! I want to know which style is better generally.