library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; --this component acts as an external timer for the microblaze processor. --It will generate a steady pulse train of interrupts at a specified rate. entity timer is Port ( clock_i : in STD_LOGIC; reset_i : in STD_LOGIC; interrupt_o : out STD_LOGIC); end timer; architecture Behavioral of timer is begin process(clock_i) variable count : integer := 0; variable interrupt : std_logic := '0'; constant LIMIT : integer := 25000; --1 millisecond for a MicroBlaze at 25 MHz begin if (clock_i='1' and clock_i'event) then if (reset_i = '1') then count := 0; interrupt := '0'; else if (count = LIMIT) then interrupt := '1'; count := 0; else interrupt := '0'; count := count + 1; end if; end if; interrupt_o <= interrupt; end if; end process; end Behavioral;