##// END OF EJS Templates
Sync
paul -
r7:565b8186dcb8 default
parent child
Show More
@@ -0,0 +1,45
1 import math
2 import numpy as np
3 from bin16 import *
4 from fft import *
5 import matplotlib.pyplot as plt
6
7 nb_points = 256
8 nb_periods = 10
9 amplitude = 1000
10
11 time_vec = np.arange(0, nb_points, 1)
12 teta = nb_periods * time_vec * 2 * np.pi/ nb_points
13
14 Afloat = 10000 * np.sin( teta )
15
16 Aint = np.zeros(len(time_vec))
17 for i in range(len(time_vec)):
18 Aint[i] = quant16( Afloat[i], -pow(2,16)/2, +pow(2,16)/2 )
19
20 plt.figure(1)
21 plt.plot(time_vec,Afloat,'b.')
22 plt.plot(time_vec,Aint,'r.')
23 plt.show()
24
25 Afloat_FFT = np.fft.fft(Afloat)/len(time_vec)
26
27 # plt.figure(2)
28 # plt.plot(abs(Afloat_FFT[0:100]),'g')
29 # plt.show()
30
31 # plt.figure(3)
32 # plt.plot(time_vec,Aint,'r')
33 # plt.show()
34
35 Aint_FFT = fft_CT(Aint)
36
37 plt.figure(4)
38 plt.plot(abs(Afloat_FFT[0:100]),'g')
39 plt.scatter(range(100),1.0 * abs(Aint_FFT[0:100])/16384)
40 plt.title("Comparing the FFT's")
41 plt.show()
42
43
44
45
@@ -0,0 +1,52
1 IF apbi.psel(pindex) = '1' THEN
2 -- APB DMA READ --
3 CASE paddr(7 DOWNTO 2) IS
4 --0
5 0x00 WHEN "000000" => prdata(31 DOWNTO 0) <= reg_ftt.in_data_f0(31 DOWNTO 0);
6 0x04 WHEN "000001" => prdata(31 DOWNTO 0) <= reg_ftt.in_data_f0(63 DOWNTO 32);
7 0x08 WHEN "000010" => prdata(15 DOWNTO 0) <= reg_ftt.in_data_f0(79 DOWNTO 64);
8 0XC0 WHEN "000011" => prdata(4 DOWNTO 0) <= reg_ftt.in_wen_f0;
9
10 0x10 WHEN "000100" => prdata(31 DOWNTO 0) <= reg_ftt.in_data_f1(31 DOWNTO 0);
11 0x14 WHEN "000101" => prdata(31 DOWNTO 0) <= reg_ftt.in_data_f1(63 DOWNTO 32);
12 0x18 WHEN "000110" => prdata(15 DOWNTO 0) <= reg_ftt.in_data_f1(79 DOWNTO 64);
13 0x1C WHEN "000111" => prdata(4 DOWNTO 0) <= reg_ftt.in_wen_f1;
14
15 0x20 WHEN "001000" => prdata(31 DOWNTO 0) <= reg_ftt.in_data_f2(31 DOWNTO 0);
16 0x24 WHEN "001001" => prdata(31 DOWNTO 0) <= reg_ftt.in_data_f2(63 DOWNTO 32);
17 0x28 WHEN "001010" => prdata(15 DOWNTO 0) <= reg_ftt.in_data_f2(79 DOWNTO 64);
18 0x2C WHEN "001011" => prdata(4 DOWNTO 0) <= reg_ftt.in_wen_f2;
19
20 0x30 WHEN "001100" => prdata(31 DOWNTO 0) <= MEM_OUT_SM_Data_out(32*1-1 DOWNTO 32*0);
21 0x34 WHEN "001101" => prdata(31 DOWNTO 0) <= MEM_OUT_SM_Data_out(32*2-1 DOWNTO 32*1);
22
23 0x38 WHEN "001110" => prdata(1 DOWNTO 0) <= reg_ftt.out_ren;
24 prdata(3 DOWNTO 2) <= MEM_OUT_SM_Full;
25 prdata(5 DOWNTO 4) <= MEM_OUT_SM_Empty;
26 WHEN OTHERS => NULL;
27
28 END CASE;
29 IF (apbi.pwrite AND apbi.penable) = '1' THEN
30 -- APB DMA WRITE --
31 CASE paddr(7 DOWNTO 2) IS
32 0x00 WHEN "000000" => reg_ftt.in_data_f0(31 DOWNTO 0) <= apbi.pwdata;
33 0x04 WHEN "000001" => reg_ftt.in_data_f0(63 DOWNTO 32) <= apbi.pwdata;
34 0x08 WHEN "000010" => reg_ftt.in_data_f0(79 DOWNTO 64) <= apbi.pwdata(15 DOWNTO 0);
35 0x0c WHEN "000011" => reg_ftt.in_wen_f0 <= apbi.pwdata(4 DOWNTO 0);
36
37 0x10 WHEN "000100" => reg_ftt.in_data_f1(31 DOWNTO 0) <= apbi.pwdata;
38 0x14 WHEN "000101" => reg_ftt.in_data_f1(63 DOWNTO 32) <= apbi.pwdata;
39 0x18 WHEN "000110" => reg_ftt.in_data_f1(79 DOWNTO 64) <= apbi.pwdata(15 DOWNTO 0);
40 0x1c WHEN "000111" => reg_ftt.in_wen_f1 <= apbi.pwdata(4 DOWNTO 0);
41
42 0x20 WHEN "001000" => reg_ftt.in_data_f2(31 DOWNTO 0) <= apbi.pwdata;
43 0x24 WHEN "001001" => reg_ftt.in_data_f2(63 DOWNTO 32) <= apbi.pwdata;
44 0x28 WHEN "001010" => reg_ftt.in_data_f2(79 DOWNTO 64) <= apbi.pwdata(15 DOWNTO 0);
45 0x2C WHEN "001011" => reg_ftt.in_wen_f2 <= apbi.pwdata(4 DOWNTO 0);
46
47 0x38 WHEN "001110" => reg_ftt.out_ren <= apbi.pwdata(1 DOWNTO 0);
48
49 WHEN OTHERS => NULL;
50 END CASE;
51 END IF;
52 END IF;
@@ -0,0 +1,52
1 IF apbi.psel(pindex) = '1' THEN
2 -- APB DMA READ --
3 CASE paddr(7 DOWNTO 2) IS
4 --0
5 WHEN "000000" => prdata(31 DOWNTO 0) <= reg_ftt.in_data_f0(31 DOWNTO 0);
6 WHEN "000001" => prdata(31 DOWNTO 0) <= reg_ftt.in_data_f0(63 DOWNTO 32);
7 WHEN "000010" => prdata(15 DOWNTO 0) <= reg_ftt.in_data_f0(79 DOWNTO 64);
8 WHEN "000011" => prdata(4 DOWNTO 0) <= reg_ftt.in_wen_f0;
9
10 WHEN "000100" => prdata(31 DOWNTO 0) <= reg_ftt.in_data_f1(31 DOWNTO 0);
11 WHEN "000101" => prdata(31 DOWNTO 0) <= reg_ftt.in_data_f1(63 DOWNTO 32);
12 WHEN "000110" => prdata(15 DOWNTO 0) <= reg_ftt.in_data_f1(79 DOWNTO 64);
13 WHEN "000111" => prdata(4 DOWNTO 0) <= reg_ftt.in_wen_f1;
14
15 WHEN "001000" => prdata(31 DOWNTO 0) <= reg_ftt.in_data_f2(31 DOWNTO 0);
16 WHEN "001001" => prdata(31 DOWNTO 0) <= reg_ftt.in_data_f2(63 DOWNTO 32);
17 WHEN "001010" => prdata(15 DOWNTO 0) <= reg_ftt.in_data_f2(79 DOWNTO 64);
18 WHEN "001011" => prdata(4 DOWNTO 0) <= reg_ftt.in_wen_f2;
19
20 WHEN "001100" => prdata(31 DOWNTO 0) <= MEM_OUT_SM_Data_out(32*1-1 DOWNTO 32*0);
21 WHEN "001101" => prdata(31 DOWNTO 0) <= MEM_OUT_SM_Data_out(32*2-1 DOWNTO 32*1);
22
23 WHEN "001110" => prdata(1 DOWNTO 0) <= reg_ftt.out_ren;
24 prdata(3 DOWNTO 2) <= MEM_OUT_SM_Full;
25 prdata(5 DOWNTO 4) <= MEM_OUT_SM_Empty;
26 WHEN OTHERS => NULL;
27
28 END CASE;
29 IF (apbi.pwrite AND apbi.penable) = '1' THEN
30 -- APB DMA WRITE --
31 CASE paddr(7 DOWNTO 2) IS
32 WHEN "000000" => reg_ftt.in_data_f0(31 DOWNTO 0) <= apbi.pwdata;
33 WHEN "000001" => reg_ftt.in_data_f0(63 DOWNTO 32) <= apbi.pwdata;
34 WHEN "000010" => reg_ftt.in_data_f0(79 DOWNTO 64) <= apbi.pwdata(15 DOWNTO 0);
35 WHEN "000011" => reg_ftt.in_wen_f0 <= apbi.pwdata(4 DOWNTO 0);
36
37 WHEN "000100" => reg_ftt.in_data_f1(31 DOWNTO 0) <= apbi.pwdata;
38 WHEN "000101" => reg_ftt.in_data_f1(63 DOWNTO 32) <= apbi.pwdata;
39 WHEN "000110" => reg_ftt.in_data_f1(79 DOWNTO 64) <= apbi.pwdata(15 DOWNTO 0);
40 WHEN "000111" => reg_ftt.in_wen_f1 <= apbi.pwdata(4 DOWNTO 0);
41
42 WHEN "001000" => reg_ftt.in_data_f2(31 DOWNTO 0) <= apbi.pwdata;
43 WHEN "001001" => reg_ftt.in_data_f2(63 DOWNTO 32) <= apbi.pwdata;
44 WHEN "001010" => reg_ftt.in_data_f2(79 DOWNTO 64) <= apbi.pwdata(15 DOWNTO 0);
45 WHEN "001011" => reg_ftt.in_wen_f2 <= apbi.pwdata(4 DOWNTO 0);
46
47 WHEN "001110" => reg_ftt.out_ren <= apbi.pwdata(1 DOWNTO 0);
48
49 WHEN OTHERS => NULL;
50 END CASE;
51 END IF;
52 END IF;
@@ -0,0 +1,150
1 import os
2 os.system('clear') # on linux / os x
3
4 import numpy as np
5 import matplotlib.pyplot as plt
6
7 from test_fft.register_addresses_fft_test import *
8 from test_fft.fft_test_functions import *
9
10 print_custom( '*' )
11 print_custom( '*' )
12 print_custom( '*' )
13 print_custom( '*' )
14 print_custom( '*' )
15
16 ######################
17 # GET DATA FROM RECORD
18 #storageDirectory = '/home/paul/data/2014_06_24/'
19 #day = '2014_6_24-'
20 #hour = '9_0_3'
21 #suffix = '.data'
22
23 #typeOfData = '_SBM1_CWF_'
24 #cwf_f1 = np.genfromtxt( storageDirectory + day + hour + typeOfData + 'F1' + suffix,
25 # skip_header = 1)
26 cwf_f1 = np.zeros( 1000 )
27
28 #################
29 # BUILD WAVEFORMS
30 nbSamples = 256
31 nbComponentsPerMatrix = 25
32 nbFrequencyBins = 128
33 #wfrm0 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnV )
34 #wfrm1 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE1 )
35 #wfrm2 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE2 )
36 #wfrm3 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB1 )
37 #wfrm4 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB2 )
38 wfrm0 = sineWave( 256, 10, 1000 )
39 wfrm1 = sineWave( 256, 20, 1000 )
40 wfrm2 = sineWave( 256, 30, 1000 )
41 wfrm3 = sineWave( 256, 40, 1000 )
42 wfrm4 = sineWave( 256, 50, 1000 )
43
44 ################
45 # BUILD THE DATA
46 dataToWrite0 = generateDataToWrite( nbSamples, wfrm0, wfrm1 )
47 dataToWrite1 = generateDataToWrite( nbSamples, wfrm2, wfrm3 )
48 dataToWrite2 = generateDataToWrite( nbSamples, wfrm4, np.zeros( nbSamples ) )
49
50 ########################
51 # WRITE WAVEFORM IN FIFO
52 print_custom( "1) write waveforms in FIFOs: " + str(len(dataToWrite0)) + " samples" )
53 print_reg_sm( )
54
55 for k in range(nbSamples):
56 RMAPPlugin0.Write( address_FIFO_F2_1_0, [dataToWrite0[k]] )
57 RMAPPlugin0.Write( address_FIFO_F2_3_2, [dataToWrite1[k]] )
58 RMAPPlugin0.Write( address_FIFO_F2_4, [dataToWrite2[k]] )
59 # write only the FIFO F2
60 RMAPPlugin0.Write( address_FIFO_F2_WEN, [0xffffffe0] )
61
62 print_custom( "1) data written in FIFOs" )
63
64 print_reg_sm( )
65
66 # wait for SM_OUT_Full
67 while ( is_MEM_OUT_SM_Full() ) == 0:
68 print_custom( "SM not full" )
69
70 print_reg_sm( )
71
72 ################
73 # SM FIRST READ
74 print_custom( "======= SM FIRST READ" )
75
76 components = []
77
78 if is_MEM_OUT_SM_Full_FIFO_0():
79 print_custom( "FIFO_0 is full" )
80 address_MEM_OUT_SM = address_MEM_OUT_SM_0
81 elif is_MEM_OUT_SM_Full_FIFO_1():
82 print_custom( "FIFO_1 is full")
83 address_MEM_OUT_SM = address_MEM_OUT_SM_1
84 else:
85 print_custom( "/!\ no MEM_OUT_SM FIFO full /!\ " )
86
87 for component in range(nbComponentsPerMatrix):
88 print_custom( "component = " + str( component ) )
89 currentComp = np.zeros( nbFrequencyBins )
90 for frequencyBin in range(nbFrequencyBins):
91 # read enable => 0000 0000 0000 0000
92 if is_MEM_OUT_SM_Empty( ) == 1:
93 print_custom( "component = " + str( component ) \
94 + " bin = " + str( frequencyBin ) )
95 val = RMAPPlugin0.Read( address_MEM_OUT_SM, 1)
96 RMAPPlugin0.Write( address_CTRL_SM, [0x00000000] )
97 currentComp[frequencyBin] = val[0]
98 RMAPPlugin0.ProcessPendingEvents()
99 components.append( currentComp )
100
101 # PLOT SM
102
103 plt.figure( 1 )
104 plt.subplot(231)
105 plt.plot(wfrm0, 'b')
106 plt.subplot(232)
107 plt.plot(wfrm1, 'g')
108 plt.plot(wfrm1, '.')
109 plt.subplot(233)
110 plt.plot(wfrm2, 'r')
111 plt.plot(wfrm2, '.')
112 plt.subplot(234)
113 plt.plot(wfrm3, 'c')
114 plt.subplot(235)
115 plt.plot(wfrm4, 'm')
116
117 plt.figure( 2 )
118 plt.subplot(231)
119 plt.plot(components[0][:])
120 plt.plot(components[1][:])
121 plt.plot(components[2][:])
122 plt.plot(components[3][:])
123 plt.subplot(232)
124 plt.plot(components[4][:])
125 plt.plot(components[5][:])
126 plt.plot(components[6][:])
127 plt.plot(components[7][:])
128 plt.subplot(233)
129 plt.plot(components[8][:])
130 plt.plot(components[9][:])
131 plt.plot(components[10][:])
132 plt.plot(components[11][:])
133 plt.subplot(234)
134 plt.plot(components[12][:])
135 plt.plot(components[13][:])
136 plt.plot(components[14][:])
137 plt.plot(components[15][:])
138 plt.subplot(235)
139 plt.plot(components[16][:])
140 plt.plot(components[17][:])
141 plt.plot(components[18][:])
142 plt.plot(components[19][:])
143 plt.subplot(236)
144 plt.plot(components[20][:])
145 plt.plot(components[21][:])
146 plt.plot(components[22][:])
147 plt.plot(components[23][:])
148 plt.plot(components[24][:])
149
150 plt.show() No newline at end of file
@@ -1,322 +1,416
1 {
1 {
2 "auto_complete":
2 "auto_complete":
3 {
3 {
4 "selected_items":
4 "selected_items":
5 [
5 [
6 [
6 [
7 "c",
8 "c"
9 ],
10 [
11 "g",
12 "g"
13 ],
14 [
15 "compo",
16 "components_re"
17 ],
18 [
19 "cur",
20 "currentComp_im"
21 ],
22 [
23 "current",
24 "currentComp_im"
25 ],
26 [
27 "curre",
28 "currentComp_re"
29 ],
30 [
31 "nb",
32 "nbComponentsPerMatrix"
33 ],
34 [
7 "MEM",
35 "MEM",
8 "MEM_IN_SM_Empty"
36 "MEM_IN_SM_Empty"
9 ],
37 ],
10 [
38 [
11 "out_re",
39 "out_re",
12 "out_ren"
40 "out_ren"
13 ],
41 ],
14 [
42 [
15 "fft",
43 "fft",
16 "fft_reg"
44 "fft_reg"
17 ],
45 ],
18 [
46 [
19 "address_MEM",
47 "address_MEM",
20 "address_MEM_IN_SM_0"
48 "address_MEM_IN_SM_0"
21 ],
49 ],
22 [
50 [
23 "wfr",
51 "wfr",
24 "wfrm0"
52 "wfrm0"
25 ],
53 ],
26 [
54 [
27 "print",
55 "print",
28 "print_reg_fft"
56 "print_reg_fft"
29 ],
57 ],
30 [
58 [
31 "sin",
59 "sin",
32 "sineWave"
60 "sineWave"
33 ],
61 ],
34 [
62 [
35 "if",
63 "if",
36 "ifmain if __name__ == '__main__'"
64 "ifmain if __name__ == '__main__'"
37 ],
65 ],
38 [
66 [
39 "address_",
67 "address_",
40 "address_MEM_IN_SM_0"
68 "address_MEM_IN_SM_0"
41 ],
69 ],
42 [
70 [
43 "wf",
71 "wf",
44 "wfrm0"
72 "wfrm0"
45 ],
73 ],
46 [
74 [
47 "address_FIFO_F0_",
75 "address_FIFO_F0_",
48 "address_FIFO_F0_4"
76 "address_FIFO_F0_4"
49 ],
77 ],
50 [
78 [
51 "add",
79 "add",
52 "address_CTRL"
80 "address_CTRL"
53 ],
81 ],
54 [
82 [
55 "wfrm",
83 "wfrm",
56 "wfrm1"
84 "wfrm1"
57 ],
85 ],
58 [
86 [
59 "index",
87 "index",
60 "indexTransformDecimationInFrequency"
88 "indexTransformDecimationInFrequency"
61 ],
89 ],
62 [
90 [
63 "in",
91 "in",
64 "indexTransformDecimationInFrequency"
92 "indexTransformDecimationInFrequency"
65 ],
93 ],
66 [
94 [
67 "dft",
95 "dft",
68 "dft_val"
96 "dft_val"
69 ],
97 ],
70 [
98 [
71 "butter",
99 "butter",
72 "butterflyProcessor"
100 "butterflyProcessor"
73 ],
101 ],
74 [
102 [
75 "chec",
103 "chec",
76 "checkbox_sy_lfr_bw"
104 "checkbox_sy_lfr_bw"
77 ],
105 ],
78 [
106 [
79 "send",
107 "send",
80 "sendLoadCommonPar"
108 "sendLoadCommonPar"
81 ],
109 ],
82 [
110 [
83 "groupbo",
111 "groupbo",
84 "groupbox_tc_lfr_load_common_par"
112 "groupbox_tc_lfr_load_common_par"
85 ],
113 ],
86 [
114 [
87 "l",
115 "l",
88 "layout_tc"
116 "layout_tc"
89 ],
117 ],
90 [
118 [
91 "button",
119 "button",
92 "button_tc_lfr_load_common_par"
120 "button_tc_lfr_load_common_par"
93 ],
121 ],
94 [
122 [
95 "a",
123 "a",
96 "addWidget"
124 "addWidget"
97 ],
125 ],
98 [
126 [
99 "group",
127 "group",
100 "groupbox_tc_lfr_load_common_par"
128 "groupbox_tc_lfr_load_common_par"
101 ],
129 ],
102 [
130 [
103 "c",
104 "common"
105 ],
106 [
107 "laben",
131 "laben",
108 "label_UNKNOWN_nb"
132 "label_UNKNOWN_nb"
109 ],
133 ],
110 [
134 [
111 "UN",
135 "UN",
112 "UNKNOWN_nb"
136 "UNKNOWN_nb"
113 ]
137 ]
114 ]
138 ]
115 },
139 },
116 "buffers":
140 "buffers":
117 [
141 [
118 {
142 {
119 "file": "test_fft/test_fft_mini_lfr.py",
143 "file": "test_fft/test_sm_mini_lfr.py",
120 "settings":
144 "settings":
121 {
145 {
122 "buffer_size": 4505,
146 "buffer_size": 4053,
147 "line_ending": "Unix"
148 }
149 },
150 {
151 "file": "test_fft/fft_test_functions.py",
152 "settings":
153 {
154 "buffer_size": 3885,
155 "line_ending": "Unix"
156 }
157 },
158 {
159 "file": "test_fft/register_addresses_fft_test.py",
160 "settings":
161 {
162 "buffer_size": 798,
123 "line_ending": "Unix"
163 "line_ending": "Unix"
124 }
164 }
125 }
165 }
126 ],
166 ],
127 "build_system": "",
167 "build_system": "",
128 "command_palette":
168 "command_palette":
129 {
169 {
130 "height": 392.0,
170 "height": 392.0,
131 "selected_items":
171 "selected_items":
132 [
172 [
133 ],
173 ],
134 "width": 392.0
174 "width": 392.0
135 },
175 },
136 "console":
176 "console":
137 {
177 {
138 "height": 146.0
178 "height": 146.0
139 },
179 },
140 "distraction_free":
180 "distraction_free":
141 {
181 {
142 "menu_visible": true,
182 "menu_visible": true,
143 "show_minimap": false,
183 "show_minimap": false,
144 "show_open_files": false,
184 "show_open_files": false,
145 "show_tabs": false,
185 "show_tabs": false,
146 "side_bar_visible": false,
186 "side_bar_visible": false,
147 "status_bar_visible": false
187 "status_bar_visible": false
148 },
188 },
149 "file_history":
189 "file_history":
150 [
190 [
191 "/opt/LFR_EMULATOR/test_fft/test_fft_mini_lfr.py",
151 "/opt/LFR_EMULATOR/test_fft/functions_evaluations.py",
192 "/opt/LFR_EMULATOR/test_fft/functions_evaluations.py",
152 "/opt/LFR_EMULATOR/SRC/processing_chain.py",
193 "/opt/LFR_EMULATOR/SRC/processing_chain.py",
153 "/opt/LFR_EMULATOR/main.py",
194 "/opt/LFR_EMULATOR/main.py",
154 "/opt/LFR_EMULATOR/fft_8_decimation_in_frequency.py",
195 "/opt/LFR_EMULATOR/fft_8_decimation_in_frequency.py",
155 "/opt/LFR_EMULATOR/SRC/basic_parameters_Int.py",
196 "/opt/LFR_EMULATOR/SRC/basic_parameters_Int.py",
156 "/opt/LFR_EMULATOR/butterfly_processor.py",
197 "/opt/LFR_EMULATOR/butterfly_processor.py",
157 "/opt/LFR_EMULATOR/index_transform_decimation_in_frequency.py",
198 "/opt/LFR_EMULATOR/index_transform_decimation_in_frequency.py",
158 "/opt/LFR_EMULATOR/efficient_complex_multiplier.py",
199 "/opt/LFR_EMULATOR/efficient_complex_multiplier.py",
159 "/opt/LFR_EMULATOR/twiddle_factors.py",
200 "/opt/LFR_EMULATOR/twiddle_factors.py",
160 "/opt/LFR_EMULATOR/SRC/filters.py",
201 "/opt/LFR_EMULATOR/SRC/filters.py",
161 "/opt/LFR_EMULATOR/SRC/test_cases1.py",
202 "/opt/LFR_EMULATOR/SRC/test_cases1.py",
162 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory.py",
203 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory.py",
163 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory (copy).py",
204 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory (copy).py",
164 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step01/grspw_registers.py",
205 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step01/grspw_registers.py",
165 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0002/tc_during_matrix_transmission.py",
206 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0002/tc_during_matrix_transmission.py",
166 "/opt/VALIDATION/lfrverif/common/actions_tc_lfr_launcher.py",
207 "/opt/VALIDATION/lfrverif/common/actions_tc_lfr_launcher.py",
167 "/opt/VALIDATION/lfrverif/common/test_monitor.py",
208 "/opt/VALIDATION/lfrverif/common/test_monitor.py",
168 "/opt/VALIDATION/validation.sublime-workspace",
209 "/opt/VALIDATION/validation.sublime-workspace",
169 "/opt/VALIDATION/validation.sublime-project",
210 "/opt/VALIDATION/validation.sublime-project",
170 "/opt/PYTHON/lfrverif/test1/test1main.py",
211 "/opt/PYTHON/lfrverif/test1/test1main.py",
171 "/opt/PYTHON/lfrverif/test1/test1launcher.py",
212 "/opt/PYTHON/lfrverif/test1/test1launcher.py",
172 "/opt/PYTHON/lfrverif/common/crcforlfr.py",
213 "/opt/PYTHON/lfrverif/common/crcforlfr.py",
173 "/opt/PYTHON/lfrverif/common/tcparams.py",
214 "/opt/PYTHON/lfrverif/common/tcparams.py",
174 "/opt/PYTHON/lfrverif/test1/testgui.py",
215 "/opt/PYTHON/lfrverif/test1/testgui.py",
175 "/opt/PYTHON/lfrverif/test1/tcmonitor.py",
216 "/opt/PYTHON/lfrverif/test1/tcmonitor.py",
176 "/opt/PYTHON/lfrverif/test1/lppmoncfg.py",
217 "/opt/PYTHON/lfrverif/test1/lppmoncfg.py",
177 "/opt/PYTHON/lfrverif/test1/wfdisplay.py",
218 "/opt/PYTHON/lfrverif/test1/wfdisplay.py",
178 "/opt/PYTHON/lfrverif/test1/lppmonplot.py",
219 "/opt/PYTHON/lfrverif/test1/lppmonplot.py",
179 "/opt/PYTHON/lfrverif/test1/tmmonitor.py"
220 "/opt/PYTHON/lfrverif/test1/tmmonitor.py"
180 ],
221 ],
181 "find":
222 "find":
182 {
223 {
183 "height": 34.0
224 "height": 34.0
184 },
225 },
185 "find_in_files":
226 "find_in_files":
186 {
227 {
187 "height": 0.0,
228 "height": 0.0,
188 "where_history":
229 "where_history":
189 [
230 [
190 "/opt/VALIDATION/lfrverif",
231 "/opt/VALIDATION/lfrverif",
191 "/opt/VALIDATION/lfrverif/LFR_SVS"
232 "/opt/VALIDATION/lfrverif/LFR_SVS"
192 ]
233 ]
193 },
234 },
194 "find_state":
235 "find_state":
195 {
236 {
196 "case_sensitive": false,
237 "case_sensitive": false,
197 "find_history":
238 "find_history":
198 [
239 [
199 "def displayInfoSendTc",
240 "def displayInfoSendTc",
200 "dump",
241 "dump",
201 "tc_lfr_dump_par",
242 "tc_lfr_dump_par",
202 "processpac",
243 "processpac",
203 "WriteSPWDelay",
244 "WriteSPWDelay",
204 "sendPacket",
245 "sendPacket",
205 "sendLoadCommonPar"
246 "sendLoadCommonPar"
206 ],
247 ],
207 "highlight": true,
248 "highlight": true,
208 "in_selection": false,
249 "in_selection": false,
209 "preserve_case": false,
250 "preserve_case": false,
210 "regex": false,
251 "regex": false,
211 "replace_history":
252 "replace_history":
212 [
253 [
213 ],
254 ],
214 "reverse": false,
255 "reverse": false,
215 "show_context": true,
256 "show_context": true,
216 "use_buffer2": true,
257 "use_buffer2": true,
217 "whole_word": false,
258 "whole_word": false,
218 "wrap": true
259 "wrap": true
219 },
260 },
220 "groups":
261 "groups":
221 [
262 [
222 {
263 {
223 "selected": 0,
264 "selected": 0,
224 "sheets":
265 "sheets":
225 [
266 [
226 {
267 {
227 "buffer": 0,
268 "buffer": 0,
228 "file": "test_fft/test_fft_mini_lfr.py",
269 "file": "test_fft/test_sm_mini_lfr.py",
229 "settings":
270 "settings":
230 {
271 {
231 "buffer_size": 4505,
272 "buffer_size": 4053,
232 "regions":
273 "regions":
233 {
274 {
234 },
275 },
235 "selection":
276 "selection":
236 [
277 [
237 [
278 [
238 1524,
279 2731,
239 1524
280 2731
240 ]
281 ]
241 ],
282 ],
242 "settings":
283 "settings":
243 {
284 {
244 "syntax": "Packages/Python/Python.tmLanguage",
285 "syntax": "Packages/Python/Python.tmLanguage",
245 "translate_tabs_to_spaces": false
286 "translate_tabs_to_spaces": false
246 },
287 },
247 "translation.x": 0.0,
288 "translation.x": 0.0,
248 "translation.y": 1998.0,
289 "translation.y": 1295.0,
290 "zoom_level": 1.0
291 },
292 "type": "text"
293 },
294 {
295 "buffer": 1,
296 "file": "test_fft/fft_test_functions.py",
297 "settings":
298 {
299 "buffer_size": 3885,
300 "regions":
301 {
302 },
303 "selection":
304 [
305 [
306 2140,
307 2140
308 ]
309 ],
310 "settings":
311 {
312 "syntax": "Packages/Python/Python.tmLanguage",
313 "translate_tabs_to_spaces": false
314 },
315 "translation.x": 0.0,
316 "translation.y": 1081.0,
317 "zoom_level": 1.0
318 },
319 "type": "text"
320 },
321 {
322 "buffer": 2,
323 "file": "test_fft/register_addresses_fft_test.py",
324 "settings":
325 {
326 "buffer_size": 798,
327 "regions":
328 {
329 },
330 "selection":
331 [
332 [
333 717,
334 717
335 ]
336 ],
337 "settings":
338 {
339 "syntax": "Packages/Python/Python.tmLanguage"
340 },
341 "translation.x": 0.0,
342 "translation.y": 0.0,
249 "zoom_level": 1.0
343 "zoom_level": 1.0
250 },
344 },
251 "type": "text"
345 "type": "text"
252 }
346 }
253 ]
347 ]
254 }
348 }
255 ],
349 ],
256 "incremental_find":
350 "incremental_find":
257 {
351 {
258 "height": 0.0
352 "height": 0.0
259 },
353 },
260 "input":
354 "input":
261 {
355 {
262 "height": 0.0
356 "height": 0.0
263 },
357 },
264 "layout":
358 "layout":
265 {
359 {
266 "cells":
360 "cells":
267 [
361 [
268 [
362 [
269 0,
363 0,
270 0,
364 0,
271 1,
365 1,
272 1
366 1
273 ]
367 ]
274 ],
368 ],
275 "cols":
369 "cols":
276 [
370 [
277 0.0,
371 0.0,
278 1.0
372 1.0
279 ],
373 ],
280 "rows":
374 "rows":
281 [
375 [
282 0.0,
376 0.0,
283 1.0
377 1.0
284 ]
378 ]
285 },
379 },
286 "menu_visible": true,
380 "menu_visible": true,
287 "output.exec":
381 "output.exec":
288 {
382 {
289 "height": 28.0
383 "height": 28.0
290 },
384 },
291 "replace":
385 "replace":
292 {
386 {
293 "height": 0.0
387 "height": 0.0
294 },
388 },
295 "save_all_on_build": true,
389 "save_all_on_build": true,
296 "select_file":
390 "select_file":
297 {
391 {
298 "height": 0.0,
392 "height": 0.0,
299 "selected_items":
393 "selected_items":
300 [
394 [
301 ],
395 ],
302 "width": 0.0
396 "width": 0.0
303 },
397 },
304 "select_project":
398 "select_project":
305 {
399 {
306 "height": 500.0,
400 "height": 500.0,
307 "selected_items":
401 "selected_items":
308 [
402 [
309 [
403 [
310 "",
404 "",
311 "/opt/PYTHON/waveform_analysis/wfmr_plots.sublime-project"
405 "/opt/PYTHON/waveform_analysis/wfmr_plots.sublime-project"
312 ]
406 ]
313 ],
407 ],
314 "width": 380.0
408 "width": 380.0
315 },
409 },
316 "show_minimap": true,
410 "show_minimap": true,
317 "show_open_files": false,
411 "show_open_files": false,
318 "show_tabs": true,
412 "show_tabs": true,
319 "side_bar_visible": true,
413 "side_bar_visible": true,
320 "side_bar_width": 289.0,
414 "side_bar_width": 255.0,
321 "status_bar_visible": true
415 "status_bar_visible": true
322 }
416 }
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,79 +1,138
1 import numpy as np
1 import numpy as np
2
2
3 from test_fft.register_addresses_fft_test import *
3 from test_fft.register_addresses_fft_test import *
4
4
5 from __main__ import RMAPPlugin0
5 from __main__ import RMAPPlugin0
6
6
7 def getWaveFromRecord( cwf, bufferSize, offset, column ):
7 def getWaveFromRecord( cwf, bufferSize, offset, column ):
8 yVector = cwf[(0+offset):(bufferSize+offset), column]
8 yVector = cwf[(0+offset):(bufferSize+offset), column]
9 return yVector
9 return yVector
10
10
11 def sineWave( bufferSize, nbPeriod, amplitude):
11 def sineWave( bufferSize, nbPeriod, amplitude):
12 deltaX = nbPeriod * 2 * np.pi / bufferSize
12 deltaX = nbPeriod * 2 * np.pi / bufferSize
13 xVector = np.arange( bufferSize ) * deltaX
13 xVector = np.arange( bufferSize ) * deltaX
14 yVector = np.int16( amplitude * np.sin( xVector ) )
14 yVector = np.int16( amplitude * np.sin( xVector ) )
15 return yVector
15 return yVector
16
16
17 def continuous( bufferSize, value ):
17 def continuous( bufferSize, value ):
18 tmpVector = np.empty( bufferSize )
18 tmpVector = np.empty( bufferSize )
19 tmpVector.fill( value )
19 tmpVector.fill( value )
20 yVector = np.int16( tmpVector )
20 yVector = np.int16( tmpVector )
21 return yVector
21 return yVector
22
22
23 def step( bufferSize, value ):
23 def step( bufferSize, value ):
24 tmpVector = np.empty( bufferSize )
24 tmpVector = np.zeros( bufferSize )
25 for k in range( bufferSize / 2 ):
25 for k in range( bufferSize / 2 ):
26 tmpVector[ bufferSize / 2 + k ] = value
26 tmpVector[ bufferSize / 2 + k ] = value
27 yVector = np.int16( tmpVector )
27 yVector = np.int16( tmpVector )
28 return yVector
28 return yVector
29
29
30 def dirac( bufferSize, value ):
30 def dirac( bufferSize, value ):
31 tmpVector = np.zeros( bufferSize )
31 tmpVector = np.zeros( bufferSize )
32 tmpVector[0] = value
32 tmpVector[0] = value
33 yVector = np.int16( tmpVector )
33 yVector = np.int16( tmpVector )
34 return yVector
34 return yVector
35
35
36 def generateDataToWrite( bufferSize, wfrm0, wfrm1 ):
36 def generateDataToWrite( bufferSize, wfrm0, wfrm1 ):
37 dataVector = []
37 dataVector = []
38 for k in range(bufferSize):
38 for k in range(bufferSize):
39 dataVector.append(
39 dataVector.append(
40 ( (np.int16(wfrm1[k]) & 0xffff ) << 16)
40 ( (np.int16(wfrm1[k]) & 0xffff ) << 16)
41 | (np.int16(wfrm0[k]) & 0xffff )
41 | (np.int16(wfrm0[k]) & 0xffff )
42 )
42 )
43 return dataVector
43 return dataVector
44
44
45 def print_reg_fft( ):
45 def print_reg_fft( ):
46 fft_reg = RMAPPlugin0.Read( address_CTRL, 1)
46 fft_reg = RMAPPlugin0.Read( address_CTRL, 1)
47 out_ren = (fft_reg[0] & 0x0000001f)
47 out_ren = (fft_reg[0] & 0x0000001f)
48 out_reuse = (fft_reg[0] & 0x000003e0) >> 5
48 out_reuse = (fft_reg[0] & 0x000003e0) >> 5
49 out_locked = (fft_reg[0] & 0x00007c00) >> 10
49 out_locked = (fft_reg[0] & 0x00007c00) >> 10
50 MEM_IN_SM_Full = (fft_reg[0] & 0x000f8000) >> 15
50 MEM_IN_SM_Full = (fft_reg[0] & 0x000f8000) >> 15
51 MEM_IN_SM_Empty = (fft_reg[0] & 0x01f00000) >> 20
51 MEM_IN_SM_Empty = (fft_reg[0] & 0x01f00000) >> 20
52 print "out_ren = " + bin( out_ren ) \
52 print "out_ren = " + bin( out_ren ) \
53 + ", out_reuse = " + bin( out_reuse ) \
53 + ", out_reuse = " + bin( out_reuse ) \
54 + ", out_locked = " + bin( out_locked ) \
54 + ", out_locked = " + bin( out_locked ) \
55 + ", MEM_IN_SM_Full = " + bin( MEM_IN_SM_Full ) \
55 + ", MEM_IN_SM_Full = " + bin( MEM_IN_SM_Full ) \
56 + ", MEM_IN_SM_Empty = " + bin( MEM_IN_SM_Empty )
56 + ", MEM_IN_SM_Empty = " + bin( MEM_IN_SM_Empty )
57 RMAPPlugin0.ProcessPendingEvents()
57 RMAPPlugin0.ProcessPendingEvents()
58
58
59 def print_custom( value ):
60 print value
61 RMAPPlugin0.ProcessPendingEvents()
62
63 def is_MEM_IN_SM_Emty( ):
64 ret = 0
65 fft_reg = RMAPPlugin0.Read( address_CTRL, 1)
66 MEM_IN_SM_Empty = (fft_reg[0] & 0x01f00000) >> 20
67 if MEM_IN_SM_Empty == 0x1f:
68 ret = 1
69 return ret
70
71 def print_reg_sm( ):
72 sm_reg = RMAPPlugin0.Read( address_CTRL_SM, 1)
73 out_ren = (sm_reg[0] & 0x00000003)
74 MEM_OUT_SM_Full = (sm_reg[0] & 0x0000000c) >> 2
75 MEM_OUT_SM_Empty = (sm_reg[0] & 0x00000030) >> 4
76 print "sm_reg = " + bin( sm_reg[0] & 0x3f ) \
77 + ", out_ren = " + bin( out_ren ) \
78 + ", MEM_OUT_SM_Full = " + bin( MEM_OUT_SM_Full ) \
79 + ", MEM_OUT_SM_Empty = " + bin( MEM_OUT_SM_Empty )
80 RMAPPlugin0.ProcessPendingEvents()
81
82 def is_MEM_OUT_SM_Empty( ):
83 ret = 0
84 sm_reg = RMAPPlugin0.Read( address_CTRL_SM, 1)
85 MEM_OUT_SM_Empty = (sm_reg[0] & 0x00000030) >> 4
86 if MEM_OUT_SM_Empty == 0x3:
87 ret = 1
88 return ret
89
90 def is_MEM_OUT_SM_Full( ):
91 ret = 0
92 sm_reg = RMAPPlugin0.Read( address_CTRL_SM, 1)
93 MEM_OUT_SM_Full = (sm_reg[0] & 0x0000000c) >> 2
94 if MEM_OUT_SM_Full != 0x0:
95 ret = 1
96 return ret
97
98 def is_MEM_OUT_SM_Full_FIFO_0( ):
99 ret = 0
100 sm_reg = RMAPPlugin0.Read( address_CTRL_SM, 1)
101 MEM_OUT_SM_Full = (sm_reg[0] & 0x00000004) >> 3
102 if MEM_OUT_SM_Full == 0x01:
103 ret = 1
104 return ret
105
106 def is_MEM_OUT_SM_Full_FIFO_1( ):
107 ret = 0
108 sm_reg = RMAPPlugin0.Read( address_CTRL_SM, 1)
109 MEM_OUT_SM_Full = (sm_reg[0] & 0x00000008) >> 3
110 if MEM_OUT_SM_Full == 0x01:
111 ret = 1
112 return ret
113
114 def out_locked_AND_out_reuse_AND_out_ren( ):
115 # reuse => 0111 1111 1111 1111
116 RMAPPlugin0.Write( address_CTRL, [0x00007fff] )
117
59 def convertToSigned16Bits( dataToConvert ):
118 def convertToSigned16Bits( dataToConvert ):
60 dataInInt16 = np.int16( dataToConvert )
119 dataInInt16 = np.int16( dataToConvert )
61 if dataInInt16 < 32768:
120 if dataInInt16 < 32768:
62 val = dataInInt16
121 val = dataInInt16
63 else:
122 else:
64 val = dataInInt16 - 65536
123 val = dataInInt16 - 65536
65 return val
124 return val
66
125
67 def convertVectorToSigned16Bits( bufferSize, dataBuffer ):
126 def convertVectorToSigned16Bits( bufferSize, dataBuffer ):
68 dataBufferConverted = np.zeros( bufferSize )
127 dataBufferConverted = np.zeros( bufferSize )
69 for k in range( bufferSize ):
128 for k in range( bufferSize ):
70 dataBufferConverted[k] = convertToSigned16Bits( dataBuffer[k] )
129 dataBufferConverted[k] = convertToSigned16Bits( dataBuffer[k] )
71 return dataBufferConverted
130 return dataBufferConverted
72
131
73 def convertToSigned8Bits( dataToConvert ):
132 def convertToSigned8Bits( dataToConvert ):
74 dataInInt16 = np.int8( dataToConvert )
133 dataInInt16 = np.int8( dataToConvert )
75 if dataInInt16 < 8:
134 if dataInInt16 < 8:
76 val = dataInInt16
135 val = dataInInt16
77 else:
136 else:
78 val = dataInInt16 - 16
137 val = dataInInt16 - 16
79 return val
138 return val
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,31 +1,36
1 # FIFO F0
1 # FIFO F0
2 address_FIFO_F0_1_0 = 0x80000f00
2 address_FIFO_F0_1_0 = 0x80000f00
3 address_FIFO_F0_3_2 = 0x80000f04
3 address_FIFO_F0_3_2 = 0x80000f04
4 address_FIFO_F0_4 = 0x80000f08
4 address_FIFO_F0_4 = 0x80000f08
5 address_FIFO_F0_WEN = 0x80000f0c
5 address_FIFO_F0_WEN = 0x80000f0c
6 # FIFO F1
6 # FIFO F1
7 address_FIFO_F1_1_0 = 0x80000f10
7 address_FIFO_F1_1_0 = 0x80000f10
8 address_FIFO_F1_3_2 = 0x80000f14
8 address_FIFO_F1_3_2 = 0x80000f14
9 address_FIFO_F1_4 = 0x80000f18
9 address_FIFO_F1_4 = 0x80000f18
10 address_FIFO_F1_WEN = 0x80000f1c
10 address_FIFO_F1_WEN = 0x80000f1c
11 # FIFO F2
11 # FIFO F2
12 address_FIFO_F2_1_0 = 0x80000f20
12 address_FIFO_F2_1_0 = 0x80000f20
13 address_FIFO_F2_3_2 = 0x80000f24
13 address_FIFO_F2_3_2 = 0x80000f24
14 address_FIFO_F2_4 = 0x80000f28
14 address_FIFO_F2_4 = 0x80000f28
15 address_FIFO_F2_WEN = 0x80000f2c
15 address_FIFO_F2_WEN = 0x80000f2c
16
16
17 address_MEM_IN_SM_0 = 0x80000f30
17 address_MEM_IN_SM_0 = 0x80000f30
18 address_MEM_IN_SM_1 = 0x80000f34
18 address_MEM_IN_SM_1 = 0x80000f34
19 address_MEM_IN_SM_2 = 0x80000f38
19 address_MEM_IN_SM_2 = 0x80000f38
20 address_MEM_IN_SM_3 = 0x80000f3c
20 address_MEM_IN_SM_3 = 0x80000f3c
21 address_MEM_IN_SM_4 = 0x80000f40
21 address_MEM_IN_SM_4 = 0x80000f40
22
22
23 address_CTRL = 0x80000f44
23 address_CTRL = 0x80000f44
24
24
25 address_MEM_OUT_SM_0= 0x80000f30
26 address_MEM_OUT_SM_1= 0x80000f34
27
28 address_CTRL_SM = 0x80000f38
29
25 #
30 #
26 columnV = 1
31 columnV = 1
27 columnE1 = 2
32 columnE1 = 2
28 columnE2 = 3
33 columnE2 = 3
29 columnB1 = 4
34 columnB1 = 4
30 columnB2 = 5
35 columnB2 = 5
31 columnB3 = 6 No newline at end of file
36 columnB3 = 6
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,172 +1,232
1 import os
1 import os
2 os.system('clear') # on linux / os x
2 os.system('clear') # on linux / os x
3
3
4 import numpy as np
4 import numpy as np
5 import matplotlib.pyplot as plt
5 import matplotlib.pyplot as plt
6
6
7 from test_fft.register_addresses_fft_test import *
7 from test_fft.register_addresses_fft_test import *
8 from test_fft.fft_test_functions import *
8 from test_fft.fft_test_functions import *
9
9
10 print '*'
10 print_custom( '*' )
11 print '*'
11 print_custom( '*' )
12 print '*'
12 print_custom( '*' )
13 print '*'
13 print_custom( '*' )
14 print '*'
14 print_custom( '*' )
15
15
16 ######################
16 ######################
17 # GET DATA FROM RECORD
17 # GET DATA FROM RECORD
18 storageDirectory = '/home/paul/data/2014_06_24/'
18 #storageDirectory = '/home/paul/data/2014_06_24/'
19 day = '2014_6_24-'
19 #day = '2014_6_24-'
20 hour = '9_0_3'
20 #hour = '9_0_3'
21 suffix = '.data'
21 #suffix = '.data'
22
22
23 typeOfData = '_SBM1_CWF_'
23 #typeOfData = '_SBM1_CWF_'
24 cwf_f1 = np.genfromtxt( storageDirectory + day + hour + typeOfData + 'F1' + suffix,
24 #cwf_f1 = np.genfromtxt( storageDirectory + day + hour + typeOfData + 'F1' + suffix,
25 skip_header = 1)
25 # skip_header = 1)
26 cwf_f1 = np.zeros( 1000 )
26
27
27 #################
28 #################
28 # BUILD WAVEFORMS
29 # BUILD WAVEFORMS
29 nbSamples = 256
30 nbSamples = 256
30 #wfrm0 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnV )
31 #wfrm0 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnV )
31 #wfrm1 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE1 )
32 #wfrm1 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE1 )
32 #wfrm2 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE2 )
33 #wfrm2 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE2 )
33 #wfrm3 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB1 )
34 #wfrm3 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB1 )
34 #wfrm4 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB2 )
35 #wfrm4 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB2 )
35 wfrm0 = sineWave( 256, 10, 1000 )
36 wfrm0 = sineWave( 256, 10, 1000 )
36 wfrm1 = dirac( 256, 1000 )
37 wfrm1 = dirac( 256, 1000 )
37 wfrm2 = step( 256, 1000 )
38 wfrm2 = step( 256, 1000 )
38 wfrm3 = np.zeros( 256 )
39 wfrm3 = continuous( 256, 100 )
39 wfrm4 = np.zeros( 256 )
40 wfrm4 = continuous( 256, 1000 )
40
41
41 ################
42 ################
42 # BUILD THE DATA
43 # BUILD THE DATA
43 dataToWrite0 = generateDataToWrite( nbSamples, wfrm0, wfrm1 )
44 dataToWrite0 = generateDataToWrite( nbSamples, wfrm0, wfrm1 )
44 dataToWrite1 = generateDataToWrite( nbSamples, wfrm2, wfrm3 )
45 dataToWrite1 = generateDataToWrite( nbSamples, wfrm2, wfrm3 )
45 dataToWrite2 = generateDataToWrite( nbSamples, wfrm4, np.zeros( nbSamples ) )
46 dataToWrite2 = generateDataToWrite( nbSamples, wfrm4, np.zeros( nbSamples ) )
46
47
48 ########################
49 # WRITE WAVEFORM IN FIFO
50 print_custom( "1) write waveforms in FIFOs: " + str(len(dataToWrite0)) + " samples" )
47 print_reg_fft( )
51 print_reg_fft( )
48
52
49 # WRITE WAVEFORM IN FIFO
50 print "write waveforms in FIFOs: " + str(len(dataToWrite0)) + " samples"
51
52 for k in range(nbSamples):
53 for k in range(nbSamples):
53 RMAPPlugin0.Write( address_FIFO_F2_1_0, [dataToWrite0[k]] )
54 RMAPPlugin0.Write( address_FIFO_F2_1_0, [dataToWrite0[k]] )
54 RMAPPlugin0.Write( address_FIFO_F2_3_2, [dataToWrite1[k]] )
55 RMAPPlugin0.Write( address_FIFO_F2_3_2, [dataToWrite1[k]] )
55 RMAPPlugin0.Write( address_FIFO_F2_4, [dataToWrite2[k]] )
56 RMAPPlugin0.Write( address_FIFO_F2_4, [dataToWrite2[k]] )
56 # write only the FIFO F2
57 # write only the FIFO F2
57 RMAPPlugin0.Write( address_FIFO_F2_WEN, [0xffffffe0] )
58 RMAPPlugin0.Write( address_FIFO_F2_WEN, [0xffffffe0] )
58
59
59 print "data written in FIFOs"
60 print_custom( "1) data written in FIFOs" )
60
61
61 print_reg_fft( )
62 print_reg_fft( )
62
63
63 # LOCK FIFOs => 0111 1100 0001 1111
64 # LOCK FIFOs => 0111 1100 0001 1111
64 RMAPPlugin0.Write( address_CTRL, [0x00007c1f] )
65 RMAPPlugin0.Write( address_CTRL, [0x00007c1f] )
65
66
66 # wait for SM_Full
67 # wait for SM_Full
67 fft_reg = RMAPPlugin0.Read( address_CTRL, 1)
68 fft_reg = RMAPPlugin0.Read( address_CTRL, 1)
68 while (fft_reg[0] & 0x000f8000) == 0:
69 while (fft_reg[0] & 0x000f8000) == 0:
69 print "SM not full"
70 print_custom( "SM not full" )
70 fft_reg = RMAPPlugin0.Read( address_CTRL, 1)
71 fft_reg = RMAPPlugin0.Read( address_CTRL, 1)
71
72
72 print_reg_fft( )
73 print_reg_fft( )
73
74
74 # READ FFT
75 ################
75 print "read data in fft FIFOs"
76 # FFT FIRST READ
77 print_custom( "======= FIRST READ" )
76 fft0_re = np.zeros( nbSamples )
78 fft0_re = np.zeros( nbSamples )
77 fft0_im = np.zeros( nbSamples )
79 fft0_im = np.zeros( nbSamples )
78 fft1_re = np.zeros( nbSamples )
80 fft1_re = np.zeros( nbSamples )
79 fft1_im = np.zeros( nbSamples )
81 fft1_im = np.zeros( nbSamples )
80 fft2_re = np.zeros( nbSamples )
82 fft2_re = np.zeros( nbSamples )
81 fft2_im = np.zeros( nbSamples )
83 fft2_im = np.zeros( nbSamples )
82 fft3_re = np.zeros( nbSamples )
84 fft3_re = np.zeros( nbSamples )
83 fft3_im = np.zeros( nbSamples )
85 fft3_im = np.zeros( nbSamples )
84 fft4_re = np.zeros( nbSamples )
86 fft4_re = np.zeros( nbSamples )
85 fft4_im = np.zeros( nbSamples )
87 fft4_im = np.zeros( nbSamples )
86
88
87 for k in range(128):
89 for k in range(128):
90 # read enable => 0111 1100 0000 0000
91 RMAPPlugin0.Write( address_CTRL, [0x00007c00] )
88 val = RMAPPlugin0.Read( address_MEM_IN_SM_0, 1)
92 val = RMAPPlugin0.Read( address_MEM_IN_SM_0, 1)
89 fft0_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
93 fft0_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
90 fft0_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
94 fft0_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
91 val = RMAPPlugin0.Read( address_MEM_IN_SM_1, 1)
95 val = RMAPPlugin0.Read( address_MEM_IN_SM_1, 1)
92 fft1_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
96 fft1_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
93 fft1_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
97 fft1_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
94 val = RMAPPlugin0.Read( address_MEM_IN_SM_2, 1)
98 val = RMAPPlugin0.Read( address_MEM_IN_SM_2, 1)
95 fft2_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
99 fft2_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
96 fft2_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
100 fft2_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
97 val = RMAPPlugin0.Read( address_MEM_IN_SM_3, 1)
101 val = RMAPPlugin0.Read( address_MEM_IN_SM_3, 1)
98 fft3_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
102 fft3_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
99 fft3_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
103 fft3_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
100 val = RMAPPlugin0.Read( address_MEM_IN_SM_4, 1)
104 val = RMAPPlugin0.Read( address_MEM_IN_SM_4, 1)
101 fft4_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
105 fft4_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
102 fft4_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
106 fft4_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
103 # read enable => 0111 1100 0000 0000
107 if is_MEM_IN_SM_Emty( ) == 1:
104 RMAPPlugin0.Write( address_CTRL, [0x00007c00] )
108 print_custom( "k = " + str( k ) )
105
109
106 fft0 = fft0_re * fft0_re + fft0_im * fft0_im
110 fft0 = fft0_re * fft0_re + fft0_im * fft0_im
107 fft1 = fft1_re * fft1_re + fft1_im * fft1_im
111 fft1 = fft1_re * fft1_re + fft1_im * fft1_im
108 fft2 = fft2_re * fft2_re + fft2_im * fft2_im
112 fft2 = fft2_re * fft2_re + fft2_im * fft2_im
109 fft3 = fft3_re * fft3_re + fft3_im * fft3_im
113 fft3 = fft3_re * fft3_re + fft3_im * fft3_im
110 fft4 = fft4_re * fft4_re + fft4_im * fft4_im
114 fft4 = fft4_re * fft4_re + fft4_im * fft4_im
111
115
112 print "data read in fft FIFOs"
116 #######
117 # REUSE
118 print_custom( "======= REUSE" )
119 out_locked_AND_out_reuse_AND_out_ren()
120 print_reg_fft( )
121
122 print_custom( "read data in fft FIFOs" )
123 fft0_re = np.zeros( nbSamples )
124 fft0_im = np.zeros( nbSamples )
125 fft1_re = np.zeros( nbSamples )
126 fft1_im = np.zeros( nbSamples )
127 fft2_re = np.zeros( nbSamples )
128 fft2_im = np.zeros( nbSamples )
129 fft3_re = np.zeros( nbSamples )
130 fft3_im = np.zeros( nbSamples )
131 fft4_re = np.zeros( nbSamples )
132 fft4_im = np.zeros( nbSamples )
133
134 for k in range(128):
135 # read enable => 0111 1100 0000 0000
136 val = RMAPPlugin0.Read( address_MEM_IN_SM_0, 1)
137 fft0_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
138 fft0_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
139 val = RMAPPlugin0.Read( address_MEM_IN_SM_1, 1)
140 fft1_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
141 fft1_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
142 val = RMAPPlugin0.Read( address_MEM_IN_SM_2, 1)
143 fft2_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
144 fft2_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
145 val = RMAPPlugin0.Read( address_MEM_IN_SM_3, 1)
146 fft3_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
147 fft3_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
148 val = RMAPPlugin0.Read( address_MEM_IN_SM_4, 1)
149 fft4_re[k] = convertToSigned16Bits( val[0] & 0x0000ffff )
150 fft4_im[k] = convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
151 RMAPPlugin0.Write( address_CTRL, [0x00007c00] )
152 if is_MEM_IN_SM_Emty( ) == 1:
153 print_custom( "k = " + str( k ) )
154
155 fft0_b = fft0_re * fft0_re + fft0_im * fft0_im
156 fft1_b = fft1_re * fft1_re + fft1_im * fft1_im
157 fft2_b = fft2_re * fft2_re + fft2_im * fft2_im
158 fft3_b = fft3_re * fft3_re + fft3_im * fft3_im
159 fft4_b = fft4_re * fft4_re + fft4_im * fft4_im
160
161 print_custom( "data read in fft FIFOs" )
113
162
114 print_reg_fft( )
163 print_reg_fft( )
115
164
116 #unlock FIFOs => 0000 0000 0001 1111
165 #unlock FIFOs => 0000 0000 0001 1111
117 RMAPPlugin0.Write( address_CTRL, [0x0000001f] )
166 RMAPPlugin0.Write( address_CTRL, [0x0000001f] )
118
167
119 print_reg_fft( )
168 print_reg_fft( )
120
169
121 # PLOT FFT
170 # PLOT FFT
122
171
123 plt.figure( 1 )
172 plt.figure( 1 )
124 plt.subplot(231)
173 plt.subplot(231)
125 plt.plot(wfrm0, 'b')
174 plt.plot(wfrm0, 'b')
126 plt.subplot(232)
175 plt.subplot(232)
127 plt.plot(wfrm1, 'g')
176 plt.plot(wfrm1, 'g')
128 plt.plot(wfrm1, '.')
177 plt.plot(wfrm1, '.')
129 plt.subplot(233)
178 plt.subplot(233)
130 plt.plot(wfrm2, 'r')
179 plt.plot(wfrm2, 'r')
131 plt.plot(wfrm2, '.')
180 plt.plot(wfrm2, '.')
132 plt.subplot(234)
181 plt.subplot(234)
133 plt.plot(wfrm3, 'c')
182 plt.plot(wfrm3, 'c')
134 plt.subplot(235)
183 plt.subplot(235)
135 plt.plot(wfrm4, 'm')
184 plt.plot(wfrm4, 'm')
136
185
137 plt.figure( 2 )
186 plt.figure( 2 )
138 plt.subplot(311)
187 plt.subplot(311)
139 plt.plot(fft0_re)
188 plt.plot(fft0_re)
140 plt.plot(fft1_re)
189 plt.plot(fft1_re)
141 plt.plot(fft2_re)
190 plt.plot(fft2_re)
142 plt.plot(fft3_re)
191 plt.plot(fft3_re)
143 plt.plot(fft4_re)
192 plt.plot(fft4_re)
144
193
145 plt.subplot(312)
194 plt.subplot(312)
146 plt.plot(fft0_im)
195 plt.plot(fft0_im)
147 plt.plot(fft1_im)
196 plt.plot(fft1_im)
148 plt.plot(fft2_im)
197 plt.plot(fft2_im)
149 plt.plot(fft3_im)
198 plt.plot(fft3_im)
150 plt.plot(fft4_im)
199 plt.plot(fft4_im)
151
200
152 plt.subplot(313)
201 plt.subplot(313)
153 plt.plot(fft0_re * fft0_re + fft0_im * fft0_im, 'b')
202 plt.plot(fft0_re * fft0_re + fft0_im * fft0_im, 'b')
154 plt.plot(fft1_re * fft1_re + fft1_im * fft1_im, 'g')
203 plt.plot(fft1_re * fft1_re + fft1_im * fft1_im, 'g')
155 plt.plot(fft2_re * fft2_re + fft2_im * fft2_im, 'r')
204 plt.plot(fft2_re * fft2_re + fft2_im * fft2_im, 'r')
156 plt.plot(fft3_re * fft3_re + fft3_im * fft3_im, 'c')
205 plt.plot(fft3_re * fft3_re + fft3_im * fft3_im, 'c')
157 plt.plot(fft4_re * fft4_re + fft4_im * fft4_im, 'm')
206 plt.plot(fft4_re * fft4_re + fft4_im * fft4_im, 'm')
158
207
159 plt.figure( 3 )
208 plt.figure( 3 )
160 plt.subplot(231)
209 plt.subplot(231)
161 plt.plot(fft0[0:255], 'b')
210 plt.plot(fft0[0:255], 'b')
162 plt.subplot(232)
211 plt.subplot(232)
163 plt.plot(fft1[0:255], 'g')
212 plt.plot(fft1[0:255], 'g')
164 plt.subplot(233)
213 plt.subplot(233)
165 plt.plot(fft2[0:255], 'r')
214 plt.plot(fft2[0:255], 'r')
166 plt.subplot(234)
215 plt.subplot(234)
167 plt.plot(fft3[0:255], 'c')
216 plt.plot(fft3[0:255], 'c')
168 plt.subplot(235)
217 plt.subplot(235)
169 plt.plot(fft4[0:255], 'm')
218 plt.plot(fft4[0:255], 'm')
170
219
220 plt.figure( 4 )
221 plt.subplot(231)
222 plt.plot(fft0_b[0:255], 'b')
223 plt.subplot(232)
224 plt.plot(fft1_b[0:255], 'g')
225 plt.subplot(233)
226 plt.plot(fft2_b[0:255], 'r')
227 plt.subplot(234)
228 plt.plot(fft3_b[0:255], 'c')
229 plt.subplot(235)
230 plt.plot(fft4_b[0:255], 'm')
171
231
172 plt.show() No newline at end of file
232 plt.show()
General Comments 0
You need to be logged in to leave comments. Login now