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 | library IEEE;
|
---|
24 | use IEEE.STD_LOGIC_1164.ALL;
|
---|
25 | use IEEE.STD_LOGIC_ARITH.ALL;
|
---|
26 | use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
---|
27 |
|
---|
28 |
|
---|
29 | library ftm_definitions;
|
---|
30 | USE ftm_definitions.ftm_array_types.all;
|
---|
31 | USE ftm_definitions.ftm_constants.all;
|
---|
32 |
|
---|
33 |
|
---|
34 |
|
---|
35 | entity single_LP is
|
---|
36 | port(
|
---|
37 |
|
---|
38 | -- Clock
|
---|
39 | -------------------------------------------------------------------------------
|
---|
40 | -- clk_50 : IN STD_LOGIC; -- 50 MHz system clock
|
---|
41 | clk_250 : IN STD_LOGIC; -- 250 MHz system clock
|
---|
42 |
|
---|
43 | -- Lightpulser
|
---|
44 | -------------------------------------------------------------------------------
|
---|
45 | LP_Pulse_out : out STD_LOGIC; --
|
---|
46 |
|
---|
47 |
|
---|
48 | -- FPGA intern signals: Lightpulser brightness
|
---|
49 | -------------------------------------------------------------------------------
|
---|
50 | -- int_LP : in std_logic_vector (1 downto 0); -- Intensity Light
|
---|
51 |
|
---|
52 | LP_pulse_in : in std_logic; -- trigger lightpulse
|
---|
53 |
|
---|
54 | LP_delay : in std_logic_vector (15 downto 0)
|
---|
55 |
|
---|
56 | );
|
---|
57 | end single_LP;
|
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|
61 | architecture Behavioral of single_LP is
|
---|
62 |
|
---|
63 |
|
---|
64 | -- type TYPE_LightPulser_STATE is (IDLE, PULSE, BLOCKED);
|
---|
65 | -- signal LightPulser_state : TYPE_LightPulser_STATE := IDLE;
|
---|
66 | -- signal LP_Pulse_sig : std_logic;
|
---|
67 |
|
---|
68 |
|
---|
69 | -- Component Declarations
|
---|
70 | component delayed_pulse is
|
---|
71 | generic(pulse_width : integer range 0 to 15);
|
---|
72 | port(clk_250MHz : in std_logic;
|
---|
73 | delay : in std_logic_vector(9 downto 0);
|
---|
74 | input : in std_logic;
|
---|
75 | output : out std_logic);
|
---|
76 | end component;
|
---|
77 |
|
---|
78 |
|
---|
79 |
|
---|
80 |
|
---|
81 |
|
---|
82 |
|
---|
83 |
|
---|
84 | begin
|
---|
85 |
|
---|
86 |
|
---|
87 |
|
---|
88 | -- pulse_witdh_LP : process(clk_50, LP_pulse_in)
|
---|
89 | -- begin
|
---|
90 | -- begin
|
---|
91 | -- if rising_edge(clk_50) then
|
---|
92 | -- case LightPulser_state is
|
---|
93 | -- when IDLE =>
|
---|
94 | -- LP_Pulse_sig <= '0';
|
---|
95 | -- if LP_pulse_in = '1' then
|
---|
96 | -- LightPulser_state <= PULSE;
|
---|
97 | -- end if
|
---|
98 | -- when PULSE =>
|
---|
99 | -- LP_Pulse_sig <= '1';
|
---|
100 | -- LightPulser_state <= BLOCKED;
|
---|
101 | -- when BLOCKED =>
|
---|
102 | -- LP_Pulse_sig <= '0';
|
---|
103 | -- if LP_pulse_in = '0' then
|
---|
104 | -- LightPulser_state <= IDLE;
|
---|
105 | -- end if
|
---|
106 | -- end case;
|
---|
107 | -- end if;
|
---|
108 | -- end process pulse_witdh_LP;
|
---|
109 |
|
---|
110 |
|
---|
111 |
|
---|
112 | inst_LP_delay: delayed_pulse
|
---|
113 | generic map(pulse_width => FLD_PULSE_LENGTH)
|
---|
114 | port map(clk_250MHz => clk_250,
|
---|
115 | delay => LP_delay(9 downto 0),
|
---|
116 | input => LP_pulse_in,
|
---|
117 | output => LP_Pulse_out);
|
---|
118 |
|
---|
119 |
|
---|
120 |
|
---|
121 |
|
---|
122 |
|
---|
123 | end Behavioral;
|
---|