1 | ----------------------------------------------------------------------------------
|
---|
2 | -- Company: ETH Zurich, Institute for Particle Physics
|
---|
3 | -- Engineer: Patrick Vogler
|
---|
4 | --
|
---|
5 | -- Create Date: March 2 2010
|
---|
6 | -- Design Name:
|
---|
7 | -- Module Name: FTM Lightpulser interface: single lightpulser
|
---|
8 | -- Project Name:
|
---|
9 | -- Target Devices:
|
---|
10 | -- Tool versions:
|
---|
11 | -- Description: generates the signals to control a single lightpulser
|
---|
12 | --
|
---|
13 | -- Dependencies:
|
---|
14 | --
|
---|
15 | -- Revision:
|
---|
16 | -- Revision 0.01 - File Created
|
---|
17 | -- Additional Comments:
|
---|
18 | --
|
---|
19 | --
|
---|
20 | -- modifications:
|
---|
21 | --
|
---|
22 | --
|
---|
23 | --
|
---|
24 | -- modified: May 26 2011
|
---|
25 | -- by Patrick Vogler
|
---|
26 | -- "Lightpulser Basic Version"
|
---|
27 | --
|
---|
28 | -- modified: May 27 2011
|
---|
29 | -- by Patrick Vogler
|
---|
30 | --
|
---|
31 | -- modified: May 27 2011
|
---|
32 | -- by Patrick Vogler, Quirin Weitzel
|
---|
33 | -- -> clean up
|
---|
34 | ----------------------------------------------------------------------------------
|
---|
35 | ----------------------------------------------------------------------------------
|
---|
36 |
|
---|
37 | library IEEE;
|
---|
38 | use IEEE.STD_LOGIC_1164.ALL;
|
---|
39 | use IEEE.STD_LOGIC_ARITH.ALL;
|
---|
40 | use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
---|
41 |
|
---|
42 |
|
---|
43 | library ftm_definitions;
|
---|
44 | USE ftm_definitions.ftm_array_types.all;
|
---|
45 | USE ftm_definitions.ftm_constants.all;
|
---|
46 |
|
---|
47 |
|
---|
48 |
|
---|
49 | entity single_LP_Basic is
|
---|
50 | port(
|
---|
51 |
|
---|
52 | -- Clock
|
---|
53 | -------------------------------------------------------------------------------
|
---|
54 | clk_50 : IN STD_LOGIC; -- 50 MHz system clock
|
---|
55 | -- clk_250 : IN STD_LOGIC; -- 250 MHz system clock
|
---|
56 |
|
---|
57 | -- Lightpulser
|
---|
58 | -------------------------------------------------------------------------------
|
---|
59 | LP_Pulse_out : out STD_LOGIC :='0'; --
|
---|
60 |
|
---|
61 |
|
---|
62 | -- FPGA intern signals: Lightpulser brightness
|
---|
63 | -------------------------------------------------------------------------------
|
---|
64 | LP_pulse_in : in std_logic -- trigger lightpulse
|
---|
65 |
|
---|
66 | -- LP_delay : in std_logic_vector (15 downto 0)
|
---|
67 | );
|
---|
68 | end single_LP_Basic;
|
---|
69 |
|
---|
70 | architecture Behavioral of single_LP_Basic is
|
---|
71 |
|
---|
72 | signal LP_in_prev : STD_LOGIC := '0';
|
---|
73 | signal Pulse_Flag : STD_LOGIC := '0';
|
---|
74 |
|
---|
75 | begin
|
---|
76 |
|
---|
77 | single_LP_Basic_proc: process (clk_50)
|
---|
78 |
|
---|
79 | variable Y : integer range 0 to FLD_PULSE_LENGTH_BASIC;
|
---|
80 |
|
---|
81 | begin
|
---|
82 |
|
---|
83 | if rising_edge(clk_50) then
|
---|
84 | LP_in_prev <= LP_pulse_in;
|
---|
85 |
|
---|
86 | if ((LP_pulse_in = '1') and (LP_in_prev = '0')) then
|
---|
87 | Pulse_Flag <= '1';
|
---|
88 | end if;
|
---|
89 |
|
---|
90 | if (Pulse_Flag = '1') then
|
---|
91 | if (Y < FLD_PULSE_LENGTH_BASIC) then
|
---|
92 | Y := Y + 1;
|
---|
93 | LP_Pulse_out <= '1';
|
---|
94 | else
|
---|
95 | Y := 0;
|
---|
96 | LP_Pulse_out <= '0';
|
---|
97 | Pulse_Flag <= '0';
|
---|
98 | end if;
|
---|
99 | end if;
|
---|
100 |
|
---|
101 | end if;
|
---|
102 |
|
---|
103 | end process single_LP_Basic_proc;
|
---|
104 |
|
---|
105 | end Behavioral;
|
---|