What is the difference in them if my VHDL supports rising_edge()?
Are they actually the same? If not, which is better to use?
thanks,
--john
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
In fact, the rising_edge() function is implemented with the
(clk'EVENT) AND (clk = '1') syntax, so they should be exactly the
same.
Bob
--
-------------------------------------------------------------------------
Bob Klenke, Ph.D., Principal Scientist Dept. of Electrical Engineering
University of Virginia
http://csis.ee.virginia.edu/~rhk2j Charlottesville, VA 22903-2442
-------------------------------------------------------------------------
From s practical point of view, it's *almost* the same.
Assuming, you are talking about std_logic_1164, the rising_edge()
function is defined to be true *only* if the value before the event
was '0' or 'L' and the current value of this event is '1' or 'H';
any other combination is *not* a rising edge in this definition.
For a clock, this has typically only an impact at initialization time.
-- test case for rising_edge()
library ieee;
use ieee.std_logic_1164.all;
entity test is
end test;
architecture test_arch of test is
signal clk1: std_logic := '0';
signal clk2: std_logic := '1';
signal clk3: std_logic; -- 'U'
signal clk4: std_logic; -- 'U'
begin
clk1 <= transport not clk1 after tclk/2;
clk2 <= transport not clk2 after tclk/2;
-- clk3 process
process
begin
-- starts with '0' (last value = 'U')
clk3 <= transport '0', '1' after tclk/2;
wait for tclk;
end process;
-- clk4 process
process
begin
-- starts with '1' (last value = 'U')
-- is this a rising edge?
clk4 <= transport '1', '0' after tclk/2;
wait for tclk;
end process;
-- sensitive process: check
process (clk1, clk2, clk3, clk4)
begin
-- no diff
if clk1'event and clk1='1' then
assert rising_edge(clk1) report "clk1: difference!";
end if;
-- no diff
if clk2'event and clk2='1' then
assert rising_edge(clk2) report "clk2: difference!";
end if;
-- no diff
if clk3'event and clk3='1' then
assert rising_edge(clk3) report "clk3: difference!";
end if;
-- this should be an error according to the ieee definition
if clk4'event and clk4='1' then
assert rising_edge(clk4) report "clk4: difference!";
end if;
end process;
end test_arch;
--
Andreas Gieriet
(Please replace "nospam" by "pobox" in the return address,
which has been altered to foil junk mail senders)
> Hi, everyone, I'm wondering in VHDL, there seems to be 2 ways to implement
> detection of rising clks:
> 1. IF (clk'EVENT) AND (clk = '1') THEN
> 2. IF rising_edge(clk) THEN
>
> What is the difference in them if my VHDL supports rising_edge()?
> Are they actually the same? If not, which is better to use?
>
> thanks,
> --john
I just finished reading about this. The rising_edge(clk) will only detect a
change from a low to a high. The clk'event and clk='1' will detect a change to
the '1' state from ANY other state. This includes high impedance, the unknown
state and even a 'H' (weak one) state.
Rick Collins
rising_edge and falling_edge is not supported by Synopsys for synthesis.
--
Regards
Hans Lindkvist
Actually, after I posted that, I found out that they are
slightly different, although they do produce the same result for
synthesis. Sorry for my mistake!
It does seem, however, that the rising_edge() function in the
std_logic_1164 package might have to change because the Draft 1076.6
standard does not allow the 'LAST_VALUE attribute.
>rising_edge and falling_edge is not supported by Synopsys for synthesis.
>--
>Regards
>Hans Lindkvist
That's surprising. I've got a copy of the IEEE 1164-1993 (VHDL)
standard here, and it says rising_edge() and falling_edge() are part
of the standard. Does that mean that Synopsys doesn't follow the IEEE
standards?
It seems that for synthesis, any given vendor is free to implement a subset
of the VHDL standard. I have been told that this is true for ALL vendors.
Each one implements a slightly different subset for synthesis, so that
although your design may be portable for simulation, it might not produce the
same (if any) hardware with different vendors.
Can anyone clarify this last statement? If a vendor implements a different
subset of synthesis, can it produce DIFFERENT hardware from another vendor?
Or must a vendor either produce the SAME hardware or simply fail to compile?
Rick Collins
snip
> Actually, after I posted that, I found out that they are
>slightly different, although they do produce the same result for
>synthesis. Sorry for my mistake!
> It does seem, however, that the rising_edge() function in the
>std_logic_1164 package might have to change because the Draft 1076.6
>standard does not allow the 'LAST_VALUE attribute.
Any particular reason why the 'last_value is not allowed in the
draft 1076.6 standard?
Was the 1076.6 draft defined by what is currently supported
by particular synthesis tools?
Is the standard defined so that all the vendors can instantly
claim compatibility without having to progress their tools?
B
*remove antijunk from address to rely*
First, Synopsys do not support VHDL-93 for synthesis only VHDL-87, and what i
know they will not support VHDL-93.
Second, I asked them a Synopsys Apps. Engineer about rising/falling_edge and the
answer I got was that they decided to do it like that, an answer, as you may
understand, annoyed me quite a lot. The theory I have is that Synopsys DC can't
handle EVENT statements whithin functions.
--
Regards
Hans Lindkvist
Sam Falaki
> Can anyone clarify this last statement? If a vendor implements a different
> subset of synthesis, can it produce DIFFERENT hardware from another vendor?
> Or must a vendor either produce the SAME hardware or simply fail to compile?
>
> Rick Collins
Check out
www.eda.org/swig
The synthesis ionteroperability Working group is developing a standard
semantics for VHDL RTL synthesis.
Phani
------------------------------------------------------------------------------
Phani K Putrevu |email : pput...@ececs.uc.edu
MS - Comp Engg |Phone : 513-281-1154 (home)
University of Cincinnati | 513-556-0904 (Off)
www.ececs.uc.edu/~pputrevu|Addr : 3018 Marshall Av. #2, Cincinnati OH
45220
------------------------------------------------------------------------------
> john_...@optilink.dsccc.com wrote:
> >
> > Hi, everyone, I'm wondering in VHDL, there seems to be 2 ways to implement
> > detection of rising clks:
> > 1. IF (clk'EVENT) AND (clk = '1') THEN
> > 2. IF rising_edge(clk) THEN
> >
> > What is the difference in them if my VHDL supports rising_edge()?
> > Are they actually the same? If not, which is better to use?
> >
> > thanks,
> > --john
> >
> > -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> > http://www.dejanews.com/ Now offering spam-free web-based newsreading
>
> rising_edge and falling_edge is not supported by Synopsys for synthesis.
>
> --
> Regards
> Hans Lindkvist
This is the most accurate answer I found. Rising_edge() is a function to be
called from the IEEE 1164 package. It is prefered over (clk'even and clk='1')
specially when used with std_logic data types.
The reason is when you have an std_logic{U,X,0,L,Z,W,L,H,-} signal, rising_edge()
only detect a transition from (0 to 1) rather than (X to 1) or (U to 1) or etc...
so consider that when you simulate
Zade Samuel
Sr. Design Engineer
Spectrum group
Cadence Design Systems INC.
Good point Zade! I guess by using (clk'event and clk='1') one may
detect anomalies in the clock signal. But that wouldn't be very
reliable of checking for all anomalies. The main reason I use the
functions rising_edge() and falling_edge(), are that they make for
more readable code.
Tom Palermo
Sr. Design Engineer
Cincinnati Electronics
If you have a series terminated clock and the clock value is 'H',
then it won't work, will it?
--
Have you switched to Microsoft Internet Explorer 4 yet?
So-
(1) Is there some way of doing conditional compilation depending on the
synthesis tool/ So if I am using the FPGA Express tool, the synthesis
tool includes the appropriate Synopsys libraries but if I a using the
Cypress tool it includes the Cypress libraries or...
(2) Has anyone created a library entity declaring rising_edge and
falling_edge for Synopsys? How?
Garry Allen
DSP Engineer
Australian Broadcasting Corporation Technology Research and Development
Rgds,
Sam Falaki
>So-
>(1) Is there some way of doing conditional compilation depending on the
>synthesis tool/ So if I am using the FPGA Express tool, the synthesis
>tool includes the appropriate Synopsys libraries but if I a using the
>Cypress tool it includes the Cypress libraries or...
Garry, I agree with Sam, write your own function for rising_edge and
falling_edge functions. The functions are defined as events occuring
between '0' and '1'.
>2) Has anyone created a library entity declaring rising_edge and
>falling_edge for Synopsys? How?
Don't know about that, I use the packaged libraries.
We use Exemplar tools, and many of the libraries distributed with
their software were writen by other companies (including Synopsys).
They all have the typical disclaimers and "distributed without
restriction provided that this copyright statement is not removed".
Unfortunately, the standard 1164 library that defines the rising_edge
and falling_edge functions do not have any ownership attached so it is
probably covered by our software license agrrement. You might try
contacting Exemplar for a copy.
Phil Ngai wrote:
> In article <350BF4BB...@nospam.videotron.ca>,
> Sam Falaki <fal...@nospam.videotron.ca> wrote:
> >What's the big deal with using " IF clk'event AND clk = '1' " Anyways?
> >At least you know it synthesises on ALL the tools.
>
> If you have a series terminated clock and the clock value is 'H',
> then it won't work, will it?
>
Can you please elaborate with a synthesis example? I'm not sureI follow
you.
Thanks,
Sam
> Check out
> www.eda.org/swig
> The synthesis ionteroperability Working group is developing a standard
> semantics for VHDL RTL synthesis.
I run this web page. There has been ALOT of discussion about this topicthere
too. Take a look in the e-mail archives kept there.
It turns out that the next release of Synopsys, 98.08, is supposed to support
"rising_edge" and "falling_edge", according to the Synopsys hotline anyway.
--
David Bishop
INTERNET: dbi...@kodak.com | The opinions voiced are mine
US MAIL: 1194 West Ave, Hilton NY 14468 | and not my company's.
PHYSICAL: 43:17:17N 77:47:37W 281' |
The source for the IEEE 1164 package can be found on the RASSP
web page: http://rassp.scra.org. Go to the VHDL models section and
select standards packages.
>Can you please elaborate with a synthesis example? I'm not sure I follow
>you.
in std_ulogic 'H' is a weak 1, and '1' is a forcing 1. "IF clk'event
AND clk = '1' " picks up transitions that you probably don't want, ie.
'H'->'1'. your suggestion is fine for type BIT, which only has values
'0' and '1'.
if you're worried about this you should use something like
" clk'event and clk = '1' and clk'last_value = '0' ".
Phil Ngai wrote:
> Have you switched to Microsoft Internet Explorer 4 yet?
are you serious?! time for a reality check...
evan (e...@nospam.riverside-machines.com)
Which won't work if clk goes from 'L' to '1', or from '0' to 'H'...
Apply a strength reducer in the comparisons, i.e.:
clk'event and TO_X01Z(clk) = '1' and TO_X01Z(clk'last_value) = '0'
Regards,
Jonas
--
+---------------------------------------------------------------+
| Jonas Nilsson |
| HARDI Electronics AB Phone : +46-40-59 29 00 |
| Derbyvagen 6B Fax : +46-40-59 29 19 |
| SE-212 35 MALMO E-mail: jo...@hardi.se |
| SWEDEN WWW: http://www.hardi.se |
+---------------------------------------------------------------+
But... according to the latest version of the 1076.6 Draft RTL
level synthesis standard, the 'LAST_VALUE attribute is not supported
for synthesis...
> Robert H. Klenke wrote:
> >
> <my question clipped>
> > |>
> <Tom's comments clipped>
> >
> > The source for the IEEE 1164 package can be found on the RASSP
> > web page: http://rassp.scra.org. Go to the VHDL models section and
> > select standards packages.
> >
> > Bob
> Thanks for everyone's replies. I attempted to write my own library
> functions for rising_edge and falling_edge in FPGA Express (The Synopsys
> ...snip...
> implementation of the libraries and...
>
> A language extension? that would be nice is something similiar to the
> #IFDEF that C has so we could conditionally choose to include the
> appropriate libraries.
> Garry Allen
I remember that in the old days of C programming, #define and #ifdef were
handled by a preprocessor. There was actually a separate program to perform
those functions. It would take in your source with #defines and spit out
source without them. Why couldn't you use this same program to process VHDL
containing the same #ifdef functions?
Rick Collins