source: firmware/FTM/Lightpulser_interface/Basic_Version/FM_pulse_generator_Basic.vhd@ 11353

Last change on this file since 11353 was 10879, checked in by weitzel, 15 years ago
FTM: new light pulser interface, new timing constraint in .ucf file
File size: 2.0 KB
Line 
1-- ----------------------------------------------------------------------------
2-------------------------------------------------------------------------------
3-- FTM Light pulser interface: FM__pulse generator for feedback
4-------------------------------------------------------------------------------
5--
6--
7-- Created: May 13 2011
8-- by Patrick Vogler
9--
10-- modified: May 26 2011
11-- by Patrick Vogler
12-- "Lightpulser Basic Version"
13--
14-- modified: May 27 2011
15-- by Patrick Vogler, Quirin Weitzel
16-- -> clean up
17
18
19LIBRARY ieee;
20USE ieee.std_logic_1164.all;
21USE ieee.std_logic_arith.all;
22USE ieee.std_logic_unsigned.all;
23
24
25library ftm_definitions;
26USE ftm_definitions.ftm_constants.all;
27
28
29ENTITY FM_pulse_generator_Basic IS
30 GENERIC(
31 pulse_length : integer := FLD_PULSE_LENGTH_BASIC -- 60ns
32 );
33 PORT(
34 clk : in std_logic;
35 pulse_freq : in std_logic_vector (5 downto 0);
36 FM_out : out std_logic := '0'
37 );
38END FM_pulse_generator_Basic;
39
40ARCHITECTURE beha OF FM_pulse_generator_Basic IS
41
42BEGIN
43
44 clk_div: process (clk)
45 variable Z : integer range - FLD_MIN_FREQ_DIV_BASIC to FLD_FD_MAX_RANGE_BASIC;
46 variable Y : integer range 0 to FLD_PULSE_LENGTH_BASIC;
47 variable X : integer range 0 to FLD_FD_MULT_BASIC ;
48
49 begin
50
51 if rising_edge(clk) then
52 if (X < FLD_FD_MULT_BASIC) then
53 X := X+1;
54 else
55 X := 0;
56 if (Z < pulse_freq) then
57 Z := Z + 1;
58 else
59 Z := - FLD_MIN_FREQ_DIV_BASIC;
60 Y := 0;
61 end if;
62 end if;
63
64 if (Y < pulse_length) then
65 Y := Y + 1;
66 FM_out <= '1';
67 else
68 FM_out <= '0';
69 end if;
70
71 end if;
72 end process clk_div;
73
74END ARCHITECTURE beha;
Note: See TracBrowser for help on using the repository browser.