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

Reply

VHDL - Do I have a race condition for clk33_div?

 
Thread Tools Search this Thread
Old 06-12-2009, 04:29 PM   #1
Default Do I have a race condition for clk33_div?


I am looking to determine if the following VHDL process block creates
a race condition for clk33_div, given that it is a signal that is
being updated seemingly at same time it is being evaluated if I
understand VHDL constructs.

Any thoughts or guidelines would be greatly appreciated.

Regards,

Tim Doyle

Here is the code:


CLOCK_DIV: process (clk33, resetn)
begin
if resetn = '0' then
clk33_div <= (others =>'0');
clock_out <= '0';
elsif clk33'event and clk33 = '1' then
if clk33_div = "11000" then
clk33_div <= (others => '0');
clock_out <= not(clock_out);
else
clk33_div <= clk33_div + '1';
clock_out <= clock_out;
end if;
end if;
end process;


Tim Doyle
  Reply With Quote
Old 06-12-2009, 04:38 PM   #2
Barry
 
Posts: n/a
Default Re: Do I have a race condition for clk33_div?
On Jun 12, 8:29*am, Tim Doyle <tim9doy...@gmail.com> wrote:
> I am looking to determine if the following VHDL process block creates
> a race condition for clk33_div, given that it is a signal that is
> being updated seemingly at same time it is being evaluated if I
> understand VHDL constructs.
>
> Any thoughts or guidelines would be greatly appreciated.
>
> Regards,
>
> Tim Doyle
>
> Here is the code:
>
> CLOCK_DIV: process (clk33, resetn)
> * * * * begin
> * * * * * * * * if resetn = '0' then
> * * * * * * * * * * * * clk33_div <= (others =>'0');
> * * * * * * * * * * * * clock_out <= '0';
> * * * * * * * * elsif clk33'event and clk33 = '1' then
> * * * * * * * * * * * * if clk33_div = "11000" then
> * * * * * * * * * * * * * * * * clk33_div <= (others => '0');
> * * * * * * * * * * * * * * * * clock_out <= not(clock_out);
> * * * * * * * * * * * * else
> * * * * * * * * * * * * * * * * clk33_div <= clk33_div + '1';
> * * * * * * * * * * * * * * * * clock_out <= clock_out;
> * * * * * * * * * * * * end if;
> * * * * * * * * end if;
> * * * * end process;


Hi Tim,

In VHDL, a signal is not assigned its new value until you reach the
"end process" statement (or a wait statement). This is different from
the behavior of a variable in a process.

Barry


Barry
  Reply With Quote
Old 06-12-2009, 05:04 PM   #3
Mike Treseler
 
Posts: n/a
Default Re: Do I have a race condition for clk33_div?

> On Jun 12, 8:29 am, Tim Doyle <tim9doy...@gmail.com> wrote:
>> I am looking to determine if the following VHDL process block creates
>> a race condition for clk33_div, given that it is a signal that is
>> being updated seemingly at same time it is being evaluated


As long as I use clk33 as the only clock and
clk_div as an enable input for other logic
on the same clock, there will be no timing problems.
Think of the right side of an assignment as
gates on the D side of the flop

Barry wrote:
> In VHDL, a signal is not assigned its new value until you reach the
> "end process" statement


Which happens once every clock tick in Tim's example.
The code looks functional to me.
clock_out <= clock_out; is not necessary.

-- Mike Treseler


Mike Treseler
  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
Any tips to keep DVD player in good condition. Karan Lobana DVD Video 1 09-13-2005 09:43 AM
Re: Condition Jay Santos DVD Video 0 12-23-2004 07:28 PM
Lot of 44 Used DVD Titles - MINT condition Sean McLean DVD Video 0 02-03-2004 09:46 AM
FS: Alien Legacy Region 1 Box Set - Mint Condition - Bargain! WORX A4 DVD Video 0 01-22-2004 08:57 AM
FS: Certification books (A+, Network +). New condition. Skywarner A+ Certification 1 01-02-2004 10:03 PM




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