##// END OF EJS Templates
test_fft directory added to the repository
paul -
r4:a2755b43b4c9 default
parent child
Show More
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
@@ -0,0 +1,8
1 {
2 "folders":
3 [
4 {
5 "path": "/opt/LFR_EMULATOR"
6 }
7 ]
8 }
@@ -0,0 +1,322
1 {
2 "auto_complete":
3 {
4 "selected_items":
5 [
6 [
7 "MEM",
8 "MEM_IN_SM_Empty"
9 ],
10 [
11 "out_re",
12 "out_ren"
13 ],
14 [
15 "fft",
16 "fft_reg"
17 ],
18 [
19 "address_MEM",
20 "address_MEM_IN_SM_0"
21 ],
22 [
23 "wfr",
24 "wfrm0"
25 ],
26 [
27 "print",
28 "print_reg_fft"
29 ],
30 [
31 "sin",
32 "sineWave"
33 ],
34 [
35 "if",
36 "ifmain if __name__ == '__main__'"
37 ],
38 [
39 "address_",
40 "address_MEM_IN_SM_0"
41 ],
42 [
43 "wf",
44 "wfrm0"
45 ],
46 [
47 "address_FIFO_F0_",
48 "address_FIFO_F0_4"
49 ],
50 [
51 "add",
52 "address_CTRL"
53 ],
54 [
55 "wfrm",
56 "wfrm1"
57 ],
58 [
59 "index",
60 "indexTransformDecimationInFrequency"
61 ],
62 [
63 "in",
64 "indexTransformDecimationInFrequency"
65 ],
66 [
67 "dft",
68 "dft_val"
69 ],
70 [
71 "butter",
72 "butterflyProcessor"
73 ],
74 [
75 "chec",
76 "checkbox_sy_lfr_bw"
77 ],
78 [
79 "send",
80 "sendLoadCommonPar"
81 ],
82 [
83 "groupbo",
84 "groupbox_tc_lfr_load_common_par"
85 ],
86 [
87 "l",
88 "layout_tc"
89 ],
90 [
91 "button",
92 "button_tc_lfr_load_common_par"
93 ],
94 [
95 "a",
96 "addWidget"
97 ],
98 [
99 "group",
100 "groupbox_tc_lfr_load_common_par"
101 ],
102 [
103 "c",
104 "common"
105 ],
106 [
107 "laben",
108 "label_UNKNOWN_nb"
109 ],
110 [
111 "UN",
112 "UNKNOWN_nb"
113 ]
114 ]
115 },
116 "buffers":
117 [
118 {
119 "file": "test_fft/test_fft_mini_lfr.py",
120 "settings":
121 {
122 "buffer_size": 4505,
123 "line_ending": "Unix"
124 }
125 }
126 ],
127 "build_system": "",
128 "command_palette":
129 {
130 "height": 392.0,
131 "selected_items":
132 [
133 ],
134 "width": 392.0
135 },
136 "console":
137 {
138 "height": 146.0
139 },
140 "distraction_free":
141 {
142 "menu_visible": true,
143 "show_minimap": false,
144 "show_open_files": false,
145 "show_tabs": false,
146 "side_bar_visible": false,
147 "status_bar_visible": false
148 },
149 "file_history":
150 [
151 "/opt/LFR_EMULATOR/test_fft/functions_evaluations.py",
152 "/opt/LFR_EMULATOR/SRC/processing_chain.py",
153 "/opt/LFR_EMULATOR/main.py",
154 "/opt/LFR_EMULATOR/fft_8_decimation_in_frequency.py",
155 "/opt/LFR_EMULATOR/SRC/basic_parameters_Int.py",
156 "/opt/LFR_EMULATOR/butterfly_processor.py",
157 "/opt/LFR_EMULATOR/index_transform_decimation_in_frequency.py",
158 "/opt/LFR_EMULATOR/efficient_complex_multiplier.py",
159 "/opt/LFR_EMULATOR/twiddle_factors.py",
160 "/opt/LFR_EMULATOR/SRC/filters.py",
161 "/opt/LFR_EMULATOR/SRC/test_cases1.py",
162 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory.py",
163 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory (copy).py",
164 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step01/grspw_registers.py",
165 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0002/tc_during_matrix_transmission.py",
166 "/opt/VALIDATION/lfrverif/common/actions_tc_lfr_launcher.py",
167 "/opt/VALIDATION/lfrverif/common/test_monitor.py",
168 "/opt/VALIDATION/validation.sublime-workspace",
169 "/opt/VALIDATION/validation.sublime-project",
170 "/opt/PYTHON/lfrverif/test1/test1main.py",
171 "/opt/PYTHON/lfrverif/test1/test1launcher.py",
172 "/opt/PYTHON/lfrverif/common/crcforlfr.py",
173 "/opt/PYTHON/lfrverif/common/tcparams.py",
174 "/opt/PYTHON/lfrverif/test1/testgui.py",
175 "/opt/PYTHON/lfrverif/test1/tcmonitor.py",
176 "/opt/PYTHON/lfrverif/test1/lppmoncfg.py",
177 "/opt/PYTHON/lfrverif/test1/wfdisplay.py",
178 "/opt/PYTHON/lfrverif/test1/lppmonplot.py",
179 "/opt/PYTHON/lfrverif/test1/tmmonitor.py"
180 ],
181 "find":
182 {
183 "height": 34.0
184 },
185 "find_in_files":
186 {
187 "height": 0.0,
188 "where_history":
189 [
190 "/opt/VALIDATION/lfrverif",
191 "/opt/VALIDATION/lfrverif/LFR_SVS"
192 ]
193 },
194 "find_state":
195 {
196 "case_sensitive": false,
197 "find_history":
198 [
199 "def displayInfoSendTc",
200 "dump",
201 "tc_lfr_dump_par",
202 "processpac",
203 "WriteSPWDelay",
204 "sendPacket",
205 "sendLoadCommonPar"
206 ],
207 "highlight": true,
208 "in_selection": false,
209 "preserve_case": false,
210 "regex": false,
211 "replace_history":
212 [
213 ],
214 "reverse": false,
215 "show_context": true,
216 "use_buffer2": true,
217 "whole_word": false,
218 "wrap": true
219 },
220 "groups":
221 [
222 {
223 "selected": 0,
224 "sheets":
225 [
226 {
227 "buffer": 0,
228 "file": "test_fft/test_fft_mini_lfr.py",
229 "settings":
230 {
231 "buffer_size": 4505,
232 "regions":
233 {
234 },
235 "selection":
236 [
237 [
238 1524,
239 1524
240 ]
241 ],
242 "settings":
243 {
244 "syntax": "Packages/Python/Python.tmLanguage",
245 "translate_tabs_to_spaces": false
246 },
247 "translation.x": 0.0,
248 "translation.y": 1998.0,
249 "zoom_level": 1.0
250 },
251 "type": "text"
252 }
253 ]
254 }
255 ],
256 "incremental_find":
257 {
258 "height": 0.0
259 },
260 "input":
261 {
262 "height": 0.0
263 },
264 "layout":
265 {
266 "cells":
267 [
268 [
269 0,
270 0,
271 1,
272 1
273 ]
274 ],
275 "cols":
276 [
277 0.0,
278 1.0
279 ],
280 "rows":
281 [
282 0.0,
283 1.0
284 ]
285 },
286 "menu_visible": true,
287 "output.exec":
288 {
289 "height": 28.0
290 },
291 "replace":
292 {
293 "height": 0.0
294 },
295 "save_all_on_build": true,
296 "select_file":
297 {
298 "height": 0.0,
299 "selected_items":
300 [
301 ],
302 "width": 0.0
303 },
304 "select_project":
305 {
306 "height": 500.0,
307 "selected_items":
308 [
309 [
310 "",
311 "/opt/PYTHON/waveform_analysis/wfmr_plots.sublime-project"
312 ]
313 ],
314 "width": 380.0
315 },
316 "show_minimap": true,
317 "show_open_files": false,
318 "show_tabs": true,
319 "side_bar_visible": true,
320 "side_bar_width": 289.0,
321 "status_bar_visible": true
322 }
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,38
1 import numpy as np
2
3 from __main__ import RMAPPlugin0
4
5 def getWaveFromRecord( cwf, bufferSize, offset, column ):
6 yVector = cwf[(0+offset):(bufferSize+offset), column]
7 return yVector
8
9 def sineWave( bufferSize, nbPeriod, amplitude):
10 deltaX = nbPeriod * 2 * np.pi / bufferSize
11 xVector = np.arange( bufferSize ) * deltaX
12 yVector = np.int16( amplitude * np.sin( xVector ) )
13 return yVector
14
15 def continuous( bufferSize, value ):
16 tmpVector = np.empty( bufferSize )
17 tmpVector.fill( value )
18 yVector = np.int16( tmpVector )
19 return yVector
20
21 def generateDataToWrite( bufferSize, wfrm0, wfrm1 ):
22 dataVector = []
23 for k in range(bufferSize):
24 dataVector.append( ( wfrm1[k] << 16) + wfrm0[k] )
25 return dataVector
26
27 def print_reg_fft( address_CTRL ):
28 fft_reg = RMAPPlugin0.Read( address_CTRL, 1)
29 out_ren = (fft_reg[0] & 0x0000001f)
30 out_reuse = (fft_reg[0] & 0x000003e0) >> 5
31 out_locked = (fft_reg[0] & 0x00007c00) >> 10
32 MEM_IN_SM_Full = (fft_reg[0] & 0x000f8000) >> 15
33 MEM_IN_SM_Empty = (fft_reg[0] & 0x01f00000) >> 20
34 print "out_ren = " + bin( out_ren ) \
35 + ", out_reuse = " + bin( out_reuse ) \
36 + ", out_locked = " + bin( out_locked ) \
37 + ", MEM_IN_SM_Full = " + bin( MEM_IN_SM_Full ) \
38 + ", MEM_IN_SM_Empty = " + bin( MEM_IN_SM_Empty )
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,13
1 import numpy as np
2 import matplotlib.pyplot as plt
3
4 def sineWave( bufferSize, nbPeriod):
5 deltaX = nbPeriod * 2 * np.pi / bufferSize
6 xVector = np.arange( bufferSize ) * deltaX
7 yVector = np.sin( xVector )
8 return yVector
9
10 if __name__ == '__main__':
11 waveform = sineWave( 256, 3 )
12 plt.plot(waveform)
13 plt.show()
@@ -0,0 +1,31
1 # FIFO F0
2 address_FIFO_F0_1_0 = 0x80000f00
3 address_FIFO_F0_3_2 = 0x80000f04
4 address_FIFO_F0_4 = 0x80000f08
5 address_FIFO_F0_WEN = 0x80000f0c
6 # FIFO F1
7 address_FIFO_F1_1_0 = 0x80000f10
8 address_FIFO_F1_3_2 = 0x80000f14
9 address_FIFO_F1_4 = 0x80000f18
10 address_FIFO_F1_WEN = 0x80000f1c
11 # FIFO F2
12 address_FIFO_F2_1_0 = 0x80000f20
13 address_FIFO_F2_3_2 = 0x80000f24
14 address_FIFO_F2_4 = 0x80000f28
15 address_FIFO_F2_WEN = 0x80000f2c
16
17 address_MEM_IN_SM_0 = 0x80000f30
18 address_MEM_IN_SM_1 = 0x80000f34
19 address_MEM_IN_SM_2 = 0x80000f38
20 address_MEM_IN_SM_3 = 0x80000f3c
21 address_MEM_IN_SM_4 = 0x80000f40
22
23 address_CTRL = 0x80000f44
24
25 #
26 columnV = 1
27 columnE1 = 2
28 columnE2 = 3
29 columnB1 = 4
30 columnB2 = 5
31 columnB3 = 6 No newline at end of file
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,148
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 '*'
11 print '*'
12 print '*'
13 print '*'
14 print '*'
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
27 #################
28 # BUILD WAVEFORMS
29 nbSamples = 256
30 wfrm0 = continuous( nbSamples, 10 )
31 wfrm1 = sineWave( nbSamples, 2, 1000)
32 #wfrm2 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnV )
33 wfrm2 = continuous( nbSamples, 1000 )
34 wfrm3 = continuous( nbSamples, 10000 )
35 wfrm4 = continuous( nbSamples, 10 )
36
37 ################
38 # BUILD THE DATA
39 dataToWrite0 = generateDataToWrite( nbSamples, wfrm0, wfrm1 )
40 dataToWrite1 = generateDataToWrite( nbSamples, wfrm2, wfrm3 )
41 dataToWrite2 = generateDataToWrite( nbSamples, np.zeros( nbSamples ), wfrm4 )
42
43 print_reg_fft( address_CTRL )
44
45 # WRITE WAVEFORM IN FIFO
46 print "write waveforms in FIFOs: " + str(len(dataToWrite0)) + " samples"
47
48 for k in range(nbSamples):
49 RMAPPlugin0.Write( address_FIFO_F2_1_0, [dataToWrite0[k]] )
50 RMAPPlugin0.Write( address_FIFO_F2_3_2, [dataToWrite1[k]] )
51 RMAPPlugin0.Write( address_FIFO_F2_4, [dataToWrite2[k]] )
52 # write only the FIFO F2
53 RMAPPlugin0.Write( address_FIFO_F2_WEN, [0xffffffe0] )
54
55 print "data written in FIFOs"
56
57 print_reg_fft( address_CTRL )
58
59 # LOCK FIFOs => 0111 1100 0001 1111
60 RMAPPlugin0.Write( address_CTRL, [0x00007c1f] )
61
62 # wait for SM_Full
63 fft_reg = RMAPPlugin0.Read( address_CTRL, 1)
64 while (fft_reg[0] & 0x000f8000) == 0:
65 print "SM not full"
66 fft_reg = RMAPPlugin0.Read( address_CTRL, 1)
67
68 print_reg_fft( address_CTRL )
69
70 # READ FFT
71 print "read data in fft FIFOs"
72 fft0_re = np.zeros( nbSamples )
73 fft0_im = np.zeros( nbSamples )
74 fft1_re = np.zeros( nbSamples )
75 fft1_im = np.zeros( nbSamples )
76 fft2_re = np.zeros( nbSamples )
77 fft2_im = np.zeros( nbSamples )
78 fft3_re = np.zeros( nbSamples )
79 fft3_im = np.zeros( nbSamples )
80 fft4_re = np.zeros( nbSamples )
81 fft4_im = np.zeros( nbSamples )
82
83 for k in range(nbSamples):
84 val = RMAPPlugin0.Read( address_MEM_IN_SM_0, 1)
85 fft0_re[k] = val[0] & 0xffff
86 fft0_im[k] = ( val[0] >> 16 ) & 0xffff
87 val = RMAPPlugin0.Read( address_MEM_IN_SM_1, 1)
88 fft1_re[k] = val[0] & 0x0000ffff
89 fft1_im[k] = ( val[0] >> 16 ) & 0xffff
90 val = RMAPPlugin0.Read( address_MEM_IN_SM_2, 1)
91 fft2_re[k] = val[0] & 0x0000ffff
92 fft2_im[k] = ( val[0] >> 16 ) & 0xffff
93 val = RMAPPlugin0.Read( address_MEM_IN_SM_3, 1)
94 fft3_re[k] = val[0] & 0x0000ffff
95 fft3_im[k] = ( val[0] >> 16 ) & 0xffff
96 val = RMAPPlugin0.Read( address_MEM_IN_SM_4, 1)
97 fft4_re[k] = val[0] & 0x0000ffff
98 fft4_im[k] = ( val[0] >> 16 ) & 0xffff
99 # read enable => 0111 1100 0000 0000
100 RMAPPlugin0.Write( address_CTRL, [0x00007c00] )
101
102 print "data read in fft FIFOs"
103
104 print_reg_fft( address_CTRL )
105
106 #unlock FIFOs => 0000 0000 0001 1111
107 RMAPPlugin0.Write( address_CTRL, [0x0000001f] )
108
109 print_reg_fft( address_CTRL )
110
111 # PLOT FFT
112
113 plt.figure( 1 )
114 plt.subplot(231)
115 plt.plot(wfrm0)
116 plt.subplot(232)
117 plt.plot(wfrm1)
118 plt.plot(wfrm1, '.')
119 plt.subplot(233)
120 plt.plot(wfrm2)
121 plt.subplot(234)
122 plt.plot(wfrm3)
123 plt.subplot(235)
124 plt.plot(wfrm4)
125
126 plt.figure( 2 )
127 plt.subplot(311)
128 plt.plot(fft0_re)
129 plt.plot(fft1_re)
130 plt.plot(fft2_re)
131 plt.plot(fft3_re)
132 plt.plot(fft4_re)
133
134 plt.subplot(312)
135 plt.plot(fft0_im)
136 plt.plot(fft1_im)
137 plt.plot(fft2_im)
138 plt.plot(fft3_im)
139 plt.plot(fft4_im)
140
141 plt.subplot(313)
142 plt.plot(fft0_re * fft0_re + fft0_im * fft0_im, 'b')
143 plt.plot(fft1_re * fft1_re + fft1_im * fft1_im, 'g')
144 plt.plot(fft2_re * fft2_re + fft2_im * fft2_im, 'r')
145 plt.plot(fft3_re * fft3_re + fft3_im * fft3_im, 'c')
146 plt.plot(fft4_re * fft4_re + fft4_im * fft4_im, 'm')
147
148 plt.show() No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now