Complete the code to declare the clock input signal.
entity timer is
Port (
[1] : in std_logic;
reset : in std_logic;
terminal_count : out std_logic
);
end timer;The clock input signal is commonly named clock in VHDL entities.
Complete the code to define the counter signal as a 4-bit unsigned type.
architecture Behavioral of timer is signal counter : [1](3 downto 0) := (others => '0'); begin -- process here end Behavioral;
The unsigned type from the numeric_std package is used for arithmetic on bit vectors representing numbers.
Fix the error in the process sensitivity list to include the clock signal.
process([1], reset) begin if reset = '1' then counter <= (others => '0'); elsif rising_edge(clock) then -- counter logic end if; end process;
The sensitivity list must include the clock signal named clock to detect rising edges properly.
Fill both blanks to complete the terminal count logic and counter increment.
process(clock, reset) begin if reset = '1' then counter <= (others => '0'); terminal_count <= '0'; elsif rising_edge(clock) then if counter = [1] then terminal_count <= '1'; counter <= (others => '0'); else counter <= counter [2] 1; terminal_count <= '0'; end if; end if; end process;
The terminal count is 15 for a 4-bit counter. The counter increments by 1 using the + operator.
Fill all three blanks to complete the output assignment and counter reset logic.
process(clock, reset) begin if reset = '1' then counter <= (others => '0'); terminal_count <= '0'; elsif rising_edge(clock) then if counter = [1] then terminal_count <= [2]; counter <= [3]; else counter <= counter + 1; terminal_count <= '0'; end if; end if; end process;
The terminal count is 15, terminal_count output is set to '1', and the counter resets to all zeros.
