@@ -0,0 +1,7 | |||||
|
1 | lpp_cna.vhd | |||
|
2 | APB_LFR_CAL.vhd | |||
|
3 | RAM_READER.vhd | |||
|
4 | RAM_WRITER.vhd | |||
|
5 | SPI_DAC_DRIVER.vhd | |||
|
6 | dynamic_freq_div.vhd | |||
|
7 | lfr_cal_driver.vhd |
@@ -16,3 +16,12 device LPP_MATRIX 13 | |||||
16 | device LPP_DELAY 14 |
|
16 | device LPP_DELAY 14 | |
17 | device LPP_USB 15 |
|
17 | device LPP_USB 15 | |
18 | device LPP_BALISE 16 |
|
18 | device LPP_BALISE 16 | |
|
19 | device LPP_DMA_TYPE 17 | |||
|
20 | device LPP_BOOTLOADER_TYPE 18 | |||
|
21 | device LPP_LFR 19 | |||
|
22 | device LPP_CLKSETTING 20 | |||
|
23 | device LPP_LFR_HK_DEVICE 21 | |||
|
24 | device LPP_LFR_MANAGEMENT 22 | |||
|
25 | device LPP_DEBUG_DMA A0 | |||
|
26 | device LPP_DEBUG_LFR A1 | |||
|
27 | device LPP_DEBUG_LFR_ID A2 |
@@ -82,6 +82,11 ENTITY LFR_em IS | |||||
82 | ADC_OEB_bar_CH : OUT STD_LOGIC_VECTOR(7 DOWNTO 0); |
|
82 | ADC_OEB_bar_CH : OUT STD_LOGIC_VECTOR(7 DOWNTO 0); | |
83 | ADC_smpclk : OUT STD_LOGIC; |
|
83 | ADC_smpclk : OUT STD_LOGIC; | |
84 | ADC_data : IN STD_LOGIC_VECTOR(13 DOWNTO 0); |
|
84 | ADC_data : IN STD_LOGIC_VECTOR(13 DOWNTO 0); | |
|
85 | -- DAC -------------------------------------------------------------------- | |||
|
86 | DAC_SDO : OUT STD_LOGIC; | |||
|
87 | DAC_SCK : OUT STD_LOGIC; | |||
|
88 | DAC_SYNC : OUT STD_LOGIC; | |||
|
89 | DAC_CAL_EN : OUT STD_LOGIC; | |||
85 | -- HK --------------------------------------------------------------------- |
|
90 | -- HK --------------------------------------------------------------------- | |
86 | HK_smpclk : OUT STD_LOGIC; |
|
91 | HK_smpclk : OUT STD_LOGIC; | |
87 | ADC_OEB_bar_HK : OUT STD_LOGIC; |
|
92 | ADC_OEB_bar_HK : OUT STD_LOGIC; | |
@@ -253,6 +258,7 BEGIN -- beh | |||||
253 | ------------------------------------------------------------------------------- |
|
258 | ------------------------------------------------------------------------------- | |
254 | apb_lfr_management_1 : apb_lfr_management |
|
259 | apb_lfr_management_1 : apb_lfr_management | |
255 | GENERIC MAP ( |
|
260 | GENERIC MAP ( | |
|
261 | tech => apa3e, | |||
256 | pindex => 6, |
|
262 | pindex => 6, | |
257 | paddr => 6, |
|
263 | paddr => 6, | |
258 | pmask => 16#fff#, |
|
264 | pmask => 16#fff#, | |
@@ -270,6 +276,11 BEGIN -- beh | |||||
270 | HK_val => sample_val, |
|
276 | HK_val => sample_val, | |
271 | HK_sel => HK_SEL, |
|
277 | HK_sel => HK_SEL, | |
272 |
|
278 | |||
|
279 | DAC_SDO => DAC_SDO, | |||
|
280 | DAC_SCK => DAC_SCK, | |||
|
281 | DAC_SYNC => DAC_SYNC, | |||
|
282 | DAC_CAL_EN => DAC_CAL_EN, | |||
|
283 | ||||
273 | coarse_time => coarse_time, |
|
284 | coarse_time => coarse_time, | |
274 | fine_time => fine_time, |
|
285 | fine_time => fine_time, | |
275 | LFR_soft_rstn => LFR_soft_rstn |
|
286 | LFR_soft_rstn => LFR_soft_rstn | |
@@ -380,7 +391,7 BEGIN -- beh | |||||
380 | pirq_ms => 6, |
|
391 | pirq_ms => 6, | |
381 | pirq_wfp => 14, |
|
392 | pirq_wfp => 14, | |
382 | hindex => 2, |
|
393 | hindex => 2, | |
383 |
top_lfr_version => X"01013 |
|
394 | top_lfr_version => X"01013B") -- aa.bb.cc version | |
384 | -- AA : BOARD NUMBER |
|
395 | -- AA : BOARD NUMBER | |
385 | -- 0 => MINI_LFR |
|
396 | -- 0 => MINI_LFR | |
386 | -- 1 => EM |
|
397 | -- 1 => EM |
@@ -18,7 +18,7 VHDLSIMFILES=testbench.vhd | |||||
18 | #SIMTOP=testbench |
|
18 | #SIMTOP=testbench | |
19 | #SDCFILE=$(GRLIB)/boards/$(BOARD)/synplify.sdc |
|
19 | #SDCFILE=$(GRLIB)/boards/$(BOARD)/synplify.sdc | |
20 | #SDC=$(GRLIB)/boards/$(BOARD)/leon3mp.sdc |
|
20 | #SDC=$(GRLIB)/boards/$(BOARD)/leon3mp.sdc | |
21 | PDC=$(VHDLIB)/boards/$(BOARD)/em-LeonLPP-A3PE3kL_withHK.pdc |
|
21 | PDC=$(VHDLIB)/boards/$(BOARD)/em-LeonLPP-A3PE3kL_withHK-DAC.pdc | |
22 |
|
22 | |||
23 | #SDCFILE=$(VHDLIB)/boards/$(BOARD)/LFR_EM_synthesis.sdc |
|
23 | #SDCFILE=$(VHDLIB)/boards/$(BOARD)/LFR_EM_synthesis.sdc | |
24 | SDC=$(VHDLIB)/boards/$(BOARD)/LFR_EM_place_and_route.sdc |
|
24 | SDC=$(VHDLIB)/boards/$(BOARD)/LFR_EM_place_and_route.sdc | |
@@ -38,7 +38,6 DIRSKIP = b1553 pcif leon2 leon2ft crypt | |||||
38 | ./general_purpose/lpp_balise \ |
|
38 | ./general_purpose/lpp_balise \ | |
39 | ./general_purpose/lpp_delay \ |
|
39 | ./general_purpose/lpp_delay \ | |
40 | ./lpp_bootloader \ |
|
40 | ./lpp_bootloader \ | |
41 | ./lpp_cna \ |
|
|||
42 | ./dsp/lpp_fft_rtax \ |
|
41 | ./dsp/lpp_fft_rtax \ | |
43 | ./lpp_uart \ |
|
42 | ./lpp_uart \ | |
44 | ./lpp_usb \ |
|
43 | ./lpp_usb \ |
@@ -11,10 +11,10 | |||||
11 | ./dsp/lpp_fft_rtax |
|
11 | ./dsp/lpp_fft_rtax | |
12 | ./lpp_memory |
|
12 | ./lpp_memory | |
13 | ./dsp/lpp_fft |
|
13 | ./dsp/lpp_fft | |
|
14 | ./lpp_cna | |||
14 | ./lfr_management |
|
15 | ./lfr_management | |
15 | ./lpp_ad_Conv |
|
16 | ./lpp_ad_Conv | |
16 | ./lpp_bootloader |
|
17 | ./lpp_bootloader | |
17 | ./lpp_cna |
|
|||
18 | ./lpp_spectral_matrix |
|
18 | ./lpp_spectral_matrix | |
19 | ./lpp_demux |
|
19 | ./lpp_demux | |
20 | ./lpp_Header |
|
20 | ./lpp_Header |
@@ -29,11 +29,15 USE lpp.apb_devices_list.ALL; | |||||
29 | USE lpp.general_purpose.ALL; |
|
29 | USE lpp.general_purpose.ALL; | |
30 | USE lpp.lpp_lfr_management.ALL; |
|
30 | USE lpp.lpp_lfr_management.ALL; | |
31 | USE lpp.lpp_lfr_management_apbreg_pkg.ALL; |
|
31 | USE lpp.lpp_lfr_management_apbreg_pkg.ALL; | |
|
32 | USE lpp.lpp_cna.ALL; | |||
|
33 | LIBRARY techmap; | |||
|
34 | USE techmap.gencomp.ALL; | |||
32 |
|
35 | |||
33 |
|
36 | |||
34 | ENTITY apb_lfr_management IS |
|
37 | ENTITY apb_lfr_management IS | |
35 |
|
38 | |||
36 | GENERIC( |
|
39 | GENERIC( | |
|
40 | tech : INTEGER := 0; | |||
37 | pindex : INTEGER := 0; --! APB slave index |
|
41 | pindex : INTEGER := 0; --! APB slave index | |
38 | paddr : INTEGER := 0; --! ADDR field of the APB BAR |
|
42 | paddr : INTEGER := 0; --! ADDR field of the APB BAR | |
39 | pmask : INTEGER := 16#fff#; --! MASK field of the APB BAR |
|
43 | pmask : INTEGER := 16#fff#; --! MASK field of the APB BAR | |
@@ -55,6 +59,11 ENTITY apb_lfr_management IS | |||||
55 | HK_val : IN STD_LOGIC; |
|
59 | HK_val : IN STD_LOGIC; | |
56 | HK_sel : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); |
|
60 | HK_sel : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); | |
57 | --------------------------------------------------------------------------- |
|
61 | --------------------------------------------------------------------------- | |
|
62 | DAC_SDO : OUT STD_LOGIC; | |||
|
63 | DAC_SCK : OUT STD_LOGIC; | |||
|
64 | DAC_SYNC : OUT STD_LOGIC; | |||
|
65 | DAC_CAL_EN : OUT STD_LOGIC; | |||
|
66 | --------------------------------------------------------------------------- | |||
58 | coarse_time : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --! coarse time |
|
67 | coarse_time : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --! coarse time | |
59 | fine_time : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); --! fine TIME |
|
68 | fine_time : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); --! fine TIME | |
60 | --------------------------------------------------------------------------- |
|
69 | --------------------------------------------------------------------------- | |
@@ -67,7 +76,7 ARCHITECTURE Behavioral OF apb_lfr_manag | |||||
67 |
|
76 | |||
68 | CONSTANT REVISION : INTEGER := 1; |
|
77 | CONSTANT REVISION : INTEGER := 1; | |
69 | CONSTANT pconfig : apb_config_type := ( |
|
78 | CONSTANT pconfig : apb_config_type := ( | |
70 |
0 => ahb_device_reg (VENDOR_LPP, |
|
79 | 0 => ahb_device_reg (VENDOR_LPP, LPP_LFR_MANAGEMENT, 0, REVISION, 0), | |
71 | 1 => apb_iobar(paddr, pmask) |
|
80 | 1 => apb_iobar(paddr, pmask) | |
72 | ); |
|
81 | ); | |
73 |
|
82 | |||
@@ -121,6 +130,27 ARCHITECTURE Behavioral OF apb_lfr_manag | |||||
121 |
|
130 | |||
122 | SIGNAL rstn_LFR_TM : STD_LOGIC; |
|
131 | SIGNAL rstn_LFR_TM : STD_LOGIC; | |
123 |
|
132 | |||
|
133 | ----------------------------------------------------------------------------- | |||
|
134 | -- DAC | |||
|
135 | ----------------------------------------------------------------------------- | |||
|
136 | CONSTANT PRESZ : INTEGER := 8; | |||
|
137 | CONSTANT CPTSZ : INTEGER := 16; | |||
|
138 | CONSTANT datawidth : INTEGER := 18; | |||
|
139 | CONSTANT dacresolution : INTEGER := 12; | |||
|
140 | CONSTANT abits : INTEGER := 8; | |||
|
141 | ||||
|
142 | SIGNAL pre : STD_LOGIC_VECTOR(PRESZ-1 DOWNTO 0); | |||
|
143 | SIGNAL N : STD_LOGIC_VECTOR(CPTSZ-1 DOWNTO 0); | |||
|
144 | SIGNAL Reload : STD_LOGIC; | |||
|
145 | SIGNAL DATA_IN : STD_LOGIC_VECTOR(datawidth-1 DOWNTO 0); | |||
|
146 | SIGNAL WEN : STD_LOGIC; | |||
|
147 | SIGNAL LOAD_ADDRESSN : STD_LOGIC; | |||
|
148 | SIGNAL ADDRESS_IN : STD_LOGIC_VECTOR(abits-1 DOWNTO 0); | |||
|
149 | SIGNAL ADDRESS_OUT : STD_LOGIC_VECTOR(abits-1 DOWNTO 0); | |||
|
150 | SIGNAL INTERLEAVED : STD_LOGIC; | |||
|
151 | SIGNAL DAC_CFG : STD_LOGIC_VECTOR(3 DOWNTO 0); | |||
|
152 | SIGNAL DAC_CAL_EN_s : STD_LOGIC; | |||
|
153 | ||||
124 | BEGIN |
|
154 | BEGIN | |
125 |
|
155 | |||
126 | LFR_soft_rstn <= NOT r.LFR_soft_reset; |
|
156 | LFR_soft_rstn <= NOT r.LFR_soft_reset; | |
@@ -141,7 +171,18 BEGIN | |||||
141 | soft_tick <= '0'; |
|
171 | soft_tick <= '0'; | |
142 |
|
172 | |||
143 | coarsetime_reg_updated <= '0'; |
|
173 | coarsetime_reg_updated <= '0'; | |
144 |
|
174 | --DAC | ||
|
175 | pre <= (OTHERS => '1'); | |||
|
176 | N <= (OTHERS => '1'); | |||
|
177 | Reload <= '1'; | |||
|
178 | DATA_IN <= (OTHERS => '0'); | |||
|
179 | WEN <= '1'; | |||
|
180 | LOAD_ADDRESSN <= '1'; | |||
|
181 | ADDRESS_IN <= (OTHERS => '1'); | |||
|
182 | INTERLEAVED <= '0'; | |||
|
183 | DAC_CFG <= (OTHERS => '0'); | |||
|
184 | -- | |||
|
185 | DAC_CAL_EN_s <= '0'; | |||
145 | ELSIF clk25MHz'EVENT AND clk25MHz = '1' THEN |
|
186 | ELSIF clk25MHz'EVENT AND clk25MHz = '1' THEN | |
146 | coarsetime_reg_updated <= '0'; |
|
187 | coarsetime_reg_updated <= '0'; | |
147 |
|
188 | |||
@@ -190,6 +231,24 BEGIN | |||||
190 | WHEN ADDR_LFR_MANAGMENT_HK_TEMP_2 => |
|
231 | WHEN ADDR_LFR_MANAGMENT_HK_TEMP_2 => | |
191 | Rdata(31 DOWNTO 16) <= (OTHERS => '0'); |
|
232 | Rdata(31 DOWNTO 16) <= (OTHERS => '0'); | |
192 | Rdata(15 DOWNTO 0) <= r.HK_temp_2; |
|
233 | Rdata(15 DOWNTO 0) <= r.HK_temp_2; | |
|
234 | WHEN ADDR_LFR_MANAGMENT_DAC_CONTROL => | |||
|
235 | Rdata(3 DOWNTO 0) <= DAC_CFG; | |||
|
236 | Rdata(4) <= Reload; | |||
|
237 | Rdata(5) <= INTERLEAVED; | |||
|
238 | Rdata(6) <= DAC_CAL_EN_s; | |||
|
239 | Rdata(31 DOWNTO 7) <= (OTHERS => '0'); | |||
|
240 | WHEN ADDR_LFR_MANAGMENT_DAC_PRE => | |||
|
241 | Rdata(PRESZ-1 DOWNTO 0) <= pre; | |||
|
242 | Rdata(31 DOWNTO PRESZ) <= (OTHERS => '0'); | |||
|
243 | WHEN ADDR_LFR_MANAGMENT_DAC_N => | |||
|
244 | Rdata(CPTSZ-1 DOWNTO 0) <= N; | |||
|
245 | Rdata(31 DOWNTO CPTSZ) <= (OTHERS => '0'); | |||
|
246 | WHEN ADDR_LFR_MANAGMENT_DAC_ADDRESS_OUT => | |||
|
247 | Rdata(abits-1 DOWNTO 0) <= ADDRESS_OUT; | |||
|
248 | Rdata(31 DOWNTO abits) <= (OTHERS => '0'); | |||
|
249 | WHEN ADDR_LFR_MANAGMENT_DAC_DATA_IN => | |||
|
250 | Rdata(datawidth-1 DOWNTO 0) <= DATA_IN; | |||
|
251 | Rdata(31 DOWNTO datawidth) <= (OTHERS => '0'); | |||
193 | WHEN OTHERS => |
|
252 | WHEN OTHERS => | |
194 | Rdata(31 DOWNTO 0) <= (OTHERS => '0'); |
|
253 | Rdata(31 DOWNTO 0) <= (OTHERS => '0'); | |
195 | END CASE; |
|
254 | END CASE; | |
@@ -204,10 +263,28 BEGIN | |||||
204 | WHEN ADDR_LFR_MANAGMENT_TIME_LOAD => |
|
263 | WHEN ADDR_LFR_MANAGMENT_TIME_LOAD => | |
205 | r.coarse_time_load <= apbi.pwdata(30 DOWNTO 0); |
|
264 | r.coarse_time_load <= apbi.pwdata(30 DOWNTO 0); | |
206 | coarsetime_reg_updated <= '1'; |
|
265 | coarsetime_reg_updated <= '1'; | |
|
266 | WHEN ADDR_LFR_MANAGMENT_DAC_CONTROL => | |||
|
267 | DAC_CFG <= apbi.pwdata(3 DOWNTO 0); | |||
|
268 | Reload <= apbi.pwdata(4); | |||
|
269 | INTERLEAVED <= apbi.pwdata(5); | |||
|
270 | DAC_CAL_EN_s <= apbi.pwdata(6); | |||
|
271 | WHEN ADDR_LFR_MANAGMENT_DAC_PRE => | |||
|
272 | pre <= apbi.pwdata(PRESZ-1 DOWNTO 0); | |||
|
273 | WHEN ADDR_LFR_MANAGMENT_DAC_N => | |||
|
274 | N <= apbi.pwdata(CPTSZ-1 DOWNTO 0); | |||
|
275 | WHEN ADDR_LFR_MANAGMENT_DAC_ADDRESS_OUT => | |||
|
276 | ADDRESS_IN <= apbi.pwdata(abits-1 DOWNTO 0); | |||
|
277 | LOAD_ADDRESSN <= '0'; | |||
|
278 | WHEN ADDR_LFR_MANAGMENT_DAC_DATA_IN => | |||
|
279 | DATA_IN <= apbi.pwdata(datawidth-1 DOWNTO 0); | |||
|
280 | WEN <= '0'; | |||
|
281 | ||||
207 |
|
|
282 | WHEN OTHERS => | |
208 | NULL; |
|
283 | NULL; | |
209 | END CASE; |
|
284 | END CASE; | |
210 | ELSE |
|
285 | ELSE | |
|
286 | LOAD_ADDRESSN <= '1'; | |||
|
287 | WEN <= '1'; | |||
211 | IF r.ctrl = '1' THEN |
|
288 | IF r.ctrl = '1' THEN | |
212 | r.ctrl <= '0'; |
|
289 | r.ctrl <= '0'; | |
213 | END IF; |
|
290 | END IF; | |
@@ -394,4 +471,37 BEGIN | |||||
394 |
|
471 | |||
395 | HK_sel <= HK_sel_s; |
|
472 | HK_sel <= HK_sel_s; | |
396 |
|
473 | |||
|
474 | ----------------------------------------------------------------------------- | |||
|
475 | -- DAC | |||
|
476 | ----------------------------------------------------------------------------- | |||
|
477 | cal : lfr_cal_driver | |||
|
478 | GENERIC MAP( | |||
|
479 | tech => tech, | |||
|
480 | PRESZ => PRESZ, | |||
|
481 | CPTSZ => CPTSZ, | |||
|
482 | datawidth => datawidth, | |||
|
483 | abits => abits | |||
|
484 | ) | |||
|
485 | PORT MAP( | |||
|
486 | clk => clk25MHz, | |||
|
487 | rstn => resetn, | |||
|
488 | ||||
|
489 | pre => pre, | |||
|
490 | N => N, | |||
|
491 | Reload => Reload, | |||
|
492 | DATA_IN => DATA_IN, | |||
|
493 | WEN => WEN, | |||
|
494 | LOAD_ADDRESSN => LOAD_ADDRESSN, | |||
|
495 | ADDRESS_IN => ADDRESS_IN, | |||
|
496 | ADDRESS_OUT => ADDRESS_OUT, | |||
|
497 | INTERLEAVED => INTERLEAVED, | |||
|
498 | DAC_CFG => DAC_CFG, | |||
|
499 | ||||
|
500 | SYNC => DAC_SYNC, | |||
|
501 | DOUT => DAC_SDO, | |||
|
502 | SCLK => DAC_SCK, | |||
|
503 | SMPCLK => OPEN --DAC_SMPCLK | |||
|
504 | ); | |||
|
505 | ||||
|
506 | DAC_CAL_EN <= DAC_CAL_EN_s; | |||
397 | END Behavioral; No newline at end of file |
|
507 | END Behavioral; |
@@ -31,6 +31,7 PACKAGE lpp_lfr_management IS | |||||
31 |
|
31 | |||
32 | COMPONENT apb_lfr_management |
|
32 | COMPONENT apb_lfr_management | |
33 | GENERIC ( |
|
33 | GENERIC ( | |
|
34 | tech : INTEGER; | |||
34 | pindex : INTEGER; |
|
35 | pindex : INTEGER; | |
35 | paddr : INTEGER; |
|
36 | paddr : INTEGER; | |
36 | pmask : INTEGER; |
|
37 | pmask : INTEGER; | |
@@ -46,6 +47,10 PACKAGE lpp_lfr_management IS | |||||
46 | HK_sample : IN STD_LOGIC_VECTOR(15 DOWNTO 0); |
|
47 | HK_sample : IN STD_LOGIC_VECTOR(15 DOWNTO 0); | |
47 | HK_val : IN STD_LOGIC; |
|
48 | HK_val : IN STD_LOGIC; | |
48 | HK_sel : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); |
|
49 | HK_sel : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); | |
|
50 | DAC_SDO : OUT STD_LOGIC; | |||
|
51 | DAC_SCK : OUT STD_LOGIC; | |||
|
52 | DAC_SYNC : OUT STD_LOGIC; | |||
|
53 | DAC_CAL_EN : OUT STD_LOGIC; | |||
49 | coarse_time : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
54 | coarse_time : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | |
50 | fine_time : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); |
|
55 | fine_time : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); | |
51 | LFR_soft_rstn : OUT STD_LOGIC); |
|
56 | LFR_soft_rstn : OUT STD_LOGIC); |
@@ -11,5 +11,10 PACKAGE lpp_lfr_management_apbreg_pkg IS | |||||
11 | CONSTANT ADDR_LFR_MANAGMENT_HK_TEMP_0 : STD_LOGIC_VECTOR(7 DOWNTO 2) := "000100"; |
|
11 | CONSTANT ADDR_LFR_MANAGMENT_HK_TEMP_0 : STD_LOGIC_VECTOR(7 DOWNTO 2) := "000100"; | |
12 | CONSTANT ADDR_LFR_MANAGMENT_HK_TEMP_1 : STD_LOGIC_VECTOR(7 DOWNTO 2) := "000101"; |
|
12 | CONSTANT ADDR_LFR_MANAGMENT_HK_TEMP_1 : STD_LOGIC_VECTOR(7 DOWNTO 2) := "000101"; | |
13 | CONSTANT ADDR_LFR_MANAGMENT_HK_TEMP_2 : STD_LOGIC_VECTOR(7 DOWNTO 2) := "000110"; |
|
13 | CONSTANT ADDR_LFR_MANAGMENT_HK_TEMP_2 : STD_LOGIC_VECTOR(7 DOWNTO 2) := "000110"; | |
|
14 | CONSTANT ADDR_LFR_MANAGMENT_DAC_CONTROL : STD_LOGIC_VECTOR(7 DOWNTO 2) := "000111"; | |||
|
15 | CONSTANT ADDR_LFR_MANAGMENT_DAC_PRE : STD_LOGIC_VECTOR(7 DOWNTO 2) := "001000"; | |||
|
16 | CONSTANT ADDR_LFR_MANAGMENT_DAC_N : STD_LOGIC_VECTOR(7 DOWNTO 2) := "001001"; | |||
|
17 | CONSTANT ADDR_LFR_MANAGMENT_DAC_ADDRESS_OUT : STD_LOGIC_VECTOR(7 DOWNTO 2) := "001010"; | |||
|
18 | CONSTANT ADDR_LFR_MANAGMENT_DAC_DATA_IN : STD_LOGIC_VECTOR(7 DOWNTO 2) := "001011"; | |||
14 |
|
19 | |||
15 | END lpp_lfr_management_apbreg_pkg; |
|
20 | END lpp_lfr_management_apbreg_pkg; |
@@ -39,7 +39,7 PACKAGE apb_devices_list IS | |||||
39 | CONSTANT LPP_LFR : amba_device_type := 16#19#; |
|
39 | CONSTANT LPP_LFR : amba_device_type := 16#19#; | |
40 | CONSTANT LPP_CLKSETTING : amba_device_type := 16#20#; |
|
40 | CONSTANT LPP_CLKSETTING : amba_device_type := 16#20#; | |
41 | CONSTANT LPP_LFR_HK_DEVICE : amba_device_type := 16#21#; |
|
41 | CONSTANT LPP_LFR_HK_DEVICE : amba_device_type := 16#21#; | |
42 |
|
42 | CONSTANT LPP_LFR_MANAGEMENT : amba_device_type := 16#22#; | ||
43 | CONSTANT LPP_DEBUG_DMA : amba_device_type := 16#A0#; |
|
43 | CONSTANT LPP_DEBUG_DMA : amba_device_type := 16#A0#; | |
44 | CONSTANT LPP_DEBUG_LFR : amba_device_type := 16#A1#; |
|
44 | CONSTANT LPP_DEBUG_LFR : amba_device_type := 16#A1#; | |
45 |
|
45 |
@@ -19,78 +19,79 | |||||
19 | -- Author : Alexis Jeandet |
|
19 | -- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ------------------------------------------------------------------------------ |
|
21 | ------------------------------------------------------------------------------ | |
22 | library ieee; |
|
22 | LIBRARY ieee; | |
23 |
|
|
23 | USE ieee.std_logic_1164.ALL; | |
24 |
|
|
24 | USE IEEE.numeric_std.ALL; | |
25 | library grlib; |
|
25 | LIBRARY grlib; | |
26 |
|
|
26 | USE grlib.amba.ALL; | |
27 |
|
|
27 | USE grlib.stdlib.ALL; | |
28 |
|
|
28 | USE grlib.devices.ALL; | |
29 | library lpp; |
|
29 | LIBRARY lpp; | |
30 |
|
|
30 | USE lpp.lpp_amba.ALL; | |
31 |
|
|
31 | USE lpp.lpp_cna.ALL; | |
32 |
|
|
32 | USE lpp.apb_devices_list.ALL; | |
33 |
|
33 | |||
34 |
|
|
34 | ENTITY apb_lfr_cal IS | |
35 | generic ( |
|
35 | GENERIC ( | |
36 |
pindex : |
|
36 | pindex : INTEGER := 0; | |
37 |
paddr : |
|
37 | paddr : INTEGER := 0; | |
38 |
pmask : |
|
38 | pmask : INTEGER := 16#fff#; | |
39 |
tech : |
|
39 | tech : INTEGER := 0; | |
40 |
PRESZ : |
|
40 | PRESZ : INTEGER := 8; | |
41 |
CPTSZ : |
|
41 | CPTSZ : INTEGER := 16; | |
42 |
datawidth : |
|
42 | datawidth : INTEGER := 18; | |
43 |
dacresolution : |
|
43 | dacresolution : INTEGER := 12; | |
44 |
abits : |
|
44 | abits : INTEGER := 8 | |
45 | ); |
|
45 | ); | |
46 | port ( |
|
46 | PORT ( | |
47 |
rstn |
|
47 | rstn : IN STD_LOGIC; | |
48 |
clk |
|
48 | clk : IN STD_LOGIC; | |
49 |
apbi |
|
49 | apbi : IN apb_slv_in_type; | |
50 |
apbo |
|
50 | apbo : OUT apb_slv_out_type; | |
51 | SDO : out std_logic; |
|
51 | SDO : OUT STD_LOGIC; | |
52 | SCK : out std_logic; |
|
52 | SCK : OUT STD_LOGIC; | |
53 | SYNC : out std_logic; |
|
53 | SYNC : OUT STD_LOGIC; | |
54 | SMPCLK : out std_logic |
|
54 | SMPCLK : OUT STD_LOGIC | |
55 | ); |
|
55 | ); | |
56 | end entity; |
|
56 | END ENTITY; | |
57 |
|
57 | |||
58 | --! @details Les deux registres (apbi,apbo) permettent de g�rer la communication sur le bus |
|
58 | --! @details Les deux registres (apbi,apbo) permettent de g�rer la communication sur le bus | |
59 | --! et les sorties seront cabl�es vers le convertisseur. |
|
59 | --! et les sorties seront cabl�es vers le convertisseur. | |
60 |
|
60 | |||
61 |
|
|
61 | ARCHITECTURE ar_apb_lfr_cal OF apb_lfr_cal IS | |
62 |
|
62 | |||
63 | constant REVISION : integer := 1; |
|
63 | CONSTANT REVISION : INTEGER := 1; | |
64 |
|
64 | |||
65 |
|
|
65 | CONSTANT pconfig : apb_config_type := ( | |
66 | 0 => ahb_device_reg (VENDOR_LPP, LPP_CNA, 0, REVISION, 0), |
|
66 | 0 => ahb_device_reg (VENDOR_LPP, LPP_CNA, 0, REVISION, 0), | |
67 | 1 => apb_iobar(paddr, pmask)); |
|
67 | 1 => apb_iobar(paddr, pmask)); | |
68 |
|
68 | |||
69 |
|
|
69 | SIGNAL pre : STD_LOGIC_VECTOR(PRESZ-1 DOWNTO 0); | |
70 |
|
|
70 | SIGNAL N : STD_LOGIC_VECTOR(CPTSZ-1 DOWNTO 0); | |
71 | signal Reload : std_logic; |
|
71 | SIGNAL Reload : STD_LOGIC; | |
72 |
|
|
72 | SIGNAL DATA_IN : STD_LOGIC_VECTOR(datawidth-1 DOWNTO 0); | |
73 |
|
|
73 | SIGNAL WEN : STD_LOGIC; | |
74 |
|
|
74 | SIGNAL LOAD_ADDRESSN : STD_LOGIC; | |
75 |
|
|
75 | SIGNAL ADDRESS_IN : STD_LOGIC_VECTOR(abits-1 DOWNTO 0); | |
76 |
|
|
76 | SIGNAL ADDRESS_OUT : STD_LOGIC_VECTOR(abits-1 DOWNTO 0); | |
77 |
|
|
77 | SIGNAL INTERLEAVED : STD_LOGIC; | |
78 |
|
|
78 | SIGNAL DAC_CFG : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
79 | signal Rdata : std_logic_vector(31 downto 0); |
|
79 | SIGNAL Rdata : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
80 |
|
80 | |||
81 | begin |
|
81 | BEGIN | |
82 |
|
82 | |||
83 | cal: lfr_cal_driver |
|
83 | cal : lfr_cal_driver | |
84 | generic map( |
|
84 | GENERIC MAP( | |
85 |
|
|
85 | tech => tech, | |
86 |
|
|
86 | PRESZ => PRESZ, | |
87 |
|
|
87 | CPTSZ => CPTSZ, | |
88 |
|
|
88 | datawidth => datawidth, | |
89 |
|
|
89 | abits => abits | |
90 | ) |
|
90 | ) | |
91 | Port map( |
|
91 | PORT MAP( | |
92 |
|
|
92 | clk => clk, | |
93 |
|
|
93 | rstn => rstn, | |
|
94 | ||||
94 |
|
|
95 | pre => pre, | |
95 |
|
|
96 | N => N, | |
96 |
|
|
97 | Reload => Reload, | |
@@ -101,81 +102,82 cal: lfr_cal_driver | |||||
101 |
|
|
102 | ADDRESS_OUT => ADDRESS_OUT, | |
102 |
|
|
103 | INTERLEAVED => INTERLEAVED, | |
103 |
|
|
104 | DAC_CFG => DAC_CFG, | |
|
105 | ||||
104 |
|
|
106 | SYNC => SYNC, | |
105 |
|
|
107 | DOUT => SDO, | |
106 |
|
|
108 | SCLK => SCK, | |
107 |
|
|
109 | SMPCLK => SMPCLK -- OPEN | |
108 |
|
|
110 | ); | |
109 |
|
111 | |||
110 | process(rstn,clk) |
|
112 | PROCESS(rstn, clk) | |
111 | begin |
|
113 | BEGIN | |
112 |
|
|
114 | IF(rstn = '0')then | |
113 |
|
|
115 | pre <= (OTHERS => '1'); | |
114 |
|
|
116 | N <= (OTHERS => '1'); | |
115 |
|
|
117 | Reload <= '1'; | |
116 |
|
|
118 | DATA_IN <= (OTHERS => '0'); | |
117 |
|
|
119 | WEN <= '1'; | |
118 |
|
|
120 | LOAD_ADDRESSN <= '1'; | |
119 |
|
|
121 | ADDRESS_IN <= (OTHERS => '1'); | |
120 |
|
|
122 | INTERLEAVED <= '0'; | |
121 |
|
|
123 | DAC_CFG <= (OTHERS => '0'); | |
122 |
|
|
124 | Rdata <= (OTHERS => '0'); | |
123 | elsif(clk'event and clk='1')then |
|
125 | ELSIF(clk'EVENT AND clk = '1')then | |
124 |
|
126 | |||
125 |
|
127 | |||
126 | --APB Write OP |
|
128 | --APB Write OP | |
127 |
|
|
129 | IF (apbi.psel(pindex) AND apbi.penable AND apbi.pwrite) = '1' THEN | |
128 |
|
|
130 | CASE apbi.paddr(abits-1 DOWNTO 2) IS | |
129 |
|
|
131 | WHEN "000000" => | |
130 |
|
|
132 | DAC_CFG <= apbi.pwdata(3 DOWNTO 0); | |
131 |
|
|
133 | Reload <= apbi.pwdata(4); | |
132 |
|
|
134 | INTERLEAVED <= apbi.pwdata(5); | |
133 |
|
|
135 | WHEN "000001" => | |
134 |
|
|
136 | pre <= apbi.pwdata(PRESZ-1 DOWNTO 0); | |
135 |
|
|
137 | WHEN "000010" => | |
136 |
|
|
138 | N <= apbi.pwdata(CPTSZ-1 DOWNTO 0); | |
137 |
|
|
139 | WHEN "000011" => | |
138 |
|
|
140 | ADDRESS_IN <= apbi.pwdata(abits-1 DOWNTO 0); | |
139 |
|
|
141 | LOAD_ADDRESSN <= '0'; | |
140 |
|
|
142 | WHEN "000100" => | |
141 |
|
|
143 | DATA_IN <= apbi.pwdata(datawidth-1 DOWNTO 0); | |
142 |
|
|
144 | WEN <= '0'; | |
143 | when others => |
|
145 | WHEN OTHERS => | |
144 | null; |
|
146 | NULL; | |
145 | end case; |
|
147 | END CASE; | |
146 | else |
|
148 | ELSE | |
147 |
|
|
149 | LOAD_ADDRESSN <= '1'; | |
148 |
|
|
150 | WEN <= '1'; | |
149 | end if; |
|
151 | END IF; | |
150 |
|
152 | |||
151 | --APB Read OP |
|
153 | --APB Read OP | |
152 |
|
|
154 | IF (apbi.psel(pindex) AND (NOT apbi.pwrite)) = '1' THEN | |
153 |
|
|
155 | CASE apbi.paddr(abits-1 DOWNTO 2) IS | |
154 |
|
|
156 | WHEN "000000" => | |
155 |
|
|
157 | Rdata(3 DOWNTO 0) <= DAC_CFG; | |
156 |
|
|
158 | Rdata(4) <= Reload; | |
157 |
|
|
159 | Rdata(5) <= INTERLEAVED; | |
158 |
|
|
160 | Rdata(31 DOWNTO 6) <= (OTHERS => '0'); | |
159 |
|
|
161 | WHEN "000001" => | |
160 |
|
|
162 | Rdata(PRESZ-1 DOWNTO 0) <= pre; | |
161 |
|
|
163 | Rdata(31 DOWNTO PRESZ) <= (OTHERS => '0'); | |
162 |
|
|
164 | WHEN "000010" => | |
163 |
|
|
165 | Rdata(CPTSZ-1 DOWNTO 0) <= N; | |
164 |
|
|
166 | Rdata(31 DOWNTO CPTSZ) <= (OTHERS => '0'); | |
165 |
|
|
167 | WHEN "000011" => | |
166 |
|
|
168 | Rdata(abits-1 DOWNTO 0) <= ADDRESS_OUT; | |
167 |
|
|
169 | Rdata(31 DOWNTO abits) <= (OTHERS => '0'); | |
168 |
|
|
170 | WHEN "000100" => | |
169 |
|
|
171 | Rdata(datawidth-1 DOWNTO 0) <= DATA_IN; | |
170 |
|
|
172 | Rdata(31 DOWNTO datawidth) <= (OTHERS => '0'); | |
171 | when others => |
|
173 | WHEN OTHERS => | |
172 |
|
|
174 | Rdata <= (OTHERS => '0'); | |
173 | end case; |
|
175 | END CASE; | |
174 | end if; |
|
176 | END IF; | |
175 |
|
177 | |||
176 | end if; |
|
178 | END IF; | |
177 |
|
|
179 | apbo.pconfig <= pconfig; | |
178 | end process; |
|
180 | END PROCESS; | |
179 |
|
181 | |||
180 |
apbo.prdata |
|
182 | apbo.prdata <= Rdata WHEN apbi.penable = '1'; | |
181 | end architecture ar_apb_lfr_cal; No newline at end of file |
|
183 | END ARCHITECTURE ar_apb_lfr_cal; |
@@ -19,68 +19,68 | |||||
19 | -- Author : Alexis Jeandet |
|
19 | -- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ------------------------------------------------------------------------------ |
|
21 | ------------------------------------------------------------------------------ | |
22 | library IEEE; |
|
22 | LIBRARY IEEE; | |
23 |
|
|
23 | USE IEEE.STD_LOGIC_1164.ALL; | |
24 | LIBRARY techmap; |
|
24 | LIBRARY techmap; | |
25 | USE techmap.gencomp.ALL; |
|
25 | USE techmap.gencomp.ALL; | |
26 |
|
26 | |||
27 | library lpp; |
|
27 | LIBRARY lpp; | |
28 |
|
|
28 | USE lpp.lpp_cna.ALL; | |
29 |
|
29 | |||
30 |
|
30 | |||
31 |
|
|
31 | ENTITY lfr_cal_driver IS | |
32 | generic( |
|
32 | GENERIC( | |
33 | tech : integer := 0; |
|
33 | tech : INTEGER := 0; | |
34 | PRESZ : integer range 1 to 32:=4; |
|
34 | PRESZ : INTEGER RANGE 1 TO 32 := 4; | |
35 |
|
|
35 | PREMAX : INTEGER := 16#FFFFFF#; | |
36 | CPTSZ : integer range 1 to 32:=16; |
|
36 | CPTSZ : INTEGER RANGE 1 TO 32 := 16; | |
37 |
|
|
37 | datawidth : INTEGER := 18; | |
38 | abits : integer := 8 |
|
38 | abits : INTEGER := 8 | |
39 |
|
|
39 | ); | |
40 | Port ( |
|
40 | PORT ( | |
41 |
|
|
41 | clk : IN STD_LOGIC; | |
42 |
|
|
42 | rstn : IN STD_LOGIC; | |
43 |
|
|
43 | pre : IN STD_LOGIC_VECTOR(PRESZ-1 DOWNTO 0); | |
44 |
|
|
44 | N : IN STD_LOGIC_VECTOR(CPTSZ-1 DOWNTO 0); | |
45 | Reload : in std_logic; |
|
45 | Reload : IN STD_LOGIC; | |
46 |
|
|
46 | DATA_IN : IN STD_LOGIC_VECTOR(datawidth-1 DOWNTO 0); | |
47 |
|
|
47 | WEN : IN STD_LOGIC; | |
48 |
|
|
48 | LOAD_ADDRESSN : IN STD_LOGIC; | |
49 |
|
|
49 | ADDRESS_IN : IN STD_LOGIC_VECTOR(abits-1 DOWNTO 0); | |
50 |
|
|
50 | ADDRESS_OUT : OUT STD_LOGIC_VECTOR(abits-1 DOWNTO 0); | |
51 |
|
|
51 | INTERLEAVED : IN STD_LOGIC; | |
52 |
|
|
52 | DAC_CFG : IN STD_LOGIC_VECTOR(3 DOWNTO 0); | |
53 |
|
|
53 | SYNC : OUT STD_LOGIC; | |
54 |
|
|
54 | DOUT : OUT STD_LOGIC; | |
55 |
|
|
55 | SCLK : OUT STD_LOGIC; | |
56 |
|
|
56 | SMPCLK : OUT STD_LOGIC | |
57 | ); |
|
57 | ); | |
58 |
|
|
58 | END lfr_cal_driver; | |
59 |
|
59 | |||
60 |
|
|
60 | ARCHITECTURE Behavioral OF lfr_cal_driver IS | |
61 | constant dacresolution : integer := 12; |
|
61 | CONSTANT dacresolution : INTEGER := 12; | |
62 |
|
|
62 | SIGNAL RAM_DATA_IN : STD_LOGIC_VECTOR(datawidth-1 DOWNTO 0); | |
63 |
|
|
63 | SIGNAL RAM_WEN : STD_LOGIC; | |
64 |
|
|
64 | SIGNAL RAM_WADDR : STD_LOGIC_VECTOR(abits-1 DOWNTO 0); | |
65 |
|
|
65 | SIGNAL RAM_DATA_OUT : STD_LOGIC_VECTOR(datawidth-1 DOWNTO 0); | |
66 |
|
|
66 | SIGNAL RAM_RADDR : STD_LOGIC_VECTOR(abits-1 DOWNTO 0); | |
67 |
|
|
67 | SIGNAL RAM_REN : STD_LOGIC; | |
68 |
|
|
68 | SIGNAL DAC_DATA : STD_LOGIC_VECTOR(dacresolution-1 DOWNTO 0); | |
69 |
|
|
69 | SIGNAL SMP_CLK : STD_LOGIC; | |
70 |
|
|
70 | SIGNAL DAC_INPUT : STD_LOGIC_VECTOR(15 DOWNTO 0); | |
71 |
|
71 | |||
72 | begin |
|
72 | BEGIN | |
73 |
|
73 | |||
74 | ADDRESS_OUT <= RAM_WADDR; |
|
74 | ADDRESS_OUT <= RAM_WADDR; | |
75 |
DAC_INPUT <= DAC_CFG & |
|
75 | DAC_INPUT <= DAC_CFG & DAC_DATA; | |
76 | SMPCLK <= SMP_CLK; |
|
76 | SMPCLK <= SMP_CLK; | |
77 |
|
77 | |||
78 | dac_drv: SPI_DAC_DRIVER |
|
78 | dac_drv : SPI_DAC_DRIVER | |
79 | Generic map( |
|
79 | GENERIC MAP( | |
80 |
|
|
80 | datawidth => 16, | |
81 |
|
|
81 | MSBFIRST => 1 | |
82 | ) |
|
82 | ) | |
83 | Port map( |
|
83 | PORT MAP( | |
84 |
|
|
84 | clk => clk, | |
85 |
|
|
85 | rstn => rstn, | |
86 |
|
|
86 | DATA => DAC_INPUT, | |
@@ -91,12 +91,12 dac_drv: SPI_DAC_DRIVER | |||||
91 |
|
|
91 | ); | |
92 |
|
92 | |||
93 |
freqGen: dynamic_freq_div |
|
93 | freqGen : dynamic_freq_div | |
94 | generic map( |
|
94 | GENERIC MAP( | |
95 |
|
|
95 | PRESZ => PRESZ, | |
96 |
|
|
96 | PREMAX => PREMAX, | |
97 |
|
|
97 | CPTSZ => CPTSZ | |
98 | ) |
|
98 | ) | |
99 |
P |
|
99 | PORT MAP(clk => clk, | |
100 | rstn => rstn, |
|
100 | rstn => rstn, | |
101 | pre => pre, |
|
101 | pre => pre, | |
102 | N => N, |
|
102 | N => N, | |
@@ -106,11 +106,11 freqGen: dynamic_freq_div | |||||
106 |
|
106 | |||
107 |
|
107 | |||
108 | ramWr: RAM_WRITER |
|
108 | ramWr : RAM_WRITER | |
109 | Generic map( |
|
109 | GENERIC MAP( | |
110 |
|
|
110 | datawidth => datawidth, | |
111 |
|
|
111 | abits => abits | |
112 | ) |
|
112 | ) | |
113 | Port map( |
|
113 | PORT MAP( | |
114 |
|
|
114 | clk => clk, | |
115 |
|
|
115 | rstn => rstn, | |
116 |
|
|
116 | DATA_IN => DATA_IN, | |
@@ -123,12 +123,12 ramWr: RAM_WRITER | |||||
123 | ); |
|
123 | ); | |
124 |
|
124 | |||
125 |
ramRd: RAM_READER |
|
125 | ramRd : RAM_READER | |
126 | Generic map( |
|
126 | GENERIC MAP( | |
127 |
|
|
127 | datawidth => datawidth, | |
128 |
|
|
128 | dacresolution => dacresolution, | |
129 |
|
|
129 | abits => abits | |
130 | ) |
|
130 | ) | |
131 | Port map( |
|
131 | PORT MAP( | |
132 |
|
|
132 | clk => clk, | |
133 |
|
|
133 | rstn => rstn, | |
134 |
|
|
134 | DATA_IN => RAM_DATA_OUT, | |
@@ -143,4 +143,4 SRAM : syncram_2p | |||||
143 |
|
|
143 | GENERIC MAP(tech, abits, datawidth) | |
144 |
|
|
144 | PORT MAP(clk, RAM_REN, RAM_RADDR, RAM_DATA_OUT, clk, RAM_WEN, RAM_WADDR, RAM_DATA_IN); | |
145 |
|
145 | |||
146 |
|
|
146 | END Behavioral; No newline at end of file |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now