Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Do I have a race condition for clk33_div?

Reply
Thread Tools

Do I have a race condition for clk33_div?

 
 
Tim Doyle
Guest
Posts: n/a
 
      06-12-2009
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;
 
Reply With Quote
 
 
 
 
Barry
Guest
Posts: n/a
 
      06-12-2009
On Jun 12, 8:29*am, Tim Doyle <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
Mike Treseler
Guest
Posts: n/a
 
      06-12-2009

> On Jun 12, 8:29 am, Tim Doyle <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Example code from SwingWorker documentation could have race condition? lionelv@gmail.com Java 3 02-04-2007 07:27 AM
Can static member cause a race condition? alexvodovoz@gmail.com ASP .Net 1 08-07-2006 12:17 PM
Race condition on accept() system call using pthread on Red Hat ES 2.1 (kernel 2.4.9) fran C Programming 2 08-10-2004 08:09 PM
Mega Pixel race is like the Mhz Race Hugo Drax Digital Photography 7 01-12-2004 11:07 AM
race condition question jimjim Java 6 11-02-2003 07:55 PM



Advertisments