@@ -0,0 +1,128 | |||||
|
1 | import numpy as np | |||
|
2 | ||||
|
3 | from test_fft.register_addresses_fft_test import * | |||
|
4 | ||||
|
5 | from __main__ import RMAPPlugin0 | |||
|
6 | ||||
|
7 | def print_custom( value ): | |||
|
8 | print value | |||
|
9 | RMAPPlugin0.ProcessPendingEvents() | |||
|
10 | ||||
|
11 | def read_SM_Re( nbFrequencyBins, address_MEM_OUT_SM ): | |||
|
12 | currentComp_re = np.zeros( nbFrequencyBins ) | |||
|
13 | if address_MEM_OUT_SM == address_MEM_OUT_SM_0: | |||
|
14 | mask_REN = mask_REN_FIFO_0 | |||
|
15 | elif address_MEM_OUT_SM == address_MEM_OUT_SM_1: | |||
|
16 | mask_REN = mask_REN_FIFO_1 | |||
|
17 | else: | |||
|
18 | print_custom( "ERR *** read_SM_Re *** unexpected address_MEM_OUT_SM" ) | |||
|
19 | for frequencyBin in range(nbFrequencyBins): | |||
|
20 | # read Re | |||
|
21 | RMAPPlugin0.Write( address_CTRL_SM, [mask_REN] ) | |||
|
22 | val = RMAPPlugin0.Read( address_MEM_OUT_SM, 1) | |||
|
23 | currentComp_re[frequencyBin] = val[0] | |||
|
24 | RMAPPlugin0.ProcessPendingEvents() | |||
|
25 | return currentComp_re | |||
|
26 | ||||
|
27 | def read_SM_Re_Im( nbFrequencyBins, address_MEM_OUT_SM ): | |||
|
28 | currentComp_re = np.zeros( nbFrequencyBins ) | |||
|
29 | currentComp_im = np.zeros( nbFrequencyBins ) | |||
|
30 | if address_MEM_OUT_SM == address_MEM_OUT_SM_0: | |||
|
31 | mask_REN = mask_REN_FIFO_0 | |||
|
32 | elif address_MEM_OUT_SM == address_MEM_OUT_SM_1: | |||
|
33 | mask_REN = mask_REN_FIFO_1 | |||
|
34 | else: | |||
|
35 | print_custom( "ERR *** read_SM_Re_Im *** unexpected address_MEM_OUT_SM" ) | |||
|
36 | for frequencyBin in range(nbFrequencyBins): | |||
|
37 | # read Re | |||
|
38 | RMAPPlugin0.Write( address_CTRL_SM, [mask_REN] ) | |||
|
39 | val = RMAPPlugin0.Read( address_MEM_OUT_SM, 1) | |||
|
40 | currentComp_re[frequencyBin] = val[0] | |||
|
41 | # read Im | |||
|
42 | RMAPPlugin0.Write( address_CTRL_SM, [mask_REN] ) | |||
|
43 | val = RMAPPlugin0.Read( address_MEM_OUT_SM, 1) | |||
|
44 | currentComp_im[frequencyBin] = val[0] | |||
|
45 | RMAPPlugin0.ProcessPendingEvents() | |||
|
46 | return (currentComp_re, currentComp_im) | |||
|
47 | ||||
|
48 | def is_MEM_OUT_SM_Empty( ): | |||
|
49 | ret = 0 | |||
|
50 | sm_reg = RMAPPlugin0.Read( address_CTRL_SM, 1) | |||
|
51 | MEM_OUT_SM_Empty = (sm_reg[0] & 0x00000030) >> 4 | |||
|
52 | if MEM_OUT_SM_Empty == 0x3: | |||
|
53 | ret = 1 | |||
|
54 | return ret | |||
|
55 | ||||
|
56 | def is_MEM_OUT_SM_Full( ): | |||
|
57 | ret = 0 | |||
|
58 | sm_reg = RMAPPlugin0.Read( address_CTRL_SM, 1) | |||
|
59 | MEM_OUT_SM_Full = (sm_reg[0] & 0x0000000c) >> 2 | |||
|
60 | if MEM_OUT_SM_Full != 0x0: | |||
|
61 | ret = 1 | |||
|
62 | return ret | |||
|
63 | ||||
|
64 | def is_MEM_OUT_SM_Full_FIFO_0( ): | |||
|
65 | ret = 0 | |||
|
66 | sm_reg = RMAPPlugin0.Read( address_CTRL_SM, 1) | |||
|
67 | MEM_OUT_SM_Full = (sm_reg[0] & 0x00000004) >> 2 | |||
|
68 | if MEM_OUT_SM_Full == 0x01: | |||
|
69 | ret = 1 | |||
|
70 | return ret | |||
|
71 | ||||
|
72 | def is_MEM_OUT_SM_Full_FIFO_1( ): | |||
|
73 | ret = 0 | |||
|
74 | sm_reg = RMAPPlugin0.Read( address_CTRL_SM, 1) | |||
|
75 | MEM_OUT_SM_Full = (sm_reg[0] & 0x00000008) >> 3 | |||
|
76 | if MEM_OUT_SM_Full == 0x01: | |||
|
77 | ret = 1 | |||
|
78 | return ret | |||
|
79 | ||||
|
80 | def wait_for_FIFO_0_Full(): | |||
|
81 | counter = 0 | |||
|
82 | while ( is_MEM_OUT_SM_Full_FIFO_0() == 0 ): | |||
|
83 | print_custom( "FIFO_0 not full " + str(counter) ) | |||
|
84 | counter = counter + 1 | |||
|
85 | if counter == 10: | |||
|
86 | break | |||
|
87 | ||||
|
88 | def wait_for_FIFO_1_Full(): | |||
|
89 | counter = 0 | |||
|
90 | while ( is_MEM_OUT_SM_Full_FIFO_1() == 0 ): | |||
|
91 | print_custom( "FIFO_1 not full " + str(counter)) | |||
|
92 | counter = counter + 1 | |||
|
93 | if counter == 10: | |||
|
94 | break | |||
|
95 | ||||
|
96 | def wait_for_FIFO_Full( fifo ): | |||
|
97 | if fifo == 0: | |||
|
98 | wait_for_FIFO_0_Full() | |||
|
99 | elif fifo == 1: | |||
|
100 | wait_for_FIFO_1_Full() | |||
|
101 | else: | |||
|
102 | print_custom( "ERR *** wait_for_FIFO_Full *** unexpted value for parameter [fifo]" ) | |||
|
103 | ||||
|
104 | def wait_for_FIFO_0_or_1_Full(): | |||
|
105 | counter = 0 | |||
|
106 | sm_reg = RMAPPlugin0.Read( address_CTRL_SM, 1) | |||
|
107 | MEM_OUT_SM_Full = (sm_reg[0] & 0x0000000c) >> 2 | |||
|
108 | while ( MEM_OUT_SM_Full == 0 ): | |||
|
109 | print_custom( "FIFO 0 or 1 not full " + str(counter)) | |||
|
110 | counter = counter + 1 | |||
|
111 | if counter == 10: | |||
|
112 | break | |||
|
113 | sm_reg = RMAPPlugin0.Read( address_CTRL_SM, 1) | |||
|
114 | MEM_OUT_SM_Full = (sm_reg[0] & 0x0000000c) >> 2 | |||
|
115 | RMAPPlugin0.ProcessPendingEvents() | |||
|
116 | ||||
|
117 | def print_reg_sm( ): | |||
|
118 | sm_reg = RMAPPlugin0.Read( address_CTRL_SM, 1) | |||
|
119 | out_ren = (sm_reg[0] & 0x00000003) | |||
|
120 | MEM_OUT_SM_Full = (sm_reg[0] & 0x0000000c) >> 2 | |||
|
121 | MEM_OUT_SM_Empty = (sm_reg[0] & 0x00000030) >> 4 | |||
|
122 | MEM_OUT_SM_Full_s= (sm_reg[0] & 0x00000040) >> 6 | |||
|
123 | print "sm_reg = " + bin( sm_reg[0] & 0x7f ) \ | |||
|
124 | + ", out_ren = " + bin( out_ren ) \ | |||
|
125 | + ", MEM_OUT_SM_Full = " + bin( MEM_OUT_SM_Full ) \ | |||
|
126 | + ", MEM_OUT_SM_Empty = " + bin( MEM_OUT_SM_Empty ) \ | |||
|
127 | + ", MEM_OUT_SM_Full_s = " + bin( MEM_OUT_SM_Full_s ) | |||
|
128 | RMAPPlugin0.ProcessPendingEvents() No newline at end of file |
@@ -1,416 +1,451 | |||||
1 | { |
|
1 | { | |
2 | "auto_complete": |
|
2 | "auto_complete": | |
3 | { |
|
3 | { | |
4 | "selected_items": |
|
4 | "selected_items": | |
5 | [ |
|
5 | [ | |
6 | [ |
|
6 | [ | |
7 |
" |
|
7 | "fi", | |
8 | "c" |
|
8 | "fifo_to_wait_for" | |
|
9 | ], | |||
|
10 | [ | |||
|
11 | "MEM", | |||
|
12 | "MEM_OUT_SM_Full" | |||
|
13 | ], | |||
|
14 | [ | |||
|
15 | "add", | |||
|
16 | "address_MEM_OUT_SM" | |||
|
17 | ], | |||
|
18 | [ | |||
|
19 | "addrses", | |||
|
20 | "address_MEM_OUT_SM_0" | |||
|
21 | ], | |||
|
22 | [ | |||
|
23 | "address_MEM", | |||
|
24 | "address_MEM_OUT_SM_1" | |||
9 | ], |
|
25 | ], | |
10 | [ |
|
26 | [ | |
11 | "g", |
|
27 | "address_M", | |
12 | "g" |
|
28 | "address_MEM_OUT_SM_1" | |
|
29 | ], | |||
|
30 | [ | |||
|
31 | "ad", | |||
|
32 | "address_MEM_OUT_SM_0" | |||
13 | ], |
|
33 | ], | |
14 | [ |
|
34 | [ | |
15 | "compo", |
|
35 | "address", | |
16 | "components_re" |
|
36 | "address_MEM_OUT_SM" | |
17 | ], |
|
37 | ], | |
18 | [ |
|
38 | [ | |
19 |
" |
|
39 | "print", | |
|
40 | "print_custom" | |||
|
41 | ], | |||
|
42 | [ | |||
|
43 | "is_MEM_OUT_SM_Full_", | |||
|
44 | "is_MEM_OUT_SM_Full_FIFO_0" | |||
|
45 | ], | |||
|
46 | [ | |||
|
47 | "curre", | |||
20 | "currentComp_im" |
|
48 | "currentComp_im" | |
21 | ], |
|
49 | ], | |
22 | [ |
|
50 | [ | |
23 | "current", |
|
51 | "MEM_OUT_SM_Ful", | |
24 | "currentComp_im" |
|
52 | "MEM_OUT_SM_Full_s" | |
|
53 | ], | |||
|
54 | [ | |||
|
55 | "fft0", | |||
|
56 | "fft0_im" | |||
|
57 | ], | |||
|
58 | [ | |||
|
59 | "fft", | |||
|
60 | "fft0_im" | |||
|
61 | ], | |||
|
62 | [ | |||
|
63 | "dataB", | |||
|
64 | "dataBufferConverted" | |||
25 | ], |
|
65 | ], | |
26 | [ |
|
66 | [ | |
27 |
"c |
|
67 | "convert", | |
28 | "currentComp_re" |
|
68 | "convertToSigned16Bits" | |
|
69 | ], | |||
|
70 | [ | |||
|
71 | "data", | |||
|
72 | "dataInInt16" | |||
29 | ], |
|
73 | ], | |
30 | [ |
|
74 | [ | |
31 |
" |
|
75 | "wfrm", | |
32 | "nbComponentsPerMatrix" |
|
76 | "wfrm2" | |
33 | ], |
|
77 | ], | |
34 | [ |
|
78 | [ | |
35 |
" |
|
79 | "column", | |
36 | "MEM_IN_SM_Empty" |
|
80 | "columnB3" | |
|
81 | ], | |||
|
82 | [ | |||
|
83 | "colum", | |||
|
84 | "columnV" | |||
37 | ], |
|
85 | ], | |
38 | [ |
|
86 | [ | |
39 | "out_re", |
|
87 | "out_re", | |
40 | "out_ren" |
|
88 | "out_ren" | |
41 | ], |
|
89 | ], | |
42 | [ |
|
90 | [ | |
43 | "fft", |
|
|||
44 | "fft_reg" |
|
|||
45 | ], |
|
|||
46 | [ |
|
|||
47 | "address_MEM", |
|
|||
48 | "address_MEM_IN_SM_0" |
|
|||
49 | ], |
|
|||
50 | [ |
|
|||
51 | "wfr", |
|
91 | "wfr", | |
52 | "wfrm0" |
|
92 | "wfrm0" | |
53 | ], |
|
93 | ], | |
54 | [ |
|
94 | [ | |
55 | "print", |
|
|||
56 | "print_reg_fft" |
|
|||
57 | ], |
|
|||
58 | [ |
|
|||
59 | "sin", |
|
95 | "sin", | |
60 | "sineWave" |
|
96 | "sineWave" | |
61 | ], |
|
97 | ], | |
62 | [ |
|
98 | [ | |
63 | "if", |
|
99 | "if", | |
64 | "ifmain if __name__ == '__main__'" |
|
100 | "ifmain if __name__ == '__main__'" | |
65 | ], |
|
101 | ], | |
66 | [ |
|
102 | [ | |
67 | "address_", |
|
103 | "address_", | |
68 | "address_MEM_IN_SM_0" |
|
104 | "address_MEM_IN_SM_0" | |
69 | ], |
|
105 | ], | |
70 | [ |
|
106 | [ | |
71 | "wf", |
|
107 | "wf", | |
72 | "wfrm0" |
|
108 | "wfrm0" | |
73 | ], |
|
109 | ], | |
74 | [ |
|
110 | [ | |
75 | "address_FIFO_F0_", |
|
111 | "address_FIFO_F0_", | |
76 | "address_FIFO_F0_4" |
|
112 | "address_FIFO_F0_4" | |
77 | ], |
|
113 | ], | |
78 | [ |
|
114 | [ | |
79 | "add", |
|
|||
80 | "address_CTRL" |
|
|||
81 | ], |
|
|||
82 | [ |
|
|||
83 | "wfrm", |
|
|||
84 | "wfrm1" |
|
|||
85 | ], |
|
|||
86 | [ |
|
|||
87 | "index", |
|
115 | "index", | |
88 | "indexTransformDecimationInFrequency" |
|
116 | "indexTransformDecimationInFrequency" | |
89 | ], |
|
117 | ], | |
90 | [ |
|
118 | [ | |
91 | "in", |
|
119 | "in", | |
92 | "indexTransformDecimationInFrequency" |
|
120 | "indexTransformDecimationInFrequency" | |
93 | ], |
|
121 | ], | |
94 | [ |
|
122 | [ | |
95 | "dft", |
|
123 | "dft", | |
96 | "dft_val" |
|
124 | "dft_val" | |
97 | ], |
|
125 | ], | |
98 | [ |
|
126 | [ | |
99 | "butter", |
|
127 | "butter", | |
100 | "butterflyProcessor" |
|
128 | "butterflyProcessor" | |
101 | ], |
|
129 | ], | |
102 | [ |
|
130 | [ | |
103 | "chec", |
|
131 | "chec", | |
104 | "checkbox_sy_lfr_bw" |
|
132 | "checkbox_sy_lfr_bw" | |
105 | ], |
|
133 | ], | |
106 | [ |
|
134 | [ | |
107 | "send", |
|
135 | "send", | |
108 | "sendLoadCommonPar" |
|
136 | "sendLoadCommonPar" | |
109 | ], |
|
137 | ], | |
110 | [ |
|
138 | [ | |
111 | "groupbo", |
|
139 | "groupbo", | |
112 | "groupbox_tc_lfr_load_common_par" |
|
140 | "groupbox_tc_lfr_load_common_par" | |
113 | ], |
|
141 | ], | |
114 | [ |
|
142 | [ | |
115 | "l", |
|
143 | "l", | |
116 | "layout_tc" |
|
144 | "layout_tc" | |
117 | ], |
|
145 | ], | |
118 | [ |
|
146 | [ | |
119 | "button", |
|
147 | "button", | |
120 | "button_tc_lfr_load_common_par" |
|
148 | "button_tc_lfr_load_common_par" | |
121 | ], |
|
149 | ], | |
122 | [ |
|
150 | [ | |
123 | "a", |
|
151 | "a", | |
124 | "addWidget" |
|
152 | "addWidget" | |
125 | ], |
|
153 | ], | |
126 | [ |
|
154 | [ | |
127 | "group", |
|
155 | "group", | |
128 | "groupbox_tc_lfr_load_common_par" |
|
156 | "groupbox_tc_lfr_load_common_par" | |
129 | ], |
|
157 | ], | |
130 | [ |
|
158 | [ | |
|
159 | "c", | |||
|
160 | "common" | |||
|
161 | ], | |||
|
162 | [ | |||
131 | "laben", |
|
163 | "laben", | |
132 | "label_UNKNOWN_nb" |
|
164 | "label_UNKNOWN_nb" | |
133 | ], |
|
165 | ], | |
134 | [ |
|
166 | [ | |
135 | "UN", |
|
167 | "UN", | |
136 | "UNKNOWN_nb" |
|
168 | "UNKNOWN_nb" | |
137 | ] |
|
169 | ] | |
138 | ] |
|
170 | ] | |
139 | }, |
|
171 | }, | |
140 | "buffers": |
|
172 | "buffers": | |
141 | [ |
|
173 | [ | |
142 | { |
|
174 | { | |
143 | "file": "test_fft/test_sm_mini_lfr.py", |
|
175 | "file": "test_fft/test_sm_mini_lfr.py", | |
144 | "settings": |
|
176 | "settings": | |
145 | { |
|
177 | { | |
146 |
"buffer_size": |
|
178 | "buffer_size": 5847, | |
147 | "line_ending": "Unix" |
|
179 | "line_ending": "Unix" | |
148 | } |
|
180 | } | |
149 | }, |
|
181 | }, | |
150 | { |
|
182 | { | |
151 |
"file": "test_fft/ |
|
183 | "file": "test_fft/test_sm_functions.py", | |
152 | "settings": |
|
184 | "settings": | |
153 | { |
|
185 | { | |
154 |
"buffer_size": 3 |
|
186 | "buffer_size": 3914, | |
155 | "line_ending": "Unix" |
|
187 | "line_ending": "Unix" | |
156 | } |
|
188 | } | |
157 | }, |
|
189 | }, | |
158 | { |
|
190 | { | |
159 | "file": "test_fft/register_addresses_fft_test.py", |
|
191 | "file": "test_fft/register_addresses_fft_test.py", | |
160 | "settings": |
|
192 | "settings": | |
161 | { |
|
193 | { | |
162 |
"buffer_size": |
|
194 | "buffer_size": 873, | |
163 | "line_ending": "Unix" |
|
195 | "line_ending": "Unix" | |
164 | } |
|
196 | } | |
165 | } |
|
197 | } | |
166 | ], |
|
198 | ], | |
167 | "build_system": "", |
|
199 | "build_system": "", | |
168 | "command_palette": |
|
200 | "command_palette": | |
169 | { |
|
201 | { | |
170 | "height": 392.0, |
|
202 | "height": 392.0, | |
171 | "selected_items": |
|
203 | "selected_items": | |
172 | [ |
|
204 | [ | |
173 | ], |
|
205 | ], | |
174 | "width": 392.0 |
|
206 | "width": 392.0 | |
175 | }, |
|
207 | }, | |
176 | "console": |
|
208 | "console": | |
177 | { |
|
209 | { | |
178 | "height": 146.0 |
|
210 | "height": 146.0 | |
179 | }, |
|
211 | }, | |
180 | "distraction_free": |
|
212 | "distraction_free": | |
181 | { |
|
213 | { | |
182 | "menu_visible": true, |
|
214 | "menu_visible": true, | |
183 | "show_minimap": false, |
|
215 | "show_minimap": false, | |
184 | "show_open_files": false, |
|
216 | "show_open_files": false, | |
185 | "show_tabs": false, |
|
217 | "show_tabs": false, | |
186 | "side_bar_visible": false, |
|
218 | "side_bar_visible": false, | |
187 | "status_bar_visible": false |
|
219 | "status_bar_visible": false | |
188 | }, |
|
220 | }, | |
189 | "file_history": |
|
221 | "file_history": | |
190 | [ |
|
222 | [ | |
|
223 | "/opt/LFR_EMULATOR/test_fft/fft_test_functions.py", | |||
191 | "/opt/LFR_EMULATOR/test_fft/test_fft_mini_lfr.py", |
|
224 | "/opt/LFR_EMULATOR/test_fft/test_fft_mini_lfr.py", | |
|
225 | "/opt/LFR_EMULATOR/test_fft/register_addresses_fft_test.py", | |||
192 | "/opt/LFR_EMULATOR/test_fft/functions_evaluations.py", |
|
226 | "/opt/LFR_EMULATOR/test_fft/functions_evaluations.py", | |
193 | "/opt/LFR_EMULATOR/SRC/processing_chain.py", |
|
227 | "/opt/LFR_EMULATOR/SRC/processing_chain.py", | |
194 | "/opt/LFR_EMULATOR/main.py", |
|
228 | "/opt/LFR_EMULATOR/main.py", | |
195 | "/opt/LFR_EMULATOR/fft_8_decimation_in_frequency.py", |
|
229 | "/opt/LFR_EMULATOR/fft_8_decimation_in_frequency.py", | |
196 | "/opt/LFR_EMULATOR/SRC/basic_parameters_Int.py", |
|
230 | "/opt/LFR_EMULATOR/SRC/basic_parameters_Int.py", | |
197 | "/opt/LFR_EMULATOR/butterfly_processor.py", |
|
231 | "/opt/LFR_EMULATOR/butterfly_processor.py", | |
198 | "/opt/LFR_EMULATOR/index_transform_decimation_in_frequency.py", |
|
232 | "/opt/LFR_EMULATOR/index_transform_decimation_in_frequency.py", | |
199 | "/opt/LFR_EMULATOR/efficient_complex_multiplier.py", |
|
233 | "/opt/LFR_EMULATOR/efficient_complex_multiplier.py", | |
200 | "/opt/LFR_EMULATOR/twiddle_factors.py", |
|
234 | "/opt/LFR_EMULATOR/twiddle_factors.py", | |
201 | "/opt/LFR_EMULATOR/SRC/filters.py", |
|
235 | "/opt/LFR_EMULATOR/SRC/filters.py", | |
202 | "/opt/LFR_EMULATOR/SRC/test_cases1.py", |
|
236 | "/opt/LFR_EMULATOR/SRC/test_cases1.py", | |
203 | "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory.py", |
|
237 | "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory.py", | |
204 | "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory (copy).py", |
|
238 | "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory (copy).py", | |
205 | "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step01/grspw_registers.py", |
|
239 | "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step01/grspw_registers.py", | |
206 | "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0002/tc_during_matrix_transmission.py", |
|
240 | "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0002/tc_during_matrix_transmission.py", | |
207 | "/opt/VALIDATION/lfrverif/common/actions_tc_lfr_launcher.py", |
|
241 | "/opt/VALIDATION/lfrverif/common/actions_tc_lfr_launcher.py", | |
208 | "/opt/VALIDATION/lfrverif/common/test_monitor.py", |
|
242 | "/opt/VALIDATION/lfrverif/common/test_monitor.py", | |
209 | "/opt/VALIDATION/validation.sublime-workspace", |
|
243 | "/opt/VALIDATION/validation.sublime-workspace", | |
210 | "/opt/VALIDATION/validation.sublime-project", |
|
244 | "/opt/VALIDATION/validation.sublime-project", | |
211 | "/opt/PYTHON/lfrverif/test1/test1main.py", |
|
245 | "/opt/PYTHON/lfrverif/test1/test1main.py", | |
212 | "/opt/PYTHON/lfrverif/test1/test1launcher.py", |
|
246 | "/opt/PYTHON/lfrverif/test1/test1launcher.py", | |
213 | "/opt/PYTHON/lfrverif/common/crcforlfr.py", |
|
247 | "/opt/PYTHON/lfrverif/common/crcforlfr.py", | |
214 | "/opt/PYTHON/lfrverif/common/tcparams.py", |
|
248 | "/opt/PYTHON/lfrverif/common/tcparams.py", | |
215 | "/opt/PYTHON/lfrverif/test1/testgui.py", |
|
249 | "/opt/PYTHON/lfrverif/test1/testgui.py", | |
216 | "/opt/PYTHON/lfrverif/test1/tcmonitor.py", |
|
250 | "/opt/PYTHON/lfrverif/test1/tcmonitor.py", | |
217 | "/opt/PYTHON/lfrverif/test1/lppmoncfg.py", |
|
251 | "/opt/PYTHON/lfrverif/test1/lppmoncfg.py", | |
218 | "/opt/PYTHON/lfrverif/test1/wfdisplay.py", |
|
252 | "/opt/PYTHON/lfrverif/test1/wfdisplay.py", | |
219 | "/opt/PYTHON/lfrverif/test1/lppmonplot.py", |
|
253 | "/opt/PYTHON/lfrverif/test1/lppmonplot.py", | |
220 | "/opt/PYTHON/lfrverif/test1/tmmonitor.py" |
|
254 | "/opt/PYTHON/lfrverif/test1/tmmonitor.py" | |
221 | ], |
|
255 | ], | |
222 | "find": |
|
256 | "find": | |
223 | { |
|
257 | { | |
224 | "height": 34.0 |
|
258 | "height": 34.0 | |
225 | }, |
|
259 | }, | |
226 | "find_in_files": |
|
260 | "find_in_files": | |
227 | { |
|
261 | { | |
228 | "height": 0.0, |
|
262 | "height": 0.0, | |
229 | "where_history": |
|
263 | "where_history": | |
230 | [ |
|
264 | [ | |
231 | "/opt/VALIDATION/lfrverif", |
|
265 | "/opt/VALIDATION/lfrverif", | |
232 | "/opt/VALIDATION/lfrverif/LFR_SVS" |
|
266 | "/opt/VALIDATION/lfrverif/LFR_SVS" | |
233 | ] |
|
267 | ] | |
234 | }, |
|
268 | }, | |
235 | "find_state": |
|
269 | "find_state": | |
236 | { |
|
270 | { | |
237 | "case_sensitive": false, |
|
271 | "case_sensitive": false, | |
238 | "find_history": |
|
272 | "find_history": | |
239 | [ |
|
273 | [ | |
|
274 | "np", | |||
240 | "def displayInfoSendTc", |
|
275 | "def displayInfoSendTc", | |
241 | "dump", |
|
276 | "dump", | |
242 | "tc_lfr_dump_par", |
|
277 | "tc_lfr_dump_par", | |
243 | "processpac", |
|
278 | "processpac", | |
244 | "WriteSPWDelay", |
|
279 | "WriteSPWDelay", | |
245 | "sendPacket", |
|
280 | "sendPacket", | |
246 | "sendLoadCommonPar" |
|
281 | "sendLoadCommonPar" | |
247 | ], |
|
282 | ], | |
248 | "highlight": true, |
|
283 | "highlight": true, | |
249 | "in_selection": false, |
|
284 | "in_selection": false, | |
250 | "preserve_case": false, |
|
285 | "preserve_case": false, | |
251 | "regex": false, |
|
286 | "regex": false, | |
252 | "replace_history": |
|
287 | "replace_history": | |
253 | [ |
|
288 | [ | |
254 | ], |
|
289 | ], | |
255 | "reverse": false, |
|
290 | "reverse": false, | |
256 | "show_context": true, |
|
291 | "show_context": true, | |
257 | "use_buffer2": true, |
|
292 | "use_buffer2": true, | |
258 | "whole_word": false, |
|
293 | "whole_word": false, | |
259 | "wrap": true |
|
294 | "wrap": true | |
260 | }, |
|
295 | }, | |
261 | "groups": |
|
296 | "groups": | |
262 | [ |
|
297 | [ | |
263 | { |
|
298 | { | |
264 | "selected": 0, |
|
299 | "selected": 0, | |
265 | "sheets": |
|
300 | "sheets": | |
266 | [ |
|
301 | [ | |
267 | { |
|
302 | { | |
268 | "buffer": 0, |
|
303 | "buffer": 0, | |
269 | "file": "test_fft/test_sm_mini_lfr.py", |
|
304 | "file": "test_fft/test_sm_mini_lfr.py", | |
270 | "settings": |
|
305 | "settings": | |
271 | { |
|
306 | { | |
272 |
"buffer_size": |
|
307 | "buffer_size": 5847, | |
273 | "regions": |
|
308 | "regions": | |
274 | { |
|
309 | { | |
275 | }, |
|
310 | }, | |
276 | "selection": |
|
311 | "selection": | |
277 | [ |
|
312 | [ | |
278 | [ |
|
313 | [ | |
279 |
|
|
314 | 5847, | |
280 |
|
|
315 | 5847 | |
281 | ] |
|
316 | ] | |
282 | ], |
|
317 | ], | |
283 | "settings": |
|
318 | "settings": | |
284 | { |
|
319 | { | |
285 | "syntax": "Packages/Python/Python.tmLanguage", |
|
320 | "syntax": "Packages/Python/Python.tmLanguage", | |
286 | "translate_tabs_to_spaces": false |
|
321 | "translate_tabs_to_spaces": false | |
287 | }, |
|
322 | }, | |
288 | "translation.x": 0.0, |
|
323 | "translation.x": 0.0, | |
289 |
"translation.y": 1 |
|
324 | "translation.y": 1640.0, | |
290 | "zoom_level": 1.0 |
|
325 | "zoom_level": 1.0 | |
291 | }, |
|
326 | }, | |
292 | "type": "text" |
|
327 | "type": "text" | |
293 | }, |
|
328 | }, | |
294 | { |
|
329 | { | |
295 | "buffer": 1, |
|
330 | "buffer": 1, | |
296 |
"file": "test_fft/ |
|
331 | "file": "test_fft/test_sm_functions.py", | |
297 | "settings": |
|
332 | "settings": | |
298 | { |
|
333 | { | |
299 |
"buffer_size": 3 |
|
334 | "buffer_size": 3914, | |
300 | "regions": |
|
335 | "regions": | |
301 | { |
|
336 | { | |
302 | }, |
|
337 | }, | |
303 | "selection": |
|
338 | "selection": | |
304 | [ |
|
339 | [ | |
305 | [ |
|
340 | [ | |
306 |
2 |
|
341 | 2764, | |
307 |
2 |
|
342 | 2764 | |
308 | ] |
|
343 | ] | |
309 | ], |
|
344 | ], | |
310 | "settings": |
|
345 | "settings": | |
311 | { |
|
346 | { | |
312 | "syntax": "Packages/Python/Python.tmLanguage", |
|
347 | "syntax": "Packages/Python/Python.tmLanguage", | |
313 | "translate_tabs_to_spaces": false |
|
348 | "translate_tabs_to_spaces": false | |
314 | }, |
|
349 | }, | |
315 | "translation.x": 0.0, |
|
350 | "translation.x": 0.0, | |
316 |
"translation.y": 1 |
|
351 | "translation.y": 1404.0, | |
317 | "zoom_level": 1.0 |
|
352 | "zoom_level": 1.0 | |
318 | }, |
|
353 | }, | |
319 | "type": "text" |
|
354 | "type": "text" | |
320 | }, |
|
355 | }, | |
321 | { |
|
356 | { | |
322 | "buffer": 2, |
|
357 | "buffer": 2, | |
323 | "file": "test_fft/register_addresses_fft_test.py", |
|
358 | "file": "test_fft/register_addresses_fft_test.py", | |
324 | "settings": |
|
359 | "settings": | |
325 | { |
|
360 | { | |
326 |
"buffer_size": |
|
361 | "buffer_size": 873, | |
327 | "regions": |
|
362 | "regions": | |
328 | { |
|
363 | { | |
329 | }, |
|
364 | }, | |
330 | "selection": |
|
365 | "selection": | |
331 | [ |
|
366 | [ | |
332 | [ |
|
367 | [ | |
333 |
7 |
|
368 | 703, | |
334 |
7 |
|
369 | 703 | |
335 | ] |
|
370 | ] | |
336 | ], |
|
371 | ], | |
337 | "settings": |
|
372 | "settings": | |
338 | { |
|
373 | { | |
339 | "syntax": "Packages/Python/Python.tmLanguage" |
|
374 | "syntax": "Packages/Python/Python.tmLanguage" | |
340 | }, |
|
375 | }, | |
341 | "translation.x": 0.0, |
|
376 | "translation.x": 0.0, | |
342 | "translation.y": 0.0, |
|
377 | "translation.y": 108.0, | |
343 | "zoom_level": 1.0 |
|
378 | "zoom_level": 1.0 | |
344 | }, |
|
379 | }, | |
345 | "type": "text" |
|
380 | "type": "text" | |
346 | } |
|
381 | } | |
347 | ] |
|
382 | ] | |
348 | } |
|
383 | } | |
349 | ], |
|
384 | ], | |
350 | "incremental_find": |
|
385 | "incremental_find": | |
351 | { |
|
386 | { | |
352 | "height": 0.0 |
|
387 | "height": 0.0 | |
353 | }, |
|
388 | }, | |
354 | "input": |
|
389 | "input": | |
355 | { |
|
390 | { | |
356 | "height": 0.0 |
|
391 | "height": 0.0 | |
357 | }, |
|
392 | }, | |
358 | "layout": |
|
393 | "layout": | |
359 | { |
|
394 | { | |
360 | "cells": |
|
395 | "cells": | |
361 | [ |
|
396 | [ | |
362 | [ |
|
397 | [ | |
363 | 0, |
|
398 | 0, | |
364 | 0, |
|
399 | 0, | |
365 | 1, |
|
400 | 1, | |
366 | 1 |
|
401 | 1 | |
367 | ] |
|
402 | ] | |
368 | ], |
|
403 | ], | |
369 | "cols": |
|
404 | "cols": | |
370 | [ |
|
405 | [ | |
371 | 0.0, |
|
406 | 0.0, | |
372 | 1.0 |
|
407 | 1.0 | |
373 | ], |
|
408 | ], | |
374 | "rows": |
|
409 | "rows": | |
375 | [ |
|
410 | [ | |
376 | 0.0, |
|
411 | 0.0, | |
377 | 1.0 |
|
412 | 1.0 | |
378 | ] |
|
413 | ] | |
379 | }, |
|
414 | }, | |
380 | "menu_visible": true, |
|
415 | "menu_visible": true, | |
381 | "output.exec": |
|
416 | "output.exec": | |
382 | { |
|
417 | { | |
383 | "height": 28.0 |
|
418 | "height": 28.0 | |
384 | }, |
|
419 | }, | |
385 | "replace": |
|
420 | "replace": | |
386 | { |
|
421 | { | |
387 | "height": 0.0 |
|
422 | "height": 0.0 | |
388 | }, |
|
423 | }, | |
389 | "save_all_on_build": true, |
|
424 | "save_all_on_build": true, | |
390 | "select_file": |
|
425 | "select_file": | |
391 | { |
|
426 | { | |
392 | "height": 0.0, |
|
427 | "height": 0.0, | |
393 | "selected_items": |
|
428 | "selected_items": | |
394 | [ |
|
429 | [ | |
395 | ], |
|
430 | ], | |
396 | "width": 0.0 |
|
431 | "width": 0.0 | |
397 | }, |
|
432 | }, | |
398 | "select_project": |
|
433 | "select_project": | |
399 | { |
|
434 | { | |
400 | "height": 500.0, |
|
435 | "height": 500.0, | |
401 | "selected_items": |
|
436 | "selected_items": | |
402 | [ |
|
437 | [ | |
403 | [ |
|
438 | [ | |
404 | "", |
|
439 | "", | |
405 | "/opt/PYTHON/waveform_analysis/wfmr_plots.sublime-project" |
|
440 | "/opt/PYTHON/waveform_analysis/wfmr_plots.sublime-project" | |
406 | ] |
|
441 | ] | |
407 | ], |
|
442 | ], | |
408 | "width": 380.0 |
|
443 | "width": 380.0 | |
409 | }, |
|
444 | }, | |
410 | "show_minimap": true, |
|
445 | "show_minimap": true, | |
411 | "show_open_files": false, |
|
446 | "show_open_files": false, | |
412 | "show_tabs": true, |
|
447 | "show_tabs": true, | |
413 | "side_bar_visible": true, |
|
448 | "side_bar_visible": true, | |
414 |
"side_bar_width": 2 |
|
449 | "side_bar_width": 289.0, | |
415 | "status_bar_visible": true |
|
450 | "status_bar_visible": true | |
416 | } |
|
451 | } |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,138 +1,95 | |||||
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.zeros( 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 ): |
|
59 | def print_custom( value ): | |
60 | print value |
|
60 | print value | |
61 | RMAPPlugin0.ProcessPendingEvents() |
|
61 | RMAPPlugin0.ProcessPendingEvents() | |
62 |
|
62 | |||
63 | def is_MEM_IN_SM_Emty( ): |
|
63 | def is_MEM_IN_SM_Emty( ): | |
64 | ret = 0 |
|
64 | ret = 0 | |
65 | fft_reg = RMAPPlugin0.Read( address_CTRL, 1) |
|
65 | fft_reg = RMAPPlugin0.Read( address_CTRL, 1) | |
66 | MEM_IN_SM_Empty = (fft_reg[0] & 0x01f00000) >> 20 |
|
66 | MEM_IN_SM_Empty = (fft_reg[0] & 0x01f00000) >> 20 | |
67 | if MEM_IN_SM_Empty == 0x1f: |
|
67 | if MEM_IN_SM_Empty == 0x1f: | |
68 | ret = 1 |
|
68 | ret = 1 | |
69 | return ret |
|
69 | return ret | |
70 |
|
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( ): |
|
71 | def out_locked_AND_out_reuse_AND_out_ren( ): | |
115 | # reuse => 0111 1111 1111 1111 |
|
72 | # reuse => 0111 1111 1111 1111 | |
116 | RMAPPlugin0.Write( address_CTRL, [0x00007fff] ) |
|
73 | RMAPPlugin0.Write( address_CTRL, [0x00007fff] ) | |
117 |
|
74 | |||
118 | def convertToSigned16Bits( dataToConvert ): |
|
75 | def convertToSigned16Bits( dataToConvert ): | |
119 | dataInInt16 = np.int16( dataToConvert ) |
|
76 | dataInInt16 = np.int16( dataToConvert ) | |
120 | if dataInInt16 < 32768: |
|
77 | if dataInInt16 < 32768: | |
121 | val = dataInInt16 |
|
78 | val = dataInInt16 | |
122 | else: |
|
79 | else: | |
123 | val = dataInInt16 - 65536 |
|
80 | val = dataInInt16 - 65536 | |
124 | return val |
|
81 | return val | |
125 |
|
82 | |||
126 | def convertVectorToSigned16Bits( bufferSize, dataBuffer ): |
|
83 | def convertVectorToSigned16Bits( bufferSize, dataBuffer ): | |
127 | dataBufferConverted = np.zeros( bufferSize ) |
|
84 | dataBufferConverted = np.zeros( bufferSize ) | |
128 | for k in range( bufferSize ): |
|
85 | for k in range( bufferSize ): | |
129 | dataBufferConverted[k] = convertToSigned16Bits( dataBuffer[k] ) |
|
86 | dataBufferConverted[k] = convertToSigned16Bits( dataBuffer[k] ) | |
130 | return dataBufferConverted |
|
87 | return dataBufferConverted | |
131 |
|
88 | |||
132 | def convertToSigned8Bits( dataToConvert ): |
|
89 | def convertToSigned8Bits( dataToConvert ): | |
133 | dataInInt16 = np.int8( dataToConvert ) |
|
90 | dataInInt16 = np.int8( dataToConvert ) | |
134 | if dataInInt16 < 8: |
|
91 | if dataInInt16 < 8: | |
135 | val = dataInInt16 |
|
92 | val = dataInInt16 | |
136 | else: |
|
93 | else: | |
137 | val = dataInInt16 - 16 |
|
94 | val = dataInInt16 - 16 | |
138 | return val |
|
95 | return val |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,36 +1,39 | |||||
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 |
|
25 | address_MEM_OUT_SM_0= 0x80000f30 | |
26 | address_MEM_OUT_SM_1= 0x80000f34 |
|
26 | address_MEM_OUT_SM_1= 0x80000f34 | |
27 |
|
27 | |||
|
28 | mask_REN_FIFO_0 = 0xfffffffe # 1110 | |||
|
29 | mask_REN_FIFO_1 = 0xfffffffd # 1101 | |||
|
30 | ||||
28 | address_CTRL_SM = 0x80000f38 |
|
31 | address_CTRL_SM = 0x80000f38 | |
29 |
|
32 | |||
30 | # |
|
33 | # | |
31 | columnV = 1 |
|
34 | columnV = 1 | |
32 | columnE1 = 2 |
|
35 | columnE1 = 2 | |
33 | columnE2 = 3 |
|
36 | columnE2 = 3 | |
34 | columnB1 = 4 |
|
37 | columnB1 = 4 | |
35 | columnB2 = 5 |
|
38 | columnB2 = 5 | |
36 | columnB3 = 6 No newline at end of file |
|
39 | columnB3 = 6 |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,150 +1,190 | |||||
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 | from test_fft.test_sm_functions import * | |||
9 |
|
10 | |||
10 | print_custom( '*' ) |
|
11 | print_custom( '*' ) | |
11 | print_custom( '*' ) |
|
12 | print_custom( '*' ) | |
12 | print_custom( '*' ) |
|
13 | print_custom( '*' ) | |
13 | print_custom( '*' ) |
|
14 | print_custom( '*' ) | |
14 | print_custom( '*' ) |
|
15 | print_custom( '*' ) | |
15 |
|
16 | |||
16 | ###################### |
|
17 | ###################### | |
17 | # GET DATA FROM RECORD |
|
18 | # GET DATA FROM RECORD | |
18 | #storageDirectory = '/home/paul/data/2014_06_24/' |
|
19 | #storageDirectory = '/home/paul/data/2014_06_24/' | |
19 | #day = '2014_6_24-' |
|
20 | #day = '2014_6_24-' | |
20 | #hour = '9_0_3' |
|
21 | #hour = '9_0_3' | |
21 | #suffix = '.data' |
|
22 | #suffix = '.data' | |
22 |
|
23 | |||
23 | #typeOfData = '_SBM1_CWF_' |
|
24 | #typeOfData = '_SBM1_CWF_' | |
24 | #cwf_f1 = np.genfromtxt( storageDirectory + day + hour + typeOfData + 'F1' + suffix, |
|
25 | #cwf_f1 = np.genfromtxt( storageDirectory + day + hour + typeOfData + 'F1' + suffix, | |
25 | # skip_header = 1) |
|
26 | # skip_header = 1) | |
26 | cwf_f1 = np.zeros( 1000 ) |
|
27 | cwf_f1 = np.zeros( 1000 ) | |
27 |
|
28 | |||
28 | ################# |
|
29 | ################# | |
29 | # BUILD WAVEFORMS |
|
30 | # BUILD WAVEFORMS | |
30 | nbSamples = 256 |
|
31 | nbSamples = 256 | |
31 |
nbComponentsPerMatrix = |
|
32 | nbComponentsPerMatrix = 15 | |
32 | nbFrequencyBins = 128 |
|
33 | nbFrequencyBins = 128 | |
33 | #wfrm0 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnV ) |
|
34 | #wfrm0 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnV ) | |
34 | #wfrm1 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE1 ) |
|
35 | #wfrm1 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE1 ) | |
35 | #wfrm2 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE2 ) |
|
36 | #wfrm2 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE2 ) | |
36 | #wfrm3 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB1 ) |
|
37 | #wfrm3 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB1 ) | |
37 | #wfrm4 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB2 ) |
|
38 | #wfrm4 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB2 ) | |
38 | wfrm0 = sineWave( 256, 10, 1000 ) |
|
39 | wfrm0 = sineWave( 256, 10, 1000 ) | |
39 |
wfrm1 = sineWave( 256, |
|
40 | wfrm1 = sineWave( 256, 10, 1000 ) | |
40 |
wfrm2 = sineWave( 256, |
|
41 | wfrm2 = sineWave( 256, 20, 1000 ) | |
41 |
wfrm3 = sineWave( 256, |
|
42 | wfrm3 = sineWave( 256, 20, 1000 ) | |
42 | wfrm4 = sineWave( 256, 50, 1000 ) |
|
43 | wfrm4 = sineWave( 256, 50, 1000 ) | |
43 |
|
44 | |||
44 | ################ |
|
45 | ################ | |
45 | # BUILD THE DATA |
|
46 | # BUILD THE DATA | |
46 | dataToWrite0 = generateDataToWrite( nbSamples, wfrm0, wfrm1 ) |
|
47 | dataToWrite0 = generateDataToWrite( nbSamples, wfrm0, wfrm1 ) | |
47 | dataToWrite1 = generateDataToWrite( nbSamples, wfrm2, wfrm3 ) |
|
48 | dataToWrite1 = generateDataToWrite( nbSamples, wfrm2, wfrm3 ) | |
48 | dataToWrite2 = generateDataToWrite( nbSamples, wfrm4, np.zeros( nbSamples ) ) |
|
49 | dataToWrite2 = generateDataToWrite( nbSamples, wfrm4, np.zeros( nbSamples ) ) | |
49 |
|
50 | |||
50 | ######################## |
|
51 | ######################## | |
51 | # WRITE WAVEFORM IN FIFO |
|
52 | # WRITE WAVEFORM IN FIFO | |
52 | print_custom( "1) write waveforms in FIFOs: " + str(len(dataToWrite0)) + " samples" ) |
|
53 | print_custom( "1) write waveforms in FIFOs: " + str(len(dataToWrite0)) + " samples" ) | |
53 | print_reg_sm( ) |
|
54 | print_reg_sm( ) | |
54 |
|
55 | |||
55 | for k in range(nbSamples): |
|
56 | for k in range(nbSamples): | |
56 | RMAPPlugin0.Write( address_FIFO_F2_1_0, [dataToWrite0[k]] ) |
|
57 | 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_3_2, [dataToWrite1[k]] ) | |
58 | RMAPPlugin0.Write( address_FIFO_F2_4, [dataToWrite2[k]] ) |
|
59 | RMAPPlugin0.Write( address_FIFO_F2_4, [dataToWrite2[k]] ) | |
59 | # write only the FIFO F2 |
|
60 | # write only the FIFO F2 | |
60 | RMAPPlugin0.Write( address_FIFO_F2_WEN, [0xffffffe0] ) |
|
61 | RMAPPlugin0.Write( address_FIFO_F2_WEN, [0xffffffe0] ) | |
61 |
|
62 | |||
62 | print_custom( "1) data written in FIFOs" ) |
|
63 | print_custom( "1) data written in FIFOs" ) | |
63 |
|
64 | |||
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 | ################ |
|
65 | ################ | |
73 | # SM FIRST READ |
|
66 | # SM FIRST READ | |
74 | print_custom( "======= SM FIRST READ" ) |
|
67 | print_custom( "======= SM FIRST READ" ) | |
75 |
|
68 | |||
76 | components = [] |
|
69 | components = [] | |
77 |
|
70 | |||
|
71 | wait_for_FIFO_0_or_1_Full() | |||
|
72 | ||||
78 | if is_MEM_OUT_SM_Full_FIFO_0(): |
|
73 | if is_MEM_OUT_SM_Full_FIFO_0( ): | |
79 | print_custom( "FIFO_0 is full" ) |
|
74 | address_MEM_OUT_SM = address_MEM_OUT_SM_1 | |
80 | address_MEM_OUT_SM = address_MEM_OUT_SM_0 |
|
75 | fifo_to_wait_for = 0 | |
81 | elif is_MEM_OUT_SM_Full_FIFO_1(): |
|
76 | elif is_MEM_OUT_SM_Full_FIFO_1( ): | |
82 | print_custom( "FIFO_1 is full") |
|
77 | address_MEM_OUT_SM = address_MEM_OUT_SM_0 | |
83 | address_MEM_OUT_SM = address_MEM_OUT_SM_1 |
|
78 | fifo_to_wait_for = 1 | |
84 | else: |
|
|||
85 | print_custom( "/!\ no MEM_OUT_SM FIFO full /!\ " ) |
|
|||
86 |
|
79 | |||
87 | for component in range(nbComponentsPerMatrix): |
|
80 | for component in range(nbComponentsPerMatrix): | |
88 |
print_custom( "component = " + str( component ) |
|
81 | print_custom( "==== component = " + str( component ) | |
89 | currentComp = np.zeros( nbFrequencyBins ) |
|
82 | + ", read @" + hex(address_MEM_OUT_SM & 0xffffffff) ) | |
90 | for frequencyBin in range(nbFrequencyBins): |
|
83 | print_reg_sm( ) | |
91 | # read enable => 0000 0000 0000 0000 |
|
84 | currentComp_re = np.zeros( nbFrequencyBins ) | |
92 | if is_MEM_OUT_SM_Empty( ) == 1: |
|
85 | currentComp_im = np.zeros( nbFrequencyBins ) | |
93 |
|
|
86 | if (component == 0) | (component == 12): | |
94 | + " bin = " + str( frequencyBin ) ) |
|
87 | wait_for_FIFO_Full( fifo_to_wait_for ) | |
95 | val = RMAPPlugin0.Read( address_MEM_OUT_SM, 1) |
|
88 | currentComp_re = read_SM_Re( nbFrequencyBins, address_MEM_OUT_SM ) | |
96 | RMAPPlugin0.Write( address_CTRL_SM, [0x00000000] ) |
|
89 | components.append( currentComp_re ) | |
97 | currentComp[frequencyBin] = val[0] |
|
90 | elif (component == 5) | (component == 9): | |
98 | RMAPPlugin0.ProcessPendingEvents() |
|
91 | wait_for_FIFO_Full( fifo_to_wait_for ) | |
99 | components.append( currentComp ) |
|
92 | currentComp_re = read_SM_Re( nbFrequencyBins, address_MEM_OUT_SM ) | |
|
93 | components.append( currentComp_re ) | |||
|
94 | elif (component == 1) | (component == 3) | (component == 7): | |||
|
95 | currentComp_re, currentComp_im = read_SM_Re_Im( nbFrequencyBins, address_MEM_OUT_SM ) | |||
|
96 | components.append( currentComp_re ) | |||
|
97 | components.append( currentComp_im ) | |||
|
98 | wait_for_FIFO_Full( fifo_to_wait_for ) | |||
|
99 | elif (component == 2) | (component == 6) | (component == 10): | |||
|
100 | currentComp_re, currentComp_im = read_SM_Re_Im( nbFrequencyBins, address_MEM_OUT_SM ) | |||
|
101 | components.append( currentComp_re ) | |||
|
102 | components.append( currentComp_im ) | |||
|
103 | wait_for_FIFO_Full( fifo_to_wait_for ) | |||
|
104 | elif (component == 4) | (component == 8): | |||
|
105 | currentComp_re, currentComp_im = read_SM_Re_Im( nbFrequencyBins, address_MEM_OUT_SM ) | |||
|
106 | components.append( currentComp_re ) | |||
|
107 | components.append( currentComp_im ) | |||
|
108 | elif (component == 11) | (component == 13): | |||
|
109 | currentComp_re, currentComp_im = read_SM_Re_Im( nbFrequencyBins, address_MEM_OUT_SM ) | |||
|
110 | components.append( currentComp_re ) | |||
|
111 | components.append( currentComp_im ) | |||
|
112 | elif (component == 14): | |||
|
113 | currentComp_re = read_SM_Re( nbFrequencyBins, address_MEM_OUT_SM ) | |||
|
114 | components.append( currentComp_re ) | |||
|
115 | else: | |||
|
116 | print_custom( "unexpected value for component" ) | |||
|
117 | # change FIFO | |||
|
118 | if address_MEM_OUT_SM == address_MEM_OUT_SM_0: | |||
|
119 | address_MEM_OUT_SM = address_MEM_OUT_SM_1 | |||
|
120 | fifo_to_wait_for = 0 | |||
|
121 | elif address_MEM_OUT_SM == address_MEM_OUT_SM_1: | |||
|
122 | address_MEM_OUT_SM = address_MEM_OUT_SM_0 | |||
|
123 | fifo_to_wait_for = 1 | |||
|
124 | ||||
|
125 | print_custom( "======= READ COMPLETE" ) | |||
|
126 | ||||
|
127 | print_reg_sm( ) | |||
100 |
|
128 | |||
101 | # PLOT SM |
|
129 | # PLOT SM | |
102 |
|
130 | |||
103 | plt.figure( 1 ) |
|
131 | plt.figure( 1 ) | |
104 | plt.subplot(231) |
|
132 | plt.subplot(231) | |
105 | plt.plot(wfrm0, 'b') |
|
133 | plt.plot(wfrm0, 'b') | |
106 | plt.subplot(232) |
|
134 | plt.subplot(232) | |
107 | plt.plot(wfrm1, 'g') |
|
135 | plt.plot(wfrm1, 'g') | |
108 | plt.plot(wfrm1, '.') |
|
136 | plt.plot(wfrm1, '.') | |
109 | plt.subplot(233) |
|
137 | plt.subplot(233) | |
110 | plt.plot(wfrm2, 'r') |
|
138 | plt.plot(wfrm2, 'r') | |
111 | plt.plot(wfrm2, '.') |
|
139 | plt.plot(wfrm2, '.') | |
112 | plt.subplot(234) |
|
140 | plt.subplot(234) | |
113 | plt.plot(wfrm3, 'c') |
|
141 | plt.plot(wfrm3, 'c') | |
114 | plt.subplot(235) |
|
142 | plt.subplot(235) | |
115 | plt.plot(wfrm4, 'm') |
|
143 | plt.plot(wfrm4, 'm') | |
116 |
|
144 | |||
117 | plt.figure( 2 ) |
|
145 | plt.figure( 2 ) | |
|
146 | ||||
118 | plt.subplot(231) |
|
147 | plt.subplot(231) | |
119 |
plt.plot(components[0] |
|
148 | plt.plot(components[0], label='0') | |
120 |
plt.plot(components[1] |
|
149 | plt.plot(components[1], label='1') | |
121 |
plt.plot(components[2] |
|
150 | plt.plot(components[2], label='2') | |
122 |
plt.plot(components[3] |
|
151 | plt.plot(components[3], label='3') | |
|
152 | plt.legend(loc='upper right') | |||
|
153 | ||||
123 | plt.subplot(232) |
|
154 | plt.subplot(232) | |
124 |
plt.plot(components[4] |
|
155 | plt.plot(components[4], label='4') | |
125 |
plt.plot(components[5] |
|
156 | plt.plot(components[5], label='5') | |
126 |
plt.plot(components[6] |
|
157 | plt.plot(components[6], label='6') | |
127 |
plt.plot(components[7] |
|
158 | plt.plot(components[7], label='7') | |
|
159 | plt.legend(loc='upper right') | |||
|
160 | ||||
128 | plt.subplot(233) |
|
161 | plt.subplot(233) | |
129 |
plt.plot(components[8] |
|
162 | plt.plot(components[8], label='8') | |
130 |
plt.plot(components[9] |
|
163 | plt.plot(components[9], label='9') | |
131 |
plt.plot(components[10] |
|
164 | plt.plot(components[10], label='10') | |
132 |
plt.plot(components[11] |
|
165 | plt.plot(components[11], label='11') | |
|
166 | plt.legend(loc='upper right') | |||
|
167 | ||||
133 | plt.subplot(234) |
|
168 | plt.subplot(234) | |
134 |
plt.plot(components[12] |
|
169 | plt.plot(components[12], label='12') | |
135 |
plt.plot(components[13] |
|
170 | plt.plot(components[13], label='13') | |
136 |
plt.plot(components[14] |
|
171 | plt.plot(components[14], label='14') | |
137 |
plt.plot(components[15] |
|
172 | plt.plot(components[15], label='15') | |
|
173 | plt.legend(loc='upper right') | |||
|
174 | ||||
138 | plt.subplot(235) |
|
175 | plt.subplot(235) | |
139 |
plt.plot(components[16] |
|
176 | plt.plot(components[16], label='16') | |
140 |
plt.plot(components[17] |
|
177 | plt.plot(components[17], label='17') | |
141 |
plt.plot(components[18] |
|
178 | plt.plot(components[18], label='18') | |
142 |
plt.plot(components[19] |
|
179 | plt.plot(components[19], label='19') | |
|
180 | plt.legend(loc='upper right') | |||
|
181 | ||||
143 | plt.subplot(236) |
|
182 | plt.subplot(236) | |
144 |
plt.plot(components[20] |
|
183 | plt.plot(components[20], label='20') | |
145 |
plt.plot(components[21] |
|
184 | plt.plot(components[21], label='21') | |
146 |
plt.plot(components[22] |
|
185 | plt.plot(components[22], label='22') | |
147 |
plt.plot(components[23] |
|
186 | plt.plot(components[23], label='23') | |
148 |
plt.plot(components[24] |
|
187 | plt.plot(components[24], label='24') | |
|
188 | plt.legend(loc='upper right') | |||
149 |
|
189 | |||
150 | plt.show() No newline at end of file |
|
190 | plt.show() |
General Comments 0
You need to be logged in to leave comments.
Login now