70 likes | 292 Views
Edge-Triggered D Flip-Flops. Discussion D4.2 Example 26. Edge-triggered D Flip-flop. -- Example 26: Edge-triggered D flip-flop library IEEE; use IEEE.STD_LOGIC_1164. all ; entity flipflop is port ( clk : in STD_LOGIC; D : in STD_LOGIC; q : out STD_LOGIC;
E N D
Edge-Triggered D Flip-Flops Discussion D4.2 Example 26
-- Example 26: Edge-triggered D flip-flop library IEEE; use IEEE.STD_LOGIC_1164.all; entity flipflop is port( clk : in STD_LOGIC; D : in STD_LOGIC; q : out STD_LOGIC; notq : out STD_LOGIC ); end flipflop; architecture flipflop of flipflop is signal f1,f2,f3,f4,f5,f6: STD_LOGIC; begin f1 <= not(f4 and f2); f2 <= not(f1 and f5); f3 <= not(f6 and f4); f4 <= not(f3 and clk); f5 <= not(f4 and clk and f6); f6 <= not(f5 and D); q <= f1; notq <= f2; end flipflop;
-- Example 26: ED flip-flop with clr and set library IEEE; use IEEE.STD_LOGIC_1164.all; entity flipflopcs is port( clk : in STD_LOGIC; D : in STD_LOGIC; set : in STD_LOGIC; clr : in STD_LOGIC; q : out STD_LOGIC; notq : out STD_LOGIC ); end flipflopcs; architecture flipflopcs of flipflopcs is signal f1,f2,f3,f4,f5,f6: STD_LOGIC; begin f1 <= not(f4 and f2 andnot set); f2 <= not(f1 and f5 andnot clr); f3 <= not(f6 and f4 andnot set); f4 <= not(f3 and clk andnot clr); f5 <= not(f4 and clk and f6 andnot set); f6 <= not(f5 and D andnot clr); q <= f1; notq <= f2; end flipflopcs;