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

Reply

VHDL - Confusion centered around the falling_edge

 
Thread Tools Search this Thread
Old 06-11-2006, 03:43 AM   #1
Default Confusion centered around the falling_edge


I'm trying to build an IDE device and I'm having some difficulty
getting my head around why the following peice of VHDL will synthesize,
but leave the data bus at hi-z permenantly -

process(RD, WR, RST, sramreadpipe, SRAM_DATA)
begin
if RST='1' then -- if no reset in progress
if RD='1' then -- if no read in progress
DATA<=(others=>'Z'); -- high-z the bus
else -- if theres a read in progress
if falling_edge(RD) then-- check for any just-starting reads
DATA<="0101010101010101";
end if; -- ..
end if; -- ..
else
DATA<=(others=>'Z');
end if;
end process;

but if I comment out the line under 'if RD='1'' thus

process(RD, WR, RST, sramreadpipe, SRAM_DATA)
begin
if RST='1' then -- if no reset in progress
if RD='1' then -- if no read in progress
-- DATA<=(others=>'Z'); -- high-z the bus
else -- if theres a read in progress
if falling_edge(RD) then-- check for any just-starting reads
DATA<="0101010101010101";
end if; -- ..
end if; -- ..
else
DATA<=(others=>'Z');
end if;
end process;

the system behaves as expected (ie, only setting the DATA bus when
RD=0). I know I could use 'if RD='0'' instead of the falling_edge, but
this is a bad idea because I'm going to need actions only to be carried
out on the falling edge later on.. Can anyone give me a hand with this?

Ta muchly.
-Alan



randomdude@gmail.com
  Reply With Quote
Old 06-11-2006, 11:56 AM   #2
Ralf Hildebrandt
 
Posts: n/a
Default Re: Confusion centered around the falling_edge
wrote:

> I'm trying to build an IDE device and I'm having some difficulty
> getting my head around why the following peice of VHDL will synthesize,
> but leave the data bus at hi-z permenantly -
>
> process(RD, WR, RST, sramreadpipe, SRAM_DATA)
> begin
> if RST='1' then -- if no reset in progress
> if RD='1' then -- if no read in progress
> DATA<=(others=>'Z'); -- high-z the bus
> else -- if theres a read in progress
> if falling_edge(RD) then-- check for any just-starting reads
> DATA<="0101010101010101";
> end if; -- ..
> end if; -- ..
> else
> DATA<=(others=>'Z');
> end if;
> end process;


What you have writetn ist: "Only if RST='1! and RD='0' then a
falling_edge(RD) will be accepted."
Furthermore it is a bad idea to use RD as both asynchronous reset and clock.

Use the synchronous template:

process(reset,clock)
begin
if (reset='1' then
-- do some reset
elsif rising_edge(clock) then -- or falling_edge
-- do something
end if;
end process;


Ralf


Ralf Hildebrandt
  Reply With Quote
Old 06-11-2006, 12:55 PM   #3
Nicolas Matringe
 
Posts: n/a
Default Re: Confusion centered around the falling_edge
Ralf Hildebrandt a écrit :
[...]
> What you have writetn ist: "Only if RST='1! and RD='0' then a
> falling_edge(RD) will be accepted."
> Furthermore it is a bad idea to use RD as both asynchronous reset and
> clock.
>
> Use the synchronous template:
>
> process(reset,clock)
> begin
> if (reset='1' then
> -- do some reset
> elsif rising_edge(clock) then -- or falling_edge
> -- do something
> end if;
> end process;


I second to this and I'll add a second template for hi-Z outputs :

bidir_bus <= out_bus when output_enable = '1' else (others => 'Z');
in_bus <= to_x01(bidir_bus);

(the use of the to_x01 function is optional but very convenient when
there are weak drivers on the bus)

Nicolas


Nicolas Matringe
  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
confusion with credit towards the Mobile certification. giddy MCTS 0 07-23-2008 05:29 AM
color management confusion tritron Hardware 0 07-02-2006 05:46 AM
Address Bus and External Data Bus Confusion LoXodonte A+ Certification 1 04-18-2006 10:09 PM
Lockup/Reboot confusion Bloke_in_a_box A+ Certification 2 05-12-2004 06:56 PM
25th Hour Version Confusion Pat DVD Video 7 09-30-2003 03:33 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