source: firmware/FTM/test_firmware/FTM_test3/FTM_test3_microwire_clock_gen.vhd@ 13449

Last change on this file since 13449 was 10046, checked in by vogler, 14 years ago
Test firmware for FTM hardware testing
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-- September 16 2010
12--
13--
14LIBRARY ieee;
15USE ieee.std_logic_1164.all;
16USE ieee.std_logic_arith.all;
17USE ieee.std_logic_unsigned.all;
18
19
20library FTM_definitions_test3;
21USE FTM_definitions_test3.ftm_array_types.all;
22
23
24
25
26ENTITY 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 );
34END FTM_test3_microwire_clock_gen;
35
36ARCHITECTURE beha OF FTM_test3_microwire_clock_gen IS
37
38BEGIN
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
58END ARCHITECTURE beha;
Note: See TracBrowser for help on using the repository browser.