Complete the code to declare the clock input port.
entity DFF is
Port (
clk : [1];
D : in std_logic;
Q : out std_logic
);
end DFF;The clock input must be declared as in std_logic to receive the clock signal.
Complete the process sensitivity list to trigger on clock's rising edge.
architecture Behavioral of DFF is begin process([1]) begin if rising_edge(clk) then Q <= D; end if; end process; end Behavioral;
The process must be sensitive to the clock signal clk to detect edges.
Fix the error in the synchronous reset condition inside the process.
architecture Behavioral of DFF is
begin
process(clk)
begin
if rising_edge(clk) then
if [1] = '1' then
Q <= '0';
else
Q <= D;
end if;
end if;
end process;
end Behavioral;The synchronous reset signal is usually named reset and checked inside the clock edge condition.
Fill both blanks to declare the reset input and add it to the sensitivity list.
entity DFF is
Port (
clk : in std_logic;
[1] : in std_logic;
D : in std_logic;
Q : out std_logic
);
end DFF;
architecture Behavioral of DFF is
begin
process([2], clk)
begin
if rising_edge(clk) then
if reset = '1' then
Q <= '0';
else
Q <= D;
end if;
end if;
end process;
end Behavioral;The reset input is declared as reset and added to the sensitivity list to detect changes.
Fill all three blanks to complete the synchronous reset D flip-flop process.
architecture Behavioral of DFF is begin process([1], clk) begin if rising_edge(clk) then if [2] = '1' then Q <= [3]; else Q <= D; end if; end if; end process; end Behavioral;
The process sensitivity list includes clk. The reset signal is checked for '1' and Q is set to '0' on reset.
