@@ -518,7 +518,7 BEGIN -- beh | |||||
518 | pirq_ms => 6, |
|
518 | pirq_ms => 6, | |
519 | pirq_wfp => 14, |
|
519 | pirq_wfp => 14, | |
520 | hindex => 2, |
|
520 | hindex => 2, | |
521 |
top_lfr_version => X"00013 |
|
521 | top_lfr_version => X"000135") -- aa.bb.cc version | |
522 | PORT MAP ( |
|
522 | PORT MAP ( | |
523 | clk => clk_25, |
|
523 | clk => clk_25, | |
524 | rstn => LFR_rstn, |
|
524 | rstn => LFR_rstn, | |
@@ -583,7 +583,7 BEGIN -- beh | |||||
583 |
|
583 | |||
584 | sample_hk <= "0001000100010001" WHEN HK_SEL = "00" ELSE |
|
584 | sample_hk <= "0001000100010001" WHEN HK_SEL = "00" ELSE | |
585 | "0010001000100010" WHEN HK_SEL = "10" ELSE |
|
585 | "0010001000100010" WHEN HK_SEL = "10" ELSE | |
586 |
"0100010001000100" WHEN HK_SEL = "1 |
|
586 | "0100010001000100" WHEN HK_SEL = "11" ELSE | |
587 | (OTHERS => '0'); |
|
587 | (OTHERS => '0'); | |
588 |
|
588 | |||
589 |
|
589 |
@@ -26,6 +26,8 USE ieee.std_logic_1164.ALL; | |||||
26 |
|
26 | |||
27 | PACKAGE data_type_pkg IS |
|
27 | PACKAGE data_type_pkg IS | |
28 |
|
28 | |||
|
29 | TYPE array_integer IS ARRAY (NATURAL RANGE <>) OF INTEGER; | |||
|
30 | ||||
29 |
|
|
31 | TYPE sample_vector IS ARRAY(NATURAL RANGE <>, NATURAL RANGE <>) OF STD_LOGIC; | |
30 |
|
32 | |||
31 | END data_type_pkg; |
|
33 | END data_type_pkg; |
@@ -127,6 +127,7 BEGIN | |||||
127 | LFR_soft_rstn <= NOT r.LFR_soft_reset; |
|
127 | LFR_soft_rstn <= NOT r.LFR_soft_reset; | |
128 |
|
128 | |||
129 | PROCESS(resetn, clk25MHz) |
|
129 | PROCESS(resetn, clk25MHz) | |
|
130 | VARIABLE paddr : STD_LOGIC_VECTOR(7 DOWNTO 2); | |||
130 | BEGIN |
|
131 | BEGIN | |
131 |
|
132 | |||
132 | IF resetn = '0' THEN |
|
133 | IF resetn = '0' THEN | |
@@ -161,36 +162,19 BEGIN | |||||
161 | soft_reset <= '0'; |
|
162 | soft_reset <= '0'; | |
162 | END IF; |
|
163 | END IF; | |
163 |
|
164 | |||
164 | --APB Write OP |
|
165 | paddr := "000000"; | |
165 | IF (apbi.psel(pindex) AND apbi.penable AND apbi.pwrite) = '1' THEN |
|
166 | paddr(7 DOWNTO 2) := apbi.paddr(7 DOWNTO 2); | |
166 | CASE apbi.paddr(7 DOWNTO 2) IS |
|
167 | Rdata <= (OTHERS => '0'); | |
167 | WHEN ADDR_LFR_MANAGMENT_CONTROL => |
|
|||
168 | r.ctrl <= apbi.pwdata(0); |
|
|||
169 | r.soft_reset <= apbi.pwdata(1); |
|
|||
170 | r.LFR_soft_reset <= apbi.pwdata(2); |
|
|||
171 | WHEN ADDR_LFR_MANAGMENT_TIME_LOAD => |
|
|||
172 | r.coarse_time_load <= apbi.pwdata(30 DOWNTO 0); |
|
|||
173 | coarsetime_reg_updated <= '1'; |
|
|||
174 | WHEN OTHERS => |
|
|||
175 | NULL; |
|
|||
176 | END CASE; |
|
|||
177 | ELSE |
|
|||
178 | IF r.ctrl = '1' THEN |
|
|||
179 | r.ctrl <= '0'; |
|
|||
180 | END if; |
|
|||
181 | IF r.soft_reset = '1' THEN |
|
|||
182 | r.soft_reset <= '0'; |
|
|||
183 | END if; |
|
|||
184 | END IF; |
|
|||
185 |
|
168 | |||
|
169 | ||||
|
170 | IF apbi.psel(pindex) = '1' THEN | |||
186 | --APB READ OP |
|
171 | --APB READ OP | |
187 | IF (apbi.psel(pindex) AND (NOT apbi.pwrite)) = '1' THEN |
|
172 | CASE paddr(7 DOWNTO 2) IS | |
188 | CASE apbi.paddr(7 DOWNTO 2) IS |
|
|||
189 | WHEN ADDR_LFR_MANAGMENT_CONTROL => |
|
173 | WHEN ADDR_LFR_MANAGMENT_CONTROL => | |
190 |
Rdata(0) |
|
174 | Rdata(0) <= r.ctrl; | |
191 |
Rdata(1) |
|
175 | Rdata(1) <= r.soft_reset; | |
192 |
Rdata(2) |
|
176 | Rdata(2) <= r.LFR_soft_reset; | |
193 |
Rdata(31 DOWNTO 3) |
|
177 | Rdata(31 DOWNTO 3) <= (OTHERS => '0'); | |
194 | WHEN ADDR_LFR_MANAGMENT_TIME_LOAD => |
|
178 | WHEN ADDR_LFR_MANAGMENT_TIME_LOAD => | |
195 |
Rdata(30 DOWNTO 0) |
|
179 | Rdata(30 DOWNTO 0) <= r.coarse_time_load(30 DOWNTO 0); | |
196 | WHEN ADDR_LFR_MANAGMENT_TIME_COARSE => |
|
180 | WHEN ADDR_LFR_MANAGMENT_TIME_COARSE => | |
@@ -208,8 +192,31 BEGIN | |||||
208 | Rdata(31 DOWNTO 16) <= (OTHERS => '0'); |
|
192 | Rdata(31 DOWNTO 16) <= (OTHERS => '0'); | |
209 | Rdata(15 DOWNTO 0) <= r.HK_temp_2; |
|
193 | Rdata(15 DOWNTO 0) <= r.HK_temp_2; | |
210 | WHEN OTHERS => |
|
194 | WHEN OTHERS => | |
211 |
Rdata(31 DOWNTO 0) |
|
195 | Rdata(31 DOWNTO 0) <= (OTHERS => '0'); | |
212 | END CASE; |
|
196 | END CASE; | |
|
197 | ||||
|
198 | --APB Write OP | |||
|
199 | IF (apbi.pwrite AND apbi.penable) = '1' THEN | |||
|
200 | CASE paddr(7 DOWNTO 2) IS | |||
|
201 | WHEN ADDR_LFR_MANAGMENT_CONTROL => | |||
|
202 | r.ctrl <= apbi.pwdata(0); | |||
|
203 | r.soft_reset <= apbi.pwdata(1); | |||
|
204 | r.LFR_soft_reset <= apbi.pwdata(2); | |||
|
205 | WHEN ADDR_LFR_MANAGMENT_TIME_LOAD => | |||
|
206 | r.coarse_time_load <= apbi.pwdata(30 DOWNTO 0); | |||
|
207 | coarsetime_reg_updated <= '1'; | |||
|
208 | WHEN OTHERS => | |||
|
209 | NULL; | |||
|
210 | END CASE; | |||
|
211 | ELSE | |||
|
212 | IF r.ctrl = '1' THEN | |||
|
213 | r.ctrl <= '0'; | |||
|
214 | END IF; | |||
|
215 | IF r.soft_reset = '1' THEN | |||
|
216 | r.soft_reset <= '0'; | |||
|
217 | END IF; | |||
|
218 | END IF; | |||
|
219 | ||||
213 |
|
|
220 | END IF; | |
214 |
|
221 | |||
215 | END IF; |
|
222 | END IF; | |
@@ -360,7 +367,7 BEGIN | |||||
360 |
|
367 | |||
361 | HK_sel_s <= "00"; |
|
368 | HK_sel_s <= "00"; | |
362 |
|
369 | |||
363 |
ELSIF clk25MHz' |
|
370 | ELSIF clk25MHz'EVENT AND clk25MHz = '1' THEN -- rising clock edge | |
364 |
|
371 | |||
365 | IF HK_val = '1' THEN |
|
372 | IF HK_val = '1' THEN | |
366 | CASE HK_sel_s IS |
|
373 | CASE HK_sel_s IS | |
@@ -377,4 +384,4 BEGIN | |||||
377 |
|
384 | |||
378 | HK_sel <= HK_sel_s; |
|
385 | HK_sel <= HK_sel_s; | |
379 |
|
386 | |||
380 | END Behavioral; No newline at end of file |
|
387 | END Behavioral; |
General Comments 0
You need to be logged in to leave comments.
Login now