-- -- 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 -- 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_test3; USE FTM_definitions_test3.ftm_array_types.all; ENTITY FTM_test3_microwire_clock_gen IS GENERIC( CLK_DIVIDER : integer := 125 --2 MHz @ 250 MHz ); PORT( clk : IN std_logic; sclk : OUT std_logic := '0' ); END FTM_test3_microwire_clock_gen; ARCHITECTURE beha OF FTM_test3_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;