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 | --
|
---|
10 | LIBRARY ieee;
|
---|
11 | USE ieee.std_logic_1164.all;
|
---|
12 | USE ieee.std_logic_arith.all;
|
---|
13 | USE ieee.std_logic_unsigned.all;
|
---|
14 |
|
---|
15 | ENTITY FTU_test2_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 | );
|
---|
23 | END FTU_test2_spi_clock_generator;
|
---|
24 |
|
---|
25 | ARCHITECTURE beha OF FTU_test2_spi_clock_generator IS
|
---|
26 |
|
---|
27 | BEGIN
|
---|
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 |
|
---|
47 | END ARCHITECTURE beha;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.