|
|
|
|
|
by Taniwha
2692 days ago
|
|
probably not a good idea, because you are sampling cnt after think you have incremented it and you will get the wrong value Essentially what happens is: tmp_cnt1 = cnt + 1;
if (cnt > 100) tmp_cnt2 = 0;
some time later: cnt = tmp_cnt1;
and after that (if cnt >100) cnt = tmp_cnt2;
Better to say: if (cnt >= 99) {
cnt <= 0;
} else {
cnt <= cnt+1;
}
|
|
Also using <= a smart compiler can merge multiple always statements:
into a single behind your back, effectively converting 2*N simulation events into 2 (a very good thing)