Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - avoiding race

 
Thread Tools Search this Thread
Old 01-16-2006, 11:48 AM   #1
Default avoiding race


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
  Reply With Quote
Old 01-16-2006, 12:41 PM   #2
Muralidharan
 
Posts: n/a
Default Re: avoiding race
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
  Reply With Quote
Old 01-16-2006, 01:42 PM   #3
crazyrdx
 
Posts: n/a
Default Re: avoiding race
thanks! got it...

RP



crazyrdx
  Reply With Quote
Old 01-16-2006, 03:15 PM   #4
jens
 
Posts: n/a
Default Re: avoiding race
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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

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




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46