Architecture behavioral of dff is
begin
process ( clock )
begin
if ( clock = '1' and clock'event ) then
end if;
end process;
end behavioural;
Master-Slave Flip-Flop
Architecture behavioral of dff is
begin
Master: process ( p1_clock )
begin
if ( p1_clock = '1' and p1_clock'event
) then
end if;
end process;
Slave : process ( p2_clock )
begin
if ( p2_clock = '1' and p2_clock'event
) then
end if;
end process;
end behavioural;
Level Sensitive Latch
Architecture behavioral of dff is
begin
process ( p1_clock, p2_clock, scan_clock
)
begin
Scan : if ( p1_clock = '1' ) then
end if;
Master : if ( p1_clock = '1' ) then
end if;
Slave : if ( p1_clock = '1' ) then
end if;
end behavioural;
Incomplete Specification Problem
if ( enable = '1' ) then
q <= data_in;
-- elsif
-- q <= 'Z';
end if;
We've Seen This Construct Infer Control Logic and
a Latch
Which Is It? We Sometimes Hope For One and Get The Other.
First Notice Most Statements That Have More Than One Outcome
Must Specify What Happens For All Possible Outcomes Through The others
Keyword.
But Not the if Statement.
By Incompletely Specifying What Happens For Other
Values of enable We are
Specifying That Q Holds It's Value and That Infers
a Latch Where None was Intended.
Asynchronous Set/Reset
Architecture behavioral of dff is
begin
process ( set, clock )
begin
if ( set = '1' ) then q <= '1';
elsif ( clock = '1' and clock'event ) then
end if;
end process;
end behavioural;
Synchronous Set/Reset
Architecture behavioral of dff is
begin
process ( clock )
begin
if ( clock = '1' and clock'event )
if ( set = '1' ) then q <= '1';
elsif then
end if;
end process;
end behavioural;