- Timestamp:
- 05/10/11 08:52:40 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
firmware/FTM/Clock_cond_interface/Clock_cond_interface.vhd
r10260 r10639 20 20 -- modifications: February 21 2011 by Patrick Vogler 21 21 -- March 23 2011 by Patrick Vogler 22 -- May 03 2011 by Patrick Vogler and Quirin Weitzel 22 23 ---------------------------------------------------------------------------------- 23 24 … … 37 38 38 39 39 40 40 entity Clock_cond_interface is 41 41 port( 42 43 42 44 -- Clock45 -------------------------------------------------------------------------------46 clk : IN STD_LOGIC; -- 50 MHz system clock47 48 49 -- Clock conditioner LMK0300050 -------------------------------------------------------------------------------51 CLK_Clk_Cond : out STD_LOGIC; -- clock conditioner MICROWIRE interface clock52 LE_Clk_Cond : out STD_LOGIC; -- clock conditioner MICROWIRE interface latch enable53 DATA_Clk_Cond : out STD_LOGIC; -- clock conditioner MICROWIRE interface data54 55 SYNC_Clk_Cond : out STD_LOGIC; -- clock conditioner global clock synchronization56 LD_Clk_Cond : in STD_LOGIC; -- clock conditioner lock detect57 58 59 -- Time Marker60 -------------------------------------------------------------------------------61 TIM_Sel : out STD_LOGIC;-- Time Marker selector43 -- Clock 44 ------------------------------------------------------------------------------- 45 clk : IN STD_LOGIC; -- 50 MHz system clock 46 47 48 -- Clock conditioner LMK03000 49 ------------------------------------------------------------------------------- 50 CLK_Clk_Cond : out STD_LOGIC; -- clock conditioner MICROWIRE interface clock 51 LE_Clk_Cond : out STD_LOGIC; -- clock conditioner MICROWIRE interface latch enable 52 DATA_Clk_Cond : out STD_LOGIC; -- clock conditioner MICROWIRE interface data 53 54 SYNC_Clk_Cond : out STD_LOGIC; -- clock conditioner global clock synchronization 55 LD_Clk_Cond : in STD_LOGIC; -- clock conditioner lock detect 56 57 58 -- Time Marker 59 ------------------------------------------------------------------------------- 60 TIM_Sel : out STD_LOGIC; -- Time Marker selector 62 61 -- 1 = time marker from Clock conditioner 63 62 -- for DRS timing calibration … … 67 66 68 67 69 70 -- FPGA intern clock conditioner configuration data 71 ------------------------------------------------------------------------------- 72 cc_R0 : in std_logic_vector (31 downto 0) := (others => '0'); 73 cc_R1 : in std_logic_vector (31 downto 0) := (others => '0'); 74 cc_R8 : in std_logic_vector (31 downto 0) := (others => '0'); 75 cc_R9 : in std_logic_vector (31 downto 0) := (others => '0'); 76 cc_R11 : in std_logic_vector (31 downto 0) := (others => '0'); 77 cc_R13 : in std_logic_vector (31 downto 0) := (others => '0'); 78 cc_R14 : in std_logic_vector (31 downto 0) := (others => '0'); 79 cc_R15 : in std_logic_vector (31 downto 0) := (others => '0'); 80 81 82 83 84 -- FPGA intern control signals 85 ------------------------------------------------------------------------------- 86 start_config : in STD_LOGIC; -- load new configuration into the clock 68 -- FPGA intern clock conditioner configuration data 69 ------------------------------------------------------------------------------- 70 cc_R0 : in std_logic_vector (31 downto 0) := (others => '0'); 71 cc_R1 : in std_logic_vector (31 downto 0) := (others => '0'); 72 cc_R8 : in std_logic_vector (31 downto 0) := (others => '0'); 73 cc_R9 : in std_logic_vector (31 downto 0) := (others => '0'); 74 cc_R11 : in std_logic_vector (31 downto 0) := (others => '0'); 75 cc_R13 : in std_logic_vector (31 downto 0) := (others => '0'); 76 cc_R14 : in std_logic_vector (31 downto 0) := (others => '0'); 77 cc_R15 : in std_logic_vector (31 downto 0) := (others => '0'); 78 79 80 -- FPGA intern control signals 81 ------------------------------------------------------------------------------- 82 start_config : in STD_LOGIC; -- load new configuration into the clock 87 83 -- conditioner 88 84 89 config_started : out STD_LOGIC;-- indicates that the new configuration85 config_started : out STD_LOGIC; -- indicates that the new configuration 90 86 -- is currently loaded into the clock conditioner 91 87 92 config_done : out STD_LOGIC;-- indicates that the configuration has88 config_done : out STD_LOGIC; -- indicates that the configuration has 93 89 -- been loaded and the clock conditioners 94 90 -- PLL is locked 95 91 96 timemarker_select: in STD_LOGIC-- selects time marker source92 timemarker_select: in STD_LOGIC -- selects time marker source 97 93 -- 98 94 -- 1 = time marker from Clock conditioner … … 106 102 107 103 108 109 110 104 architecture Behavioral of Clock_cond_interface is 111 105 112 106 113 component microwire_interface IS114 PORT(107 component microwire_interface IS 108 PORT( 115 109 clk : IN std_logic; 116 110 clk_uwire : OUT std_logic; --- IN or OUT ? … … 121 115 config_ready : OUT std_logic; 122 116 config_started : OUT std_logic 123 ); 124 end component; 125 126 117 ); 118 end component; 127 119 128 120 129 121 signal clk_50M_sig : STD_LOGIC; -- system clock 130 --signal start_config_sig : STD_LOGIC;122 --signal start_config_sig : STD_LOGIC; 131 123 132 124 signal config_ready_sig : STD_LOGIC; … … 154 146 signal cc_R15_sig : std_logic_vector (31 downto 0); 155 147 156 148 signal timemarker_select_sig : std_logic := '0'; 149 150 type TIM_SEL_STATE_TYPE is (IDLE, CONFIG); 151 signal tim_sel_state : TIM_SEL_STATE_TYPE := IDLE; 157 152 158 153 … … 173 168 config_ready => config_ready_sig, 174 169 config_started => config_started_sig 175 170 ); 176 171 177 172 178 173 179 config_done <= config_ready_sig; -- indicates that the configuration174 --config_done <= config_ready_sig; -- indicates that the configuration 180 175 -- has been loaded 181 176 182 177 183 178 184 --config_done <= (config_ready_sig AND LD_Clk_Cond); -- indicates that the configuration179 config_done <= (config_ready_sig AND LD_Clk_Cond); -- indicates that the configuration 185 180 -- has been loaded and 186 181 -- the PLL is locked again … … 188 183 189 184 190 TIM_Sel <= timemarker_select; 185 --TIM_Sel <= timemarker_select; 186 187 TIM_Sel <= timemarker_select_sig; 188 189 tim_sel_proc : process (clk_uwire_sig) 190 begin 191 if rising_edge(clk_uwire_sig) then 192 case tim_sel_state is 193 when IDLE => 194 if start_config = '1' then 195 timemarker_select_sig <= '0'; 196 tim_sel_state <= CONFIG; 197 end if; 198 when CONFIG => 199 if config_ready_sig = '1' then 200 timemarker_select_sig <= timemarker_select; 201 tim_sel_state <= IDLE; 202 end if; 203 end case; 204 end if; 205 end process tim_sel_proc; 206 207 191 208 CLK_Clk_Cond <= clk_uwire_sig; 192 209 193 210 clk_50M_sig <= clk; 194 -- start_config_sig <= start_config; 195 196 -- start_config <= start_config_sig; 197 198 211 212 -- start_config_sig <= start_config; 213 -- start_config <= start_config_sig; 199 214 config_started <= config_started_sig; 200 215 … … 233 248 clk_cond_array_sig(14) <= cc_R15_sig; 234 249 235 236 250 end Behavioral; 237 238
Note:
See TracChangeset
for help on using the changeset viewer.