![]() |
|
|
|
#1 |
|
I read a program which has a counter implemented as shown. Can someone
tell me, what this means? and why cant I increment and reset the counter with separate if conditions -- increment and reset the counter synchronously to avoid race conditions if incCnt = '1' then cnt <= cnt + 1; elsif rstCnt = '1' then cnt <= (others => '0'); end if; Thank you RP crazyrdx |
|
|
|
|
#2 |
|
Posts: n/a
|
If you have seperate if conditions then when both are true cnt will be
assigned with the incremented value as well as 0 as per the logic this could cause race condition. Muralidharan |
|
|
|
#3 |
|
Posts: n/a
|
thanks! got it...
RP crazyrdx |
|
|
|
#4 |
|
Posts: n/a
|
Assuming that the posted statements appear within a clocked process...
Separate IF conditions will not cause any race conditions; the process will use the last signal assignment. In the example, incCnt will take precedence over rstCnt. If the IF statements were separated and left in the same order, rstCnt would take precedence. Using the IF/ELSIF construct makes the designer's intentions very clear, using two IF statements might not. The comment about incrementing and resetting the counter synchronously to avoid race conditions means that it's done synchronously as opposed to asynchronously. That's a good thing, as asynchronous designs should be avoided at all costs unless you're an asynchronous design expert and your tools support asynchronous designs. jens |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VHDL'87: avoiding that "file not found" leads to fatal error | sigwalt | Hardware | 0 | 09-04-2007 11:30 AM |
| Uses of The 4th Dimension (New Discovery by The Human Race!) | use4d@mail.com | DVD Video | 0 | 02-08-2006 12:45 PM |
| Uses of The 4th Dimension (New Discovery by The Human Race!) | use4dnow@yahoo.com | DVD Video | 22 | 02-07-2006 01:41 PM |
| Uses of The 4th Dimension (New Discovery by The Human Race!) | use4d@mail.com | DVD Video | 0 | 02-07-2006 01:07 PM |
| DVD Verdict reviews: HOT WHEELS WORLD RACE, SOUTH PARK: THE COMPLETE THIRD SEASON, and more! | DVD Verdict | DVD Video | 0 | 01-14-2004 10:08 AM |