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 | -- modified by Patrick Vogler
|
---|
11 | -- September 16 2010
|
---|
12 | --
|
---|
13 | --
|
---|
14 | LIBRARY ieee;
|
---|
15 | USE ieee.std_logic_1164.all;
|
---|
16 | USE ieee.std_logic_arith.all;
|
---|
17 | USE ieee.std_logic_unsigned.all;
|
---|
18 |
|
---|
19 |
|
---|
20 | library FTM_definitions_test3;
|
---|
21 | USE FTM_definitions_test3.ftm_array_types.all;
|
---|
22 |
|
---|
23 |
|
---|
24 |
|
---|
25 |
|
---|
26 | ENTITY FTM_test3_microwire_clock_gen IS
|
---|
27 | GENERIC(
|
---|
28 | CLK_DIVIDER : integer := 125 --2 MHz @ 250 MHz
|
---|
29 | );
|
---|
30 | PORT(
|
---|
31 | clk : IN std_logic;
|
---|
32 | sclk : OUT std_logic := '0'
|
---|
33 | );
|
---|
34 | END FTM_test3_microwire_clock_gen;
|
---|
35 |
|
---|
36 | ARCHITECTURE beha OF FTM_test3_microwire_clock_gen IS
|
---|
37 |
|
---|
38 | BEGIN
|
---|
39 |
|
---|
40 | spi_clk_proc: process (clk)
|
---|
41 | variable Z: integer range 0 to clk_divider - 1;
|
---|
42 | begin
|
---|
43 | if rising_edge(clk) then
|
---|
44 | if (Z < clk_divider - 1) then
|
---|
45 | Z := Z + 1;
|
---|
46 | else
|
---|
47 | Z := 0;
|
---|
48 | end if;
|
---|
49 | if (Z = 0) then
|
---|
50 | sclk <= '1';
|
---|
51 | end if;
|
---|
52 | if (Z = clk_divider / 2) then
|
---|
53 | sclk <= '0';
|
---|
54 | end if;
|
---|
55 | end if;
|
---|
56 | end process spi_clk_proc;
|
---|
57 |
|
---|
58 | END ARCHITECTURE beha;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.