source: firmware/FTM/Clock_cond_interface/microwire_clock_gen.vhd@ 15612

Last change on this file since 15612 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--
17LIBRARY ieee;
18USE ieee.std_logic_1164.all;
19USE ieee.std_logic_arith.all;
20USE ieee.std_logic_unsigned.all;
21
22
23library ftm_definitions;
24USE ftm_definitions.ftm_constants.all;
25
26
27
28
29
30ENTITY 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 );
39END microwire_clock_gen;
40
41ARCHITECTURE beha OF microwire_clock_gen IS
42
43BEGIN
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
63END ARCHITECTURE beha;
Note: See TracBrowser for help on using the repository browser.