-- -- VHDL Architecture FACT_FAD_lib.spi_clock_generator.beha -- -- Created: -- by - Benjamin Krumm.UNKNOWN (EEPC8) -- at - 14:49:19 01.04.2010 -- -- using Mentor Graphics HDL Designer(TM) 2009.1 (Build 12) -- -- modified by Patrick Vogler -- -- February 17 2011 -- -- September 16 2010 -- -- LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; USE ieee.std_logic_unsigned.all; library ftm_definitions; USE ftm_definitions.ftm_constants.all; ENTITY microwire_clock_gen IS GENERIC( CLK_DIVIDER : integer := INT_CLK_FREQUENCY_1 / MICROWIRE_CLK_FREQUENCY --2 MHz @ 50 MHz ); PORT( clk : IN std_logic; sclk : OUT std_logic := '0' ); END microwire_clock_gen; ARCHITECTURE beha OF microwire_clock_gen IS BEGIN spi_clk_proc: process (clk) variable Z: integer range 0 to clk_divider - 1; begin if rising_edge(clk) then if (Z < clk_divider - 1) then Z := Z + 1; else Z := 0; end if; if (Z = 0) then sclk <= '1'; end if; if (Z = clk_divider / 2) then sclk <= '0'; end if; end if; end process spi_clk_proc; END ARCHITECTURE beha;