source: firmware/FTU/test_firmware/FTU_test5/FTU_test5_spi_clock_gen.vhd@ 18066

Last change on this file since 18066 was 268, checked in by qweitzel, 14 years ago
FTU_test5 added
File size: 1.0 KB
Line 
1--
2-- VHDL Architecture FACT_FAD_lib.spi_clock_generator.beha
3--
4-- Created:
5-- by - Benjamin Krumm.UNKNOWN (EEPC8)
6-- at - 14:49:19 01.04.2010
7--
8-- using Mentor Graphics HDL Designer(TM) 2009.1 (Build 12)
9--
10LIBRARY ieee;
11USE ieee.std_logic_1164.all;
12USE ieee.std_logic_arith.all;
13USE ieee.std_logic_unsigned.all;
14
15ENTITY FTU_test5_spi_clock_generator IS
16 GENERIC(
17 CLK_DIVIDER : integer := 25 --2 MHz @ 50 MHz
18 );
19 PORT(
20 clk : IN std_logic;
21 sclk : OUT std_logic := '0'
22 );
23END FTU_test5_spi_clock_generator;
24
25ARCHITECTURE beha OF FTU_test5_spi_clock_generator IS
26
27BEGIN
28
29 spi_clk_proc: process (clk)
30 variable Z: integer range 0 to clk_divider - 1;
31 begin
32 if rising_edge(clk) then
33 if (Z < clk_divider - 1) then
34 Z := Z + 1;
35 else
36 Z := 0;
37 end if;
38 if (Z = 0) then
39 sclk <= '1';
40 end if;
41 if (Z = clk_divider / 2) then
42 sclk <= '0';
43 end if;
44 end if;
45 end process spi_clk_proc;
46
47END ARCHITECTURE beha;
Note: See TracBrowser for help on using the repository browser.