*

index_counter.vhd


--------------------------------------------------------------------------

-- FILENAME : index_counter.vhd
--
-- Count the number of INDEX pulses (the number of disk revolutions). The
-- output is used as a timeout when searching for a particular sector.
--
-- AUTHOR : Craig Dunn
-- DATE STARTED : 30 December 2003
-- TAB SETTING : 4
-- RESET : None
-- CLOCK : INDEX
-- KNOWN BUGS : None
-- VERSION : 1.0
--
-- All of the design and code in this module is my own work. No design or
-- code has been borrowed or copied from any source.
--------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity index_counter is
Port ( INDEX : in std_logic;
COUNT : out std_logic_vector(3 downto 0)
);
end index_counter;

architecture index_counter_arch of index_counter is
signal sig_count : std_logic_vector(3 downto 0);
begin

COUNT <= sig_count;

main : process(INDEX)
begin
if rising_edge(INDEX) then
if sig_count < "1111" then
sig_count <= sig_count + '1';
else
sig_count <= (others => '0');
end if;
end if;
end process main;

end index_counter_arch;


BackHome