Last change
on this file since 12379 was 10231, checked in by vogler, 14 years ago |
Check in Clock conditioner interface first version
|
File size:
1.2 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 | --
|
---|
10 | -- modified by Patrick Vogler
|
---|
11 | --
|
---|
12 | -- February 17 2011
|
---|
13 | --
|
---|
14 | -- September 16 2010
|
---|
15 | --
|
---|
16 | --
|
---|
17 | LIBRARY ieee;
|
---|
18 | USE ieee.std_logic_1164.all;
|
---|
19 | USE ieee.std_logic_arith.all;
|
---|
20 | USE ieee.std_logic_unsigned.all;
|
---|
21 |
|
---|
22 |
|
---|
23 | library ftm_definitions;
|
---|
24 | USE ftm_definitions.ftm_constants.all;
|
---|
25 |
|
---|
26 |
|
---|
27 |
|
---|
28 |
|
---|
29 |
|
---|
30 | ENTITY microwire_clock_gen IS
|
---|
31 | GENERIC(
|
---|
32 | CLK_DIVIDER : integer := INT_CLK_FREQUENCY_1 / MICROWIRE_CLK_FREQUENCY --2 MHz @ 50 MHz
|
---|
33 |
|
---|
34 | );
|
---|
35 | PORT(
|
---|
36 | clk : IN std_logic;
|
---|
37 | sclk : OUT std_logic := '0'
|
---|
38 | );
|
---|
39 | END microwire_clock_gen;
|
---|
40 |
|
---|
41 | ARCHITECTURE beha OF microwire_clock_gen IS
|
---|
42 |
|
---|
43 | BEGIN
|
---|
44 |
|
---|
45 | spi_clk_proc: process (clk)
|
---|
46 | variable Z: integer range 0 to clk_divider - 1;
|
---|
47 | begin
|
---|
48 | if rising_edge(clk) then
|
---|
49 | if (Z < clk_divider - 1) then
|
---|
50 | Z := Z + 1;
|
---|
51 | else
|
---|
52 | Z := 0;
|
---|
53 | end if;
|
---|
54 | if (Z = 0) then
|
---|
55 | sclk <= '1';
|
---|
56 | end if;
|
---|
57 | if (Z = clk_divider / 2) then
|
---|
58 | sclk <= '0';
|
---|
59 | end if;
|
---|
60 | end if;
|
---|
61 | end process spi_clk_proc;
|
---|
62 |
|
---|
63 | END ARCHITECTURE beha;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.