On 28 Mar 2007 16:01:34 -0700,
[email protected] wrote:
>How can I implement this behaviour in a synthesizable form?
>
> IF async_clr = '1' OR RISING_EDGE(clr) THEN
> bit <= '0';
> ELSIF RISING_EDGE(set) THEN
> bit <= '1'
> END IF;
Standard answer, that works in all reasonable tools and
technologies: use a Flancter... three processes, I'm afraid.
NOTE VERY CAREFULLY that the result signal is asynchronous
to any of your clocks, because it's set in one clock domain and
unset in another. So it may need to be resynchronised
before it can be used.
--- clr_ff and set_ff are the edge detecting flip-flops.
--- set_clr_bit is your desired flag.
signal clr_ff, set_ff, set_clr_bit: std_logic;
clr_ff_p: process (clr, async_clr)
begin
if async_clr = '1' then
clr_ff <= '0';
elsif rising_edge(clr) then
clr_ff <= set_ff;
end if;
end process;
set_ff_p: process (set, async_clr)
begin
if async_clr = '1' then
set_ff <= '0';
elsif rising_edge(set) then
set_ff <= not clr_ff;
end if;
end process;
flancter: set_clr_bit <= clr_ff xor set_ff;
Thanks again to Bob Weinstein...
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
[email protected]
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.