##// END OF EJS Templates
sources reorganized...
paul -
r9:0cad6347e265 default
parent child
Show More
@@ -0,0 +1,62
1 import numpy as np
2
3 def getWaveFromRecord( cwf, bufferSize, offset, column ):
4 yVector = cwf[(0+offset):(bufferSize+offset), column]
5 return yVector
6
7 def sineWave( bufferSize, nbPeriod, amplitude):
8 deltaX = nbPeriod * 2 * np.pi / bufferSize
9 xVector = np.arange( bufferSize ) * deltaX
10 yVector = np.int16( amplitude * np.sin( xVector ) )
11 return yVector
12
13 def continuous( bufferSize, value ):
14 tmpVector = np.empty( bufferSize )
15 tmpVector.fill( value )
16 yVector = np.int16( tmpVector )
17 return yVector
18
19 def step( bufferSize, value ):
20 tmpVector = np.zeros( bufferSize )
21 for k in range( bufferSize / 2 ):
22 tmpVector[ bufferSize / 2 + k ] = value
23 yVector = np.int16( tmpVector )
24 return yVector
25
26 def dirac( bufferSize, value, position=0 ):
27 tmpVector = np.zeros( bufferSize )
28 if position < bufferSize:
29 tmpVector[position] = value
30 yVector = np.int16( tmpVector )
31 return yVector
32
33 def generateDataToWrite( bufferSize, wfrm0, wfrm1 ):
34 dataVector = []
35 for k in range(bufferSize):
36 dataVector.append(
37 ( (np.int16(wfrm1[k]) & 0xffff ) << 16)
38 | (np.int16(wfrm0[k]) & 0xffff )
39 )
40 return dataVector
41
42 def convertToSigned16Bits( dataToConvert ):
43 dataInInt16 = np.int16( dataToConvert )
44 if dataInInt16 < 32768:
45 val = dataInInt16
46 else:
47 val = dataInInt16 - 65536
48 return val
49
50 def convertVectorToSigned16Bits( bufferSize, dataBuffer ):
51 dataBufferConverted = np.zeros( bufferSize )
52 for k in range( bufferSize ):
53 dataBufferConverted[k] = convertToSigned16Bits( dataBuffer[k] )
54 return dataBufferConverted
55
56 def convertToSigned8Bits( dataToConvert ):
57 dataInInt16 = np.int8( dataToConvert )
58 if dataInInt16 < 8:
59 val = dataInInt16
60 else:
61 val = dataInInt16 - 16
62 return val
@@ -0,0 +1,56
1 from __main__ import RMAPPlugin0
2
3 def print_custom( value ):
4 print value
5 RMAPPlugin0.ProcessPendingEvents()
6
7 def print_reg_fft( address ):
8 fft_reg = RMAPPlugin0.Read( address, 1)
9 out_ren = (fft_reg[0] & 0x0000001f)
10 out_reuse = (fft_reg[0] & 0x000003e0) >> 5
11 out_locked = (fft_reg[0] & 0x00007c00) >> 10
12 MEM_IN_SM_Full = (fft_reg[0] & 0x000f8000) >> 15
13 MEM_IN_SM_Empty = (fft_reg[0] & 0x01f00000) >> 20
14 print "out_ren = " + bin( out_ren ) \
15 + ", out_reuse = " + bin( out_reuse ) \
16 + ", out_locked = " + bin( out_locked ) \
17 + ", MEM_IN_SM_Full = " + bin( MEM_IN_SM_Full ) \
18 + ", MEM_IN_SM_Empty = " + bin( MEM_IN_SM_Empty )
19 RMAPPlugin0.ProcessPendingEvents()
20
21 def print_reg_sm( address ):
22 sm_reg = RMAPPlugin0.Read( address, 1)
23 out_ren = (sm_reg[0] & 0x00000003)
24 MEM_OUT_SM_Full = (sm_reg[0] & 0x0000000c) >> 2
25 MEM_OUT_SM_Empty = (sm_reg[0] & 0x00000030) >> 4
26 MEM_OUT_SM_Full_s= (sm_reg[0] & 0x00000040) >> 6
27 print "sm_reg = " + bin( sm_reg[0] & 0x7f ) \
28 + ", MEM_OUT_SM_Full_s = " + bin( MEM_OUT_SM_Full_s ) \
29 + ", MEM_OUT_SM_Empty = " + bin( MEM_OUT_SM_Empty ) \
30 + ", MEM_OUT_SM_Full = " + bin( MEM_OUT_SM_Full ) \
31 + ", out_ren = " + bin( out_ren )
32 RMAPPlugin0.ProcessPendingEvents()
33
34 def print_reg_sm_only_MEM_IN_CTRL( address ):
35 sm_reg = RMAPPlugin0.Read( address, 1)
36 out_wen = (sm_reg[0] & 0x0000001f)
37 MEM_IN_SM_Full = (sm_reg[0] & 0x000003e0) >> 5
38 MEM_IN_SM_Empty = (sm_reg[0] & 0x00007c00) >> 10
39 MEM_IN_SM_Locked = (sm_reg[0] & 0x000f8000) >> 15
40 print "MEM_IN_SM = " + bin( sm_reg[0] & 0xfffff ) \
41 + ", Locked = " + bin( MEM_IN_SM_Locked ) \
42 + ", Empty = " + bin( MEM_IN_SM_Empty ) \
43 + ", Full = " + bin( MEM_IN_SM_Full ) \
44 + ", wen = " + bin( out_wen )
45 RMAPPlugin0.ProcessPendingEvents()
46
47 def print_reg_sm_only_MEM_OUT_CTRL( address ):
48 sm_reg = RMAPPlugin0.Read( address, 1)
49 MEM_IN_SM_Empty = (sm_reg[0] & 0x00000030) >> 4
50 MEM_IN_SM_Full = (sm_reg[0] & 0x0000000c) >> 2
51 out_ren = (sm_reg[0] & 0x00000003)
52 print "MEM_OUT_SM = " + bin( sm_reg[0] & 0x3f ) \
53 + ", Empty = " + bin( MEM_IN_SM_Empty ) \
54 + ", Full = " + bin( MEM_IN_SM_Full ) \
55 + ", ren = " + bin( out_ren )
56 RMAPPlugin0.ProcessPendingEvents()
@@ -0,0 +1,80
1 import numpy as np
2
3 from __main__ import RMAPPlugin0
4
5 from test_fft.register_addresses import *
6 import test_fft.print_custom as prnt
7
8 def read_SM_Re( nbFrequencyBins, address_MEM_OUT_SM ):
9 currentComp_re = np.zeros( nbFrequencyBins )
10 if address_MEM_OUT_SM == FFT_SM_MEM_OUT_SM_0:
11 mask_REN = mask_REN_FIFO_0
12 elif address_MEM_OUT_SM == FFT_SM_MEM_OUT_SM_1:
13 mask_REN = mask_REN_FIFO_1
14 else:
15 prnt.print_custom( "ERR *** read_SM_Re *** unexpected address_MEM_OUT_SM" )
16 for frequencyBin in range(nbFrequencyBins):
17 # read Re
18 RMAPPlugin0.Write( FFT_SM_MEM_OUT_SM_CTRL, [mask_REN] )
19 val = RMAPPlugin0.Read( address_MEM_OUT_SM, 1)
20 currentComp_re[frequencyBin] = val[0]
21 RMAPPlugin0.ProcessPendingEvents()
22 return currentComp_re
23
24 def read_SM_Re_Im( nbFrequencyBins, address_MEM_OUT_SM ):
25 currentComp_re = np.zeros( nbFrequencyBins )
26 currentComp_im = np.zeros( nbFrequencyBins )
27 if address_MEM_OUT_SM == FFT_SM_MEM_OUT_SM_0:
28 mask_REN = mask_REN_FIFO_0
29 elif address_MEM_OUT_SM == FFT_SM_MEM_OUT_SM_1:
30 mask_REN = mask_REN_FIFO_1
31 else:
32 prnt.print_custom( "ERR *** read_SM_Re_Im *** unexpected address_MEM_OUT_SM" )
33 for frequencyBin in range(nbFrequencyBins):
34 # read Re
35 RMAPPlugin0.Write( FFT_SM_MEM_OUT_SM_CTRL, [mask_REN] )
36 val = RMAPPlugin0.Read( address_MEM_OUT_SM, 1)
37 currentComp_re[frequencyBin] = val[0]
38 # read Im
39 RMAPPlugin0.Write( FFT_SM_MEM_OUT_SM_CTRL, [mask_REN] )
40 val = RMAPPlugin0.Read( address_MEM_OUT_SM, 1)
41 currentComp_im[frequencyBin] = val[0]
42 RMAPPlugin0.ProcessPendingEvents()
43 return (currentComp_re, currentComp_im)
44
45 def read_SM_ONLY_Re( nbFrequencyBins, address_MEM_OUT_SM ):
46 currentComp_re = np.zeros( nbFrequencyBins )
47 if address_MEM_OUT_SM == SM_ONLY_MEM_OUT_SM_0:
48 mask_REN = mask_REN_FIFO_0
49 elif address_MEM_OUT_SM == SM_ONLY_MEM_OUT_SM_1:
50 mask_REN = mask_REN_FIFO_1
51 else:
52 prnt.print_custom( "ERR *** read_SM_ONLY_Re *** unexpected address_MEM_OUT_SM" )
53 for frequencyBin in range(nbFrequencyBins):
54 # read Re
55 RMAPPlugin0.Write( SM_ONLY_MEM_OUT_CTRL, [mask_REN] )
56 val = RMAPPlugin0.Read( address_MEM_OUT_SM, 1)
57 currentComp_re[frequencyBin] = val[0]
58 RMAPPlugin0.ProcessPendingEvents()
59 return currentComp_re
60
61 def read_SM_ONLY_Re_Im( nbFrequencyBins, address_MEM_OUT_SM ):
62 currentComp_re = np.zeros( nbFrequencyBins )
63 currentComp_im = np.zeros( nbFrequencyBins )
64 if address_MEM_OUT_SM == SM_ONLY_MEM_OUT_SM_0:
65 mask_REN = mask_REN_FIFO_0
66 elif address_MEM_OUT_SM == SM_ONLY_MEM_OUT_SM_1:
67 mask_REN = mask_REN_FIFO_1
68 else:
69 prnt.print_custom( "ERR *** read_SM_ONLY_Re_Im *** unexpected address_MEM_OUT_SM" )
70 for frequencyBin in range(nbFrequencyBins):
71 # read Re
72 RMAPPlugin0.Write( SM_ONLY_MEM_OUT_CTRL, [mask_REN] )
73 val = RMAPPlugin0.Read( address_MEM_OUT_SM, 1)
74 currentComp_re[frequencyBin] = val[0]
75 # read Im
76 RMAPPlugin0.Write( SM_ONLY_MEM_OUT_CTRL, [mask_REN] )
77 val = RMAPPlugin0.Read( address_MEM_OUT_SM, 1)
78 currentComp_im[frequencyBin] = val[0]
79 RMAPPlugin0.ProcessPendingEvents()
80 return (currentComp_re, currentComp_im)
@@ -0,0 +1,90
1 import numpy as np
2
3 from __main__ import RMAPPlugin0
4
5 from test_fft.register_addresses import *
6 import test_fft.print_custom as prnt
7
8 def is_MEM_IN_SM_Emty( address ):
9 ret = 0
10 fft_reg = RMAPPlugin0.Read( address, 1)
11 MEM_IN_SM_Empty = (fft_reg[0] & 0x01f00000) >> 20
12 if MEM_IN_SM_Empty == 0x1f:
13 ret = 1
14 return ret
15
16 def out_locked_AND_out_reuse_AND_out_ren( address ):
17 # reuse => 0111 1111 1111 1111
18 RMAPPlugin0.Write( address, [0x00007fff] )
19
20 #==================================
21 #==================================
22
23 def is_MEM_OUT_SM_Empty( address ):
24 ret = 0
25 sm_reg = RMAPPlugin0.Read( address, 1)
26 MEM_OUT_SM_Empty = (sm_reg[0] & 0x00000030) >> 4
27 if MEM_OUT_SM_Empty == 0x3:
28 ret = 1
29 return ret
30
31 def is_MEM_OUT_SM_Full( address ):
32 ret = 0
33 sm_reg = RMAPPlugin0.Read( address, 1)
34 MEM_OUT_SM_Full = (sm_reg[0] & 0x0000000c) >> 2
35 if MEM_OUT_SM_Full != 0x0:
36 ret = 1
37 return ret
38
39 def is_MEM_OUT_SM_Full_FIFO_0( address ):
40 ret = 0
41 sm_reg = RMAPPlugin0.Read( address, 1)
42 MEM_OUT_SM_Full = (sm_reg[0] & 0x00000004) >> 2
43 if MEM_OUT_SM_Full == 0x01:
44 ret = 1
45 return ret
46
47 def is_MEM_OUT_SM_Full_FIFO_1( address ):
48 ret = 0
49 sm_reg = RMAPPlugin0.Read( address, 1)
50 MEM_OUT_SM_Full = (sm_reg[0] & 0x00000008) >> 3
51 if MEM_OUT_SM_Full == 0x01:
52 ret = 1
53 return ret
54
55 def wait_for_FIFO_0_Full( address ):
56 counter = 0
57 while ( is_MEM_OUT_SM_Full_FIFO_0( address ) == 0 ):
58 prnt.print_custom( "FIFO_0 not full " + str(counter) )
59 counter = counter + 1
60 if counter == 10:
61 break
62
63 def wait_for_FIFO_1_Full( address ):
64 counter = 0
65 while ( is_MEM_OUT_SM_Full_FIFO_1( address ) == 0 ):
66 prnt.print_custom( "FIFO_1 not full " + str(counter))
67 counter = counter + 1
68 if counter == 10:
69 break
70
71 def wait_for_FIFO_Full( fifo, address ):
72 if fifo == 0:
73 wait_for_FIFO_0_Full( address )
74 elif fifo == 1:
75 wait_for_FIFO_1_Full( address )
76 else:
77 prnt.print_custom( "ERR *** wait_for_FIFO_Full *** unexpted value for parameter [fifo]" )
78
79 def wait_for_FIFO_0_or_1_Full( address ):
80 counter = 0
81 sm_reg = RMAPPlugin0.Read( address, 1)
82 MEM_OUT_SM_Full = (sm_reg[0] & 0x0000000c) >> 2
83 while ( MEM_OUT_SM_Full == 0 ):
84 prnt.print_custom( "FIFO 0 or 1 not full " + str(counter))
85 counter = counter + 1
86 if counter == 10:
87 break
88 sm_reg = RMAPPlugin0.Read( address, 1)
89 MEM_OUT_SM_Full = (sm_reg[0] & 0x0000000c) >> 2
90 RMAPPlugin0.ProcessPendingEvents()
@@ -0,0 +1,58
1 #============================
2 # ADRESSES FOR THE FFT MODULE
3 # FIFO F0
4 FFT_FIFO_F0_1_0 = 0x80000f00
5 FFT_FIFO_F0_3_2 = 0x80000f04
6 FFT_FIFO_F0_4 = 0x80000f08
7 FFT_FIFO_F0_WEN = 0x80000f0c
8 # FIFO F1
9 FFT_FIFO_F1_1_0 = 0x80000f10
10 FFT_FIFO_F1_3_2 = 0x80000f14
11 FFT_FIFO_F1_4 = 0x80000f18
12 FFT_FIFO_F1_WEN = 0x80000f1c
13 # FIFO F2
14 FFT_FIFO_F2_1_0 = 0x80000f20
15 FFT_FIFO_F2_3_2 = 0x80000f24
16 FFT_FIFO_F2_4 = 0x80000f28
17 FFT_FIFO_F2_WEN = 0x80000f2c
18
19 FFT_MEM_IN_SM_0 = 0x80000f30
20 FFT_MEM_IN_SM_1 = 0x80000f34
21 FFT_MEM_IN_SM_2 = 0x80000f38
22 FFT_MEM_IN_SM_3 = 0x80000f3c
23 FFT_MEM_IN_SM_4 = 0x80000f40
24
25 FFT_CTRL = 0x80000f44
26
27 #================================
28 # ADDRESSES FOR THE FFT_SM DESIGN
29 FFT_SM_MEM_OUT_SM_0 = 0x80000f30
30 FFT_SM_MEM_OUT_SM_1 = 0x80000f34
31 FFT_SM_MEM_OUT_SM_CTRL = 0x80000f38
32
33 #=================================
34 # ADDRESSES FOR THE SM_ONLY DESIGN
35 SM_ONLY_MEM_IN_SM_0 = 0x80000f00
36 SM_ONLY_MEM_IN_SM_1 = 0x80000f04
37 SM_ONLY_MEM_IN_SM_2 = 0x80000f08
38 SM_ONLY_MEM_IN_SM_3 = 0x80000f0c
39 SM_ONLY_MEM_IN_SM_4 = 0x80000f10
40
41 SM_ONLY_MEM_IN_SM_CTRL = 0x80000f14
42
43 SM_ONLY_MEM_OUT_SM_0 = 0x80000f18
44 SM_ONLY_MEM_OUT_SM_1 = 0x80000f1c
45
46 SM_ONLY_MEM_OUT_CTRL = 0x80000f20
47
48 #======================
49 # GENERAL USE CONSTANTS
50 mask_REN_FIFO_0 = 0xfffffffe # 1110
51 mask_REN_FIFO_1 = 0xfffffffd # 1101
52 #
53 columnV = 1
54 columnE1 = 2
55 columnE2 = 3
56 columnB1 = 4
57 columnB2 = 5
58 columnB3 = 6 No newline at end of file
@@ -0,0 +1,241
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 import *
8
9 import test_fft.read_flags as flg
10 import test_fft.data_generator as dtgn
11 import test_fft.print_custom as prnt
12 import test_fft.read_data as rdata
13
14 prnt.print_custom( '*' )
15 prnt.print_custom( '*' )
16 prnt.print_custom( '*' )
17 prnt.print_custom( '*' )
18 prnt.print_custom( '*' )
19
20 ######################
21 # GET DATA FROM RECORD
22 #storageDirectory = '/home/paul/data/2014_06_24/'
23 #day = '2014_6_24-'
24 #hour = '9_0_3'
25 #suffix = '.data'
26
27 #typeOfData = '_SBM1_CWF_'
28 #cwf_f1 = np.genfromtxt( storageDirectory + day + hour + typeOfData + 'F1' + suffix,
29 # skip_header = 1)
30 cwf_f1 = np.zeros( 1000 )
31
32 #################
33 # BUILD WAVEFORMS
34 nbSamples = 256
35 #wfrm0 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnV )
36 #wfrm1 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE1 )
37 #wfrm2 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE2 )
38 #wfrm3 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB1 )
39 #wfrm4 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB2 )
40 wfrm0 = dtgn.sineWave( nbSamples, 10, 1000 )
41 wfrm1 = dtgn.dirac( nbSamples, 1000 )
42 wfrm2 = dtgn.step( nbSamples, 1000 )
43 wfrm3 = dtgn.continuous( nbSamples, 100 )
44 wfrm4 = dtgn.continuous( nbSamples, 1000 )
45
46 ################
47 # BUILD THE DATA
48 dataToWrite0 = dtgn.generateDataToWrite( nbSamples, wfrm0, wfrm1 )
49 dataToWrite1 = dtgn.generateDataToWrite( nbSamples, wfrm2, wfrm3 )
50 dataToWrite2 = dtgn.generateDataToWrite( nbSamples, wfrm4, np.zeros( nbSamples ) )
51
52 ########################
53 # WRITE WAVEFORM IN FIFO
54 prnt.print_reg_fft( FFT_CTRL )
55
56 prnt.print_custom( "1) write waveforms in FIFOs: " + str(len(dataToWrite0)) + " samples" )
57
58 for k in range(nbSamples):
59 RMAPPlugin0.Write( FFT_FIFO_F2_1_0, [dataToWrite0[k]] )
60 RMAPPlugin0.Write( FFT_FIFO_F2_3_2, [dataToWrite1[k]] )
61 RMAPPlugin0.Write( FFT_FIFO_F2_4, [dataToWrite2[k]] )
62 # write only the FIFO F2
63 RMAPPlugin0.Write( FFT_FIFO_F2_WEN, [0xffffffe0] )
64
65 prnt.print_custom( "1) data written in FIFOs" )
66
67 prnt.print_reg_fft( FFT_CTRL )
68
69 # LOCK FIFOs => 0111 1100 0001 1111
70 RMAPPlugin0.Write( FFT_CTRL, [0x00007c1f] )
71
72 # wait for SM_Full
73 fft_reg = RMAPPlugin0.Read( FFT_CTRL, 1)
74 counter = 0
75 while (fft_reg[0] & 0x000f8000) == 0:
76 prnt.print_custom( "SM not full" )
77 counter = counter + 1
78 if counter == 10:
79 break
80 fft_reg = RMAPPlugin0.Read( FFT_CTRL, 1)
81
82 prnt.print_reg_fft( FFT_CTRL )
83
84 ################
85 # FFT FIRST READ
86 prnt.print_custom( "======= FIRST READ" )
87 fft0_re = np.zeros( nbSamples )
88 fft0_im = np.zeros( nbSamples )
89 fft1_re = np.zeros( nbSamples )
90 fft1_im = np.zeros( nbSamples )
91 fft2_re = np.zeros( nbSamples )
92 fft2_im = np.zeros( nbSamples )
93 fft3_re = np.zeros( nbSamples )
94 fft3_im = np.zeros( nbSamples )
95 fft4_re = np.zeros( nbSamples )
96 fft4_im = np.zeros( nbSamples )
97
98 for k in range(128):
99 # read enable => 0111 1100 0000 0000
100 RMAPPlugin0.Write( FFT_CTRL, [0x00007c00] )
101 val = RMAPPlugin0.Read( FFT_MEM_IN_SM_0, 1)
102 fft0_re[k] = dtgn.convertToSigned16Bits( val[0] & 0x0000ffff )
103 fft0_im[k] = dtgn.convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
104 val = RMAPPlugin0.Read( FFT_MEM_IN_SM_1, 1)
105 fft1_re[k] = dtgn.convertToSigned16Bits( val[0] & 0x0000ffff )
106 fft1_im[k] = dtgn.convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
107 val = RMAPPlugin0.Read( FFT_MEM_IN_SM_2, 1)
108 fft2_re[k] = dtgn.convertToSigned16Bits( val[0] & 0x0000ffff )
109 fft2_im[k] = dtgn.convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
110 val = RMAPPlugin0.Read( FFT_MEM_IN_SM_3, 1)
111 fft3_re[k] = dtgn.convertToSigned16Bits( val[0] & 0x0000ffff )
112 fft3_im[k] = dtgn.convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
113 val = RMAPPlugin0.Read( FFT_MEM_IN_SM_4, 1)
114 fft4_re[k] = dtgn.convertToSigned16Bits( val[0] & 0x0000ffff )
115 fft4_im[k] = dtgn.convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
116 if flg.is_MEM_IN_SM_Emty( FFT_CTRL ) == 1:
117 prnt.print_custom( "k = " + str( k ) )
118
119 fft0 = fft0_re * fft0_re + fft0_im * fft0_im
120 fft1 = fft1_re * fft1_re + fft1_im * fft1_im
121 fft2 = fft2_re * fft2_re + fft2_im * fft2_im
122 fft3 = fft3_re * fft3_re + fft3_im * fft3_im
123 fft4 = fft4_re * fft4_re + fft4_im * fft4_im
124
125 #######
126 # REUSE
127 prnt.print_custom( "======= REUSE" )
128 flg.out_locked_AND_out_reuse_AND_out_ren( FFT_CTRL )
129 prnt.print_reg_fft( FFT_CTRL )
130
131 prnt.print_custom( "read data in fft FIFOs" )
132 fft0_re = np.zeros( nbSamples )
133 fft0_im = np.zeros( nbSamples )
134 fft1_re = np.zeros( nbSamples )
135 fft1_im = np.zeros( nbSamples )
136 fft2_re = np.zeros( nbSamples )
137 fft2_im = np.zeros( nbSamples )
138 fft3_re = np.zeros( nbSamples )
139 fft3_im = np.zeros( nbSamples )
140 fft4_re = np.zeros( nbSamples )
141 fft4_im = np.zeros( nbSamples )
142
143 for k in range(128):
144 # read enable => 0111 1100 0000 0000
145 val = RMAPPlugin0.Read( FFT_MEM_IN_SM_0, 1)
146 fft0_re[k] = dtgn.convertToSigned16Bits( val[0] & 0x0000ffff )
147 fft0_im[k] = dtgn.convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
148 val = RMAPPlugin0.Read( FFT_MEM_IN_SM_1, 1)
149 fft1_re[k] = dtgn.convertToSigned16Bits( val[0] & 0x0000ffff )
150 fft1_im[k] = dtgn.convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
151 val = RMAPPlugin0.Read( FFT_MEM_IN_SM_2, 1)
152 fft2_re[k] = dtgn.convertToSigned16Bits( val[0] & 0x0000ffff )
153 fft2_im[k] = dtgn.convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
154 val = RMAPPlugin0.Read( FFT_MEM_IN_SM_3, 1)
155 fft3_re[k] = dtgn.convertToSigned16Bits( val[0] & 0x0000ffff )
156 fft3_im[k] = dtgn.convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
157 val = RMAPPlugin0.Read( FFT_MEM_IN_SM_4, 1)
158 fft4_re[k] = dtgn.convertToSigned16Bits( val[0] & 0x0000ffff )
159 fft4_im[k] = dtgn.convertToSigned16Bits( ( (val[0] & 0xffff0000) >> 16 ) )
160 RMAPPlugin0.Write( FFT_CTRL, [0x00007c00] )
161 if flg.is_MEM_IN_SM_Emty( FFT_CTRL ) == 1:
162 prnt.print_custom( "k = " + str( k ) )
163
164 fft0_b = fft0_re * fft0_re + fft0_im * fft0_im
165 fft1_b = fft1_re * fft1_re + fft1_im * fft1_im
166 fft2_b = fft2_re * fft2_re + fft2_im * fft2_im
167 fft3_b = fft3_re * fft3_re + fft3_im * fft3_im
168 fft4_b = fft4_re * fft4_re + fft4_im * fft4_im
169
170 prnt.print_custom( "data read in fft FIFOs" )
171
172 prnt.print_reg_fft( FFT_CTRL )
173
174 #unlock FIFOs => 0000 0000 0001 1111
175 RMAPPlugin0.Write( FFT_CTRL, [0x0000001f] )
176
177 prnt.print_reg_fft( FFT_CTRL )
178
179 # PLOT FFT
180
181 plt.figure( 1 )
182 plt.subplot(231)
183 plt.plot(wfrm0, 'b')
184 plt.subplot(232)
185 plt.plot(wfrm1, 'g')
186 plt.plot(wfrm1, '.')
187 plt.subplot(233)
188 plt.plot(wfrm2, 'r')
189 plt.plot(wfrm2, '.')
190 plt.subplot(234)
191 plt.plot(wfrm3, 'c')
192 plt.subplot(235)
193 plt.plot(wfrm4, 'm')
194
195 plt.figure( 2 )
196 plt.subplot(311)
197 plt.plot(fft0_re)
198 plt.plot(fft1_re)
199 plt.plot(fft2_re)
200 plt.plot(fft3_re)
201 plt.plot(fft4_re)
202
203 plt.subplot(312)
204 plt.plot(fft0_im)
205 plt.plot(fft1_im)
206 plt.plot(fft2_im)
207 plt.plot(fft3_im)
208 plt.plot(fft4_im)
209
210 plt.subplot(313)
211 plt.plot(fft0_re * fft0_re + fft0_im * fft0_im, 'b')
212 plt.plot(fft1_re * fft1_re + fft1_im * fft1_im, 'g')
213 plt.plot(fft2_re * fft2_re + fft2_im * fft2_im, 'r')
214 plt.plot(fft3_re * fft3_re + fft3_im * fft3_im, 'c')
215 plt.plot(fft4_re * fft4_re + fft4_im * fft4_im, 'm')
216
217 plt.figure( 3 )
218 plt.subplot(231)
219 plt.plot(fft0[0:255], 'b')
220 plt.subplot(232)
221 plt.plot(fft1[0:255], 'g')
222 plt.subplot(233)
223 plt.plot(fft2[0:255], 'r')
224 plt.subplot(234)
225 plt.plot(fft3[0:255], 'c')
226 plt.subplot(235)
227 plt.plot(fft4[0:255], 'm')
228
229 plt.figure( 4 )
230 plt.subplot(231)
231 plt.plot(fft0_b[0:255], 'b')
232 plt.subplot(232)
233 plt.plot(fft1_b[0:255], 'g')
234 plt.subplot(233)
235 plt.plot(fft2_b[0:255], 'r')
236 plt.subplot(234)
237 plt.plot(fft3_b[0:255], 'c')
238 plt.subplot(235)
239 plt.plot(fft4_b[0:255], 'm')
240
241 plt.show() No newline at end of file
@@ -0,0 +1,193
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 import *
8
9 import test_fft.read_flags as flg
10 import test_fft.data_generator as dtgn
11 import test_fft.print_custom as prnt
12 import test_fft.read_data as rdata
13
14 prnt.print_custom( '*' )
15 prnt.print_custom( '*' )
16 prnt.print_custom( '*' )
17 prnt.print_custom( '*' )
18 prnt.print_custom( '*' )
19
20 ######################
21 # GET DATA FROM RECORD
22 #storageDirectory = '/home/paul/data/2014_06_24/'
23 #day = '2014_6_24-'
24 #hour = '9_0_3'
25 #suffix = '.data'
26
27 #typeOfData = '_SBM1_CWF_'
28 #cwf_f1 = np.genfromtxt( storageDirectory + day + hour + typeOfData + 'F1' + suffix,
29 # skip_header = 1)
30 cwf_f1 = np.zeros( 1000 )
31
32 #################
33 # BUILD WAVEFORMS
34 nbSamples = 256
35 nbComponentsPerMatrix = 15
36 nbFrequencyBins = 128
37 #wfrm0 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnV )
38 #wfrm1 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE1 )
39 #wfrm2 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnE2 )
40 #wfrm3 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB1 )
41 #wfrm4 = getWaveFromRecord( cwf_f1, nbSamples, 0, columnB2 )
42 wfrm0 = dtgn.sineWave( 256, 10, 1000 )
43 wfrm1 = dtgn.sineWave( 256, 10, 1000 )
44 wfrm2 = dtgn.sineWave( 256, 20, 1000 )
45 wfrm3 = dtgn.sineWave( 256, 20, 1000 )
46 wfrm4 = dtgn.sineWave( 256, 50, 1000 )
47
48 ################
49 # BUILD THE DATA
50 dataToWrite0 = dtgn.generateDataToWrite( nbSamples, wfrm0, wfrm1 )
51 dataToWrite1 = dtgn.generateDataToWrite( nbSamples, wfrm2, wfrm3 )
52 dataToWrite2 = dtgn.generateDataToWrite( nbSamples, wfrm4, np.zeros( nbSamples ) )
53
54 ########################
55 # WRITE WAVEFORM IN FIFO
56 prnt.print_custom( "1) write waveforms in FIFOs: " + str(len(dataToWrite0)) + " samples" )
57 prnt.print_reg_sm( FFT_SM_MEM_OUT_SM_CTRL )
58
59 for k in range(nbSamples):
60 RMAPPlugin0.Write( FFT_FIFO_F2_1_0, [dataToWrite0[k]] )
61 RMAPPlugin0.Write( FFT_FIFO_F2_3_2, [dataToWrite1[k]] )
62 RMAPPlugin0.Write( FFT_FIFO_F2_4, [dataToWrite2[k]] )
63 # write only the FIFO F2
64 RMAPPlugin0.Write( FFT_FIFO_F2_WEN, [0xffffffe0] )
65
66 prnt.print_custom( "1) data written in FIFOs" )
67
68 ################
69 # SM FIRST READ
70 prnt.print_custom( "======= SM FIRST READ" )
71
72 components = []
73
74 flg.wait_for_FIFO_0_or_1_Full( FFT_SM_MEM_OUT_SM_CTRL )
75
76 if flg.is_MEM_OUT_SM_Full_FIFO_0( FFT_SM_MEM_OUT_SM_CTRL ):
77 address_MEM_OUT_SM = FFT_SM_MEM_OUT_SM_1
78 fifo_to_wait_for = 0
79 elif flg.is_MEM_OUT_SM_Full_FIFO_1( FFT_SM_MEM_OUT_SM_CTRL ):
80 address_MEM_OUT_SM = FFT_SM_MEM_OUT_SM_0
81 fifo_to_wait_for = 1
82
83 for component in range(nbComponentsPerMatrix):
84 prnt.print_custom( "==== component = " + str( component )
85 + ", read @ " + hex(address_MEM_OUT_SM & 0xffffffff) )
86 prnt.print_reg_sm( FFT_SM_MEM_OUT_SM_CTRL )
87 currentComp_re = np.zeros( nbFrequencyBins )
88 currentComp_im = np.zeros( nbFrequencyBins )
89 if (component == 0) | (component == 12):
90 flg.wait_for_FIFO_Full( fifo_to_wait_for, FFT_SM_MEM_OUT_SM_CTRL )
91 currentComp_re = rdata.read_SM_Re( nbFrequencyBins, address_MEM_OUT_SM )
92 components.append( currentComp_re )
93 elif (component == 5) | (component == 9):
94 flg.wait_for_FIFO_Full( fifo_to_wait_for, FFT_SM_MEM_OUT_SM_CTRL )
95 currentComp_re = rdata.read_SM_Re( nbFrequencyBins, address_MEM_OUT_SM )
96 components.append( currentComp_re )
97 elif (component == 1) | (component == 3) | (component == 7):
98 currentComp_re, currentComp_im = rdata.read_SM_Re_Im( nbFrequencyBins, address_MEM_OUT_SM )
99 components.append( currentComp_re )
100 components.append( currentComp_im )
101 flg.wait_for_FIFO_Full( fifo_to_wait_for, FFT_SM_MEM_OUT_SM_CTRL )
102 elif (component == 2) | (component == 6) | (component == 10):
103 currentComp_re, currentComp_im = rdata.read_SM_Re_Im( nbFrequencyBins, address_MEM_OUT_SM )
104 components.append( currentComp_re )
105 components.append( currentComp_im )
106 flg.wait_for_FIFO_Full( fifo_to_wait_for, FFT_SM_MEM_OUT_SM_CTRL )
107 elif (component == 4) | (component == 8):
108 currentComp_re, currentComp_im = rdata.read_SM_Re_Im( nbFrequencyBins, address_MEM_OUT_SM )
109 components.append( currentComp_re )
110 components.append( currentComp_im )
111 elif (component == 11) | (component == 13):
112 currentComp_re, currentComp_im = rdata.read_SM_Re_Im( nbFrequencyBins, address_MEM_OUT_SM )
113 components.append( currentComp_re )
114 components.append( currentComp_im )
115 elif (component == 14):
116 currentComp_re = rdata.read_SM_Re( nbFrequencyBins, address_MEM_OUT_SM )
117 components.append( currentComp_re )
118 else:
119 prnt.print_custom( "unexpected value for component" )
120 # change FIFO
121 if address_MEM_OUT_SM == FFT_SM_MEM_OUT_SM_0:
122 address_MEM_OUT_SM = FFT_SM_MEM_OUT_SM_1
123 fifo_to_wait_for = 0
124 elif address_MEM_OUT_SM == FFT_SM_MEM_OUT_SM_1:
125 address_MEM_OUT_SM = FFT_SM_MEM_OUT_SM_0
126 fifo_to_wait_for = 1
127
128 prnt.print_custom( "======= READ COMPLETE" )
129
130 prnt.print_reg_sm( FFT_SM_MEM_OUT_SM_CTRL )
131
132 # PLOT SM
133
134 plt.figure( 1 )
135 plt.subplot(231)
136 plt.plot(wfrm0, 'b')
137 plt.subplot(232)
138 plt.plot(wfrm1, 'g')
139 plt.plot(wfrm1, '.')
140 plt.subplot(233)
141 plt.plot(wfrm2, 'r')
142 plt.plot(wfrm2, '.')
143 plt.subplot(234)
144 plt.plot(wfrm3, 'c')
145 plt.subplot(235)
146 plt.plot(wfrm4, 'm')
147
148 plt.figure( 2 )
149
150 plt.subplot(231)
151 plt.plot(components[0], label='0')
152 plt.plot(components[1], label='1')
153 plt.plot(components[2], label='2')
154 plt.plot(components[3], label='3')
155 plt.legend(loc='upper right')
156
157 plt.subplot(232)
158 plt.plot(components[4], label='4')
159 plt.plot(components[5], label='5')
160 plt.plot(components[6], label='6')
161 plt.plot(components[7], label='7')
162 plt.legend(loc='upper right')
163
164 plt.subplot(233)
165 plt.plot(components[8], label='8')
166 plt.plot(components[9], label='9')
167 plt.plot(components[10], label='10')
168 plt.plot(components[11], label='11')
169 plt.legend(loc='upper right')
170
171 plt.subplot(234)
172 plt.plot(components[12], label='12')
173 plt.plot(components[13], label='13')
174 plt.plot(components[14], label='14')
175 plt.plot(components[15], label='15')
176 plt.legend(loc='upper right')
177
178 plt.subplot(235)
179 plt.plot(components[16], label='16')
180 plt.plot(components[17], label='17')
181 plt.plot(components[18], label='18')
182 plt.plot(components[19], label='19')
183 plt.legend(loc='upper right')
184
185 plt.subplot(236)
186 plt.plot(components[20], label='20')
187 plt.plot(components[21], label='21')
188 plt.plot(components[22], label='22')
189 plt.plot(components[23], label='23')
190 plt.plot(components[24], label='24')
191 plt.legend(loc='upper right')
192
193 plt.show() No newline at end of file
@@ -0,0 +1,218
1 import numpy as np
2 import matplotlib.pyplot as plt
3
4 from test_fft.register_addresses import *
5
6 import test_fft.read_flags as flg
7 import test_fft.data_generator as dtgn
8 import test_fft.print_custom as prnt
9 import test_fft.read_data as rdata
10
11 prnt.print_custom( '*' )
12 prnt.print_custom( '*' )
13 prnt.print_custom( '*' )
14 prnt.print_custom( '*' )
15 prnt.print_custom( '*' )
16
17 ############
18 # BUILD DATA
19 nbSamples = 256
20 nbComponentsPerMatrix = 15
21 nbFrequencyBins = 128
22 re_0 = dtgn.sineWave( nbFrequencyBins, 10, 10 )
23 im_0 = dtgn.sineWave( nbFrequencyBins, 10, 10 )
24 dataToWrite_0 = dtgn.generateDataToWrite( nbFrequencyBins, re_0, im_0 )
25 re_1 = dtgn.sineWave( nbFrequencyBins, 10, 20 )
26 im_1 = dtgn.sineWave( nbFrequencyBins, 10, 20 )
27 dataToWrite_1 = dtgn.generateDataToWrite( nbFrequencyBins, re_1, im_1 )
28 re_2 = dtgn.sineWave( nbFrequencyBins, 10, 30 )
29 im_2 = dtgn.sineWave( nbFrequencyBins, 10, 30 )
30 dataToWrite_2 = dtgn.generateDataToWrite( nbFrequencyBins, re_2, im_2 )
31 re_3 = dtgn.sineWave( nbFrequencyBins, 10, 40 )
32 im_3 = dtgn.sineWave( nbFrequencyBins, 10, 40 )
33 dataToWrite_3 = dtgn.generateDataToWrite( nbFrequencyBins, re_3, im_3 )
34 re_4 = dtgn.sineWave( nbFrequencyBins, 10, 50 )
35 im_4 = dtgn.sineWave( nbFrequencyBins, 10, 50 )
36 dataToWrite_4 = dtgn.generateDataToWrite( nbFrequencyBins, re_4, im_4 )
37
38 re_0 = dtgn.step( nbFrequencyBins, 10 )
39 im_0 = dtgn.continuous( nbFrequencyBins, 10 )
40 dataToWrite_0 = dtgn.generateDataToWrite( nbFrequencyBins, re_0, im_0 )
41 re_1 = dtgn.step( nbFrequencyBins, 20 )
42 im_1 = dtgn.continuous( nbFrequencyBins, 20 )
43 dataToWrite_1 = dtgn.generateDataToWrite( nbFrequencyBins, re_1, im_1 )
44 re_2 = dtgn.step( nbFrequencyBins, 30 )
45 im_2 = dtgn.continuous( nbFrequencyBins, 30 )
46 dataToWrite_2 = dtgn.generateDataToWrite( nbFrequencyBins, re_2, im_2 )
47 re_3 = dtgn.step( nbFrequencyBins, 40 )
48 im_3 = dtgn.continuous( nbFrequencyBins, 40 )
49 dataToWrite_3 = dtgn.generateDataToWrite( nbFrequencyBins, re_3, im_3 )
50 re_4 = dtgn.step( nbFrequencyBins, 50 )
51 im_4 = dtgn.continuous( nbFrequencyBins, 50 )
52 dataToWrite_4 = dtgn.generateDataToWrite( nbFrequencyBins, re_4, im_4 )
53
54 diracPosition = 60
55 re_0 = dtgn.dirac( nbFrequencyBins, 10, diracPosition )
56 im_0 = dtgn.dirac( nbFrequencyBins, 10, diracPosition )
57 dataToWrite_0 = dtgn.generateDataToWrite( nbFrequencyBins, re_0, im_0 )
58 re_1 = dtgn.dirac( nbFrequencyBins, 20, diracPosition )
59 im_1 = dtgn.dirac( nbFrequencyBins, 20, diracPosition )
60 dataToWrite_1 = dtgn.generateDataToWrite( nbFrequencyBins, re_1, im_1 )
61 re_2 = dtgn.dirac( nbFrequencyBins, 30, diracPosition )
62 im_2 = dtgn.dirac( nbFrequencyBins, 30, diracPosition )
63 dataToWrite_2 = dtgn.generateDataToWrite( nbFrequencyBins, re_2, im_2 )
64 re_3 = dtgn.dirac( nbFrequencyBins, 40, diracPosition )
65 im_3 = dtgn.dirac( nbFrequencyBins, 40, diracPosition )
66 dataToWrite_3 = dtgn.generateDataToWrite( nbFrequencyBins, re_3, im_3 )
67 re_4 = dtgn.dirac( nbFrequencyBins, 50, diracPosition )
68 im_4 = dtgn.dirac( nbFrequencyBins, 50, diracPosition )
69 dataToWrite_4 = dtgn.generateDataToWrite( nbFrequencyBins, re_4, im_4 )
70
71 ########################
72 # WRITE WAVEFORM IN FIFO
73 prnt.print_reg_sm_only_MEM_IN_CTRL( SM_ONLY_MEM_IN_SM_CTRL )
74 prnt.print_reg_sm_only_MEM_OUT_CTRL( SM_ONLY_MEM_OUT_CTRL )
75 prnt.print_custom( "1) write data in SM_MEM_IN: " + str(len(dataToWrite_0)) + " bins" )
76
77 for k in range(nbFrequencyBins):
78 RMAPPlugin0.Write( SM_ONLY_MEM_IN_SM_0, [dataToWrite_0[k]] )
79 RMAPPlugin0.Write( SM_ONLY_MEM_IN_SM_1, [dataToWrite_1[k]] )
80 RMAPPlugin0.Write( SM_ONLY_MEM_IN_SM_2, [dataToWrite_2[k]] )
81 RMAPPlugin0.Write( SM_ONLY_MEM_IN_SM_3, [dataToWrite_3[k]] )
82 RMAPPlugin0.Write( SM_ONLY_MEM_IN_SM_4, [dataToWrite_4[k]] )
83 RMAPPlugin0.Write( SM_ONLY_MEM_IN_SM_CTRL, [0xffffffe0] )
84
85 prnt.print_custom( "1) data written in SM_MEM_IN" )
86 prnt.print_reg_sm_only_MEM_IN_CTRL( SM_ONLY_MEM_IN_SM_CTRL )
87 prnt.print_reg_sm_only_MEM_OUT_CTRL( SM_ONLY_MEM_OUT_CTRL )
88
89 ################
90 # SM FIRST READ
91 prnt.print_custom( "======= SM FIRST READ" )
92
93 components = []
94
95 flg.wait_for_FIFO_0_or_1_Full( SM_ONLY_MEM_OUT_CTRL )
96
97 if flg.is_MEM_OUT_SM_Full_FIFO_0( SM_ONLY_MEM_OUT_CTRL ):
98 address_MEM_OUT_SM = SM_ONLY_MEM_OUT_SM_1
99 fifo_to_wait_for = 0
100 elif flg.is_MEM_OUT_SM_Full_FIFO_1( SM_ONLY_MEM_OUT_CTRL ):
101 address_MEM_OUT_SM = SM_ONLY_MEM_OUT_SM_0
102 fifo_to_wait_for = 1
103 else:
104 prnt.print_custom("oups, FIFO_0 and FIFO_1 are not full, this is unexpected")
105
106 for component in range(nbComponentsPerMatrix):
107 prnt.print_custom( "==== component = " + str( component )
108 + ", read @ " + hex(address_MEM_OUT_SM & 0xffffffff) )
109 prnt.print_reg_sm_only_MEM_IN_CTRL( SM_ONLY_MEM_IN_SM_CTRL )
110 prnt.print_reg_sm_only_MEM_OUT_CTRL( SM_ONLY_MEM_OUT_CTRL )
111 currentComp_re = np.zeros( nbFrequencyBins )
112 currentComp_im = np.zeros( nbFrequencyBins )
113 if (component == 0) | (component == 12):
114 flg.wait_for_FIFO_Full( fifo_to_wait_for, SM_ONLY_MEM_OUT_CTRL )
115 currentComp_re = rdata.read_SM_ONLY_Re( nbFrequencyBins, address_MEM_OUT_SM )
116 components.append( currentComp_re )
117 elif (component == 5) | (component == 9):
118 flg.wait_for_FIFO_Full( fifo_to_wait_for, SM_ONLY_MEM_OUT_CTRL )
119 currentComp_re = rdata.read_SM_ONLY_Re( nbFrequencyBins, address_MEM_OUT_SM )
120 components.append( currentComp_re )
121 elif (component == 1) | (component == 3) | (component == 7):
122 currentComp_re, currentComp_im = rdata.read_SM_ONLY_Re_Im( nbFrequencyBins, address_MEM_OUT_SM )
123 components.append( currentComp_re )
124 components.append( currentComp_im )
125 flg.wait_for_FIFO_Full( fifo_to_wait_for, SM_ONLY_MEM_OUT_CTRL )
126 elif (component == 2) | (component == 6) | (component == 10):
127 currentComp_re, currentComp_im = rdata.read_SM_ONLY_Re_Im( nbFrequencyBins, address_MEM_OUT_SM )
128 components.append( currentComp_re )
129 components.append( currentComp_im )
130 flg.wait_for_FIFO_Full( fifo_to_wait_for, SM_ONLY_MEM_OUT_CTRL )
131 elif (component == 4) | (component == 8):
132 currentComp_re, currentComp_im = rdata.read_SM_ONLY_Re_Im( nbFrequencyBins, address_MEM_OUT_SM )
133 components.append( currentComp_re )
134 components.append( currentComp_im )
135 elif (component == 11) | (component == 13):
136 currentComp_re, currentComp_im = rdata.read_SM_ONLY_Re_Im( nbFrequencyBins, address_MEM_OUT_SM )
137 components.append( currentComp_re )
138 components.append( currentComp_im )
139 elif (component == 14):
140 currentComp_re = rdata.read_SM_ONLY_Re( nbFrequencyBins, address_MEM_OUT_SM )
141 components.append( currentComp_re )
142 else:
143 prnt.print_custom( "unexpected value for component" )
144 # change FIFO
145 if address_MEM_OUT_SM == SM_ONLY_MEM_OUT_SM_0:
146 address_MEM_OUT_SM = SM_ONLY_MEM_OUT_SM_1
147 fifo_to_wait_for = 0
148 elif address_MEM_OUT_SM == SM_ONLY_MEM_OUT_SM_1:
149 address_MEM_OUT_SM = SM_ONLY_MEM_OUT_SM_0
150 fifo_to_wait_for = 1
151
152 prnt.print_custom( "======= READ COMPLETE" )
153
154 prnt.print_reg_sm_only_MEM_IN_CTRL( SM_ONLY_MEM_IN_SM_CTRL )
155 prnt.print_reg_sm_only_MEM_OUT_CTRL( SM_ONLY_MEM_OUT_CTRL )
156
157 # PLOT SM
158
159 plt.figure( 1 )
160 plt.subplot(231)
161 plt.plot(re_0, 'b')
162 plt.subplot(232)
163 plt.plot(re_1, 'g')
164 plt.plot(re_1, '.')
165 plt.subplot(233)
166 plt.plot(re_2, 'r')
167 plt.plot(re_2, '.')
168 plt.subplot(234)
169 plt.plot(re_3, 'c')
170 plt.subplot(235)
171 plt.plot(re_4, 'm')
172
173 plt.figure( 2 )
174
175 plt.subplot(231)
176 plt.plot(components[0], label='0')
177 plt.plot(components[1], '.', label='1')
178 plt.plot(components[2], label='2')
179 plt.plot(components[3], '.', label='3')
180 plt.legend(loc='upper right')
181
182 plt.subplot(232)
183 plt.plot(components[4], label='4')
184 plt.plot(components[5], '.', label='5')
185 plt.plot(components[6], label='6')
186 plt.plot(components[7], '.', label='7')
187 plt.legend(loc='upper right')
188
189 plt.subplot(233)
190 plt.plot(components[8], label='8')
191 plt.plot(components[9], label='9')
192 plt.plot(components[10], '.', label='10')
193 plt.plot(components[11], label='11')
194 plt.legend(loc='upper right')
195
196 plt.subplot(234)
197 plt.plot(components[12], label='12')
198 plt.plot(components[13], label='13')
199 plt.plot(components[14], label='14')
200 plt.plot(components[15], label='15')
201 plt.legend(loc='upper right')
202
203 plt.subplot(235)
204 plt.plot(components[16], label='16')
205 plt.plot(components[17], label='17')
206 plt.plot(components[18], label='18')
207 plt.plot(components[19], label='19')
208 plt.legend(loc='upper right')
209
210 plt.subplot(236)
211 plt.plot(components[20], label='20')
212 plt.plot(components[21], label='21')
213 plt.plot(components[22], label='22')
214 plt.plot(components[23], label='23')
215 plt.plot(components[24], label='24')
216 plt.legend(loc='upper right')
217
218 plt.show() No newline at end of file
@@ -1,451 +1,498
1 1 {
2 2 "auto_complete":
3 3 {
4 4 "selected_items":
5 5 [
6 6 [
7 "nb",
8 "nbFrequencyBins"
9 ],
10 [
7 11 "fi",
8 12 "fifo_to_wait_for"
9 13 ],
10 14 [
11 15 "MEM",
12 16 "MEM_OUT_SM_Full"
13 17 ],
14 18 [
15 19 "add",
16 20 "address_MEM_OUT_SM"
17 21 ],
18 22 [
19 23 "addrses",
20 24 "address_MEM_OUT_SM_0"
21 25 ],
22 26 [
23 27 "address_MEM",
24 28 "address_MEM_OUT_SM_1"
25 29 ],
26 30 [
27 31 "address_M",
28 32 "address_MEM_OUT_SM_1"
29 33 ],
30 34 [
31 35 "ad",
32 36 "address_MEM_OUT_SM_0"
33 37 ],
34 38 [
35 39 "address",
36 40 "address_MEM_OUT_SM"
37 41 ],
38 42 [
39 43 "print",
40 44 "print_custom"
41 45 ],
42 46 [
43 47 "is_MEM_OUT_SM_Full_",
44 48 "is_MEM_OUT_SM_Full_FIFO_0"
45 49 ],
46 50 [
47 51 "curre",
48 52 "currentComp_im"
49 53 ],
50 54 [
51 55 "MEM_OUT_SM_Ful",
52 56 "MEM_OUT_SM_Full_s"
53 57 ],
54 58 [
55 59 "fft0",
56 60 "fft0_im"
57 61 ],
58 62 [
59 63 "fft",
60 64 "fft0_im"
61 65 ],
62 66 [
63 67 "dataB",
64 68 "dataBufferConverted"
65 69 ],
66 70 [
67 71 "convert",
68 72 "convertToSigned16Bits"
69 73 ],
70 74 [
71 75 "data",
72 76 "dataInInt16"
73 77 ],
74 78 [
75 79 "wfrm",
76 80 "wfrm2"
77 81 ],
78 82 [
79 83 "column",
80 84 "columnB3"
81 85 ],
82 86 [
83 87 "colum",
84 88 "columnV"
85 89 ],
86 90 [
87 91 "out_re",
88 92 "out_ren"
89 93 ],
90 94 [
91 95 "wfr",
92 96 "wfrm0"
93 97 ],
94 98 [
95 99 "sin",
96 100 "sineWave"
97 101 ],
98 102 [
99 103 "if",
100 104 "ifmain if __name__ == '__main__'"
101 105 ],
102 106 [
103 107 "address_",
104 108 "address_MEM_IN_SM_0"
105 109 ],
106 110 [
107 111 "wf",
108 112 "wfrm0"
109 113 ],
110 114 [
111 115 "address_FIFO_F0_",
112 116 "address_FIFO_F0_4"
113 117 ],
114 118 [
115 119 "index",
116 120 "indexTransformDecimationInFrequency"
117 121 ],
118 122 [
119 123 "in",
120 124 "indexTransformDecimationInFrequency"
121 125 ],
122 126 [
123 127 "dft",
124 128 "dft_val"
125 129 ],
126 130 [
127 131 "butter",
128 132 "butterflyProcessor"
129 133 ],
130 134 [
131 135 "chec",
132 136 "checkbox_sy_lfr_bw"
133 137 ],
134 138 [
135 139 "send",
136 140 "sendLoadCommonPar"
137 141 ],
138 142 [
139 143 "groupbo",
140 144 "groupbox_tc_lfr_load_common_par"
141 145 ],
142 146 [
143 147 "l",
144 148 "layout_tc"
145 149 ],
146 150 [
147 151 "button",
148 152 "button_tc_lfr_load_common_par"
149 153 ],
150 154 [
151 155 "a",
152 156 "addWidget"
153 157 ],
154 158 [
155 159 "group",
156 160 "groupbox_tc_lfr_load_common_par"
157 161 ],
158 162 [
159 163 "c",
160 164 "common"
161 165 ],
162 166 [
163 167 "laben",
164 168 "label_UNKNOWN_nb"
165 169 ],
166 170 [
167 171 "UN",
168 172 "UNKNOWN_nb"
169 173 ]
170 174 ]
171 175 },
172 176 "buffers":
173 177 [
174 178 {
175 "file": "test_fft/test_sm_mini_lfr.py",
179 "file": "test_fft/test_sm_only.py",
176 180 "settings":
177 181 {
178 "buffer_size": 5847,
182 "buffer_size": 6506,
179 183 "line_ending": "Unix"
180 184 }
181 185 },
182 186 {
183 "file": "test_fft/test_sm_functions.py",
187 "file": "test_fft/test_sm_only_functions.py",
184 188 "settings":
185 189 {
186 "buffer_size": 3914,
190 "buffer_size": 2151,
187 191 "line_ending": "Unix"
188 192 }
189 193 },
190 194 {
191 "file": "test_fft/register_addresses_fft_test.py",
195 "file": "test_fft/test_sm_only_register_addresses.py",
196 "settings":
197 {
198 "buffer_size": 391,
199 "line_ending": "Unix"
200 }
201 },
202 {
203 "file": "test_fft/test_fft_register_addresses.py",
192 204 "settings":
193 205 {
194 206 "buffer_size": 873,
195 207 "line_ending": "Unix"
196 208 }
197 209 }
198 210 ],
199 211 "build_system": "",
200 212 "command_palette":
201 213 {
202 214 "height": 392.0,
203 215 "selected_items":
204 216 [
205 217 ],
206 218 "width": 392.0
207 219 },
208 220 "console":
209 221 {
210 222 "height": 146.0
211 223 },
212 224 "distraction_free":
213 225 {
214 226 "menu_visible": true,
215 227 "show_minimap": false,
216 228 "show_open_files": false,
217 229 "show_tabs": false,
218 230 "side_bar_visible": false,
219 231 "status_bar_visible": false
220 232 },
221 233 "file_history":
222 234 [
235 "/opt/LFR_EMULATOR/test_fft/test_sm_only_register_addresses.py",
236 "/opt/LFR_EMULATOR/test_fft/test_sm_only_functions.py",
237 "/opt/LFR_EMULATOR/test_fft/test_sm_functions.py",
238 "/opt/LFR_EMULATOR/test_fft/test_fft_register_addresses.py",
239 "/opt/LFR_EMULATOR/test_fft/test_fft_only.py",
240 "/opt/LFR_EMULATOR/test_fft/test_fft_functions.py",
241 "/opt/LFR_EMULATOR/test_fft/test_fft.py",
242 "/opt/LFR_EMULATOR/test_fft/general_functions.py",
243 "/opt/LFR_EMULATOR/test_fft/test_sm.py",
244 "/opt/LFR_EMULATOR/test_fft/register_addresses_fft_test.py",
223 245 "/opt/LFR_EMULATOR/test_fft/fft_test_functions.py",
224 246 "/opt/LFR_EMULATOR/test_fft/test_fft_mini_lfr.py",
225 "/opt/LFR_EMULATOR/test_fft/register_addresses_fft_test.py",
226 247 "/opt/LFR_EMULATOR/test_fft/functions_evaluations.py",
227 248 "/opt/LFR_EMULATOR/SRC/processing_chain.py",
228 249 "/opt/LFR_EMULATOR/main.py",
229 250 "/opt/LFR_EMULATOR/fft_8_decimation_in_frequency.py",
230 251 "/opt/LFR_EMULATOR/SRC/basic_parameters_Int.py",
231 252 "/opt/LFR_EMULATOR/butterfly_processor.py",
232 253 "/opt/LFR_EMULATOR/index_transform_decimation_in_frequency.py",
233 254 "/opt/LFR_EMULATOR/efficient_complex_multiplier.py",
234 255 "/opt/LFR_EMULATOR/twiddle_factors.py",
235 256 "/opt/LFR_EMULATOR/SRC/filters.py",
236 257 "/opt/LFR_EMULATOR/SRC/test_cases1.py",
237 258 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory.py",
238 259 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory (copy).py",
239 260 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step01/grspw_registers.py",
240 261 "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0002/tc_during_matrix_transmission.py",
241 262 "/opt/VALIDATION/lfrverif/common/actions_tc_lfr_launcher.py",
242 263 "/opt/VALIDATION/lfrverif/common/test_monitor.py",
243 264 "/opt/VALIDATION/validation.sublime-workspace",
244 265 "/opt/VALIDATION/validation.sublime-project",
245 266 "/opt/PYTHON/lfrverif/test1/test1main.py",
246 267 "/opt/PYTHON/lfrverif/test1/test1launcher.py",
247 268 "/opt/PYTHON/lfrverif/common/crcforlfr.py",
248 269 "/opt/PYTHON/lfrverif/common/tcparams.py",
249 270 "/opt/PYTHON/lfrverif/test1/testgui.py",
250 271 "/opt/PYTHON/lfrverif/test1/tcmonitor.py",
251 272 "/opt/PYTHON/lfrverif/test1/lppmoncfg.py",
252 273 "/opt/PYTHON/lfrverif/test1/wfdisplay.py",
253 274 "/opt/PYTHON/lfrverif/test1/lppmonplot.py",
254 275 "/opt/PYTHON/lfrverif/test1/tmmonitor.py"
255 276 ],
256 277 "find":
257 278 {
258 279 "height": 34.0
259 280 },
260 281 "find_in_files":
261 282 {
262 283 "height": 0.0,
263 284 "where_history":
264 285 [
265 286 "/opt/VALIDATION/lfrverif",
266 287 "/opt/VALIDATION/lfrverif/LFR_SVS"
267 288 ]
268 289 },
269 290 "find_state":
270 291 {
271 292 "case_sensitive": false,
272 293 "find_history":
273 294 [
274 295 "np",
275 296 "def displayInfoSendTc",
276 297 "dump",
277 298 "tc_lfr_dump_par",
278 299 "processpac",
279 300 "WriteSPWDelay",
280 301 "sendPacket",
281 302 "sendLoadCommonPar"
282 303 ],
283 304 "highlight": true,
284 305 "in_selection": false,
285 306 "preserve_case": false,
286 307 "regex": false,
287 308 "replace_history":
288 309 [
289 310 ],
290 311 "reverse": false,
291 312 "show_context": true,
292 313 "use_buffer2": true,
293 314 "whole_word": false,
294 315 "wrap": true
295 316 },
296 317 "groups":
297 318 [
298 319 {
299 320 "selected": 0,
300 321 "sheets":
301 322 [
302 323 {
303 324 "buffer": 0,
304 "file": "test_fft/test_sm_mini_lfr.py",
325 "file": "test_fft/test_sm_only.py",
305 326 "settings":
306 327 {
307 "buffer_size": 5847,
328 "buffer_size": 6506,
308 329 "regions":
309 330 {
310 331 },
311 332 "selection":
312 333 [
313 334 [
314 5847,
315 5847
335 3548,
336 3548
316 337 ]
317 338 ],
318 339 "settings":
319 340 {
320 341 "syntax": "Packages/Python/Python.tmLanguage",
321 342 "translate_tabs_to_spaces": false
322 343 },
323 344 "translation.x": 0.0,
324 "translation.y": 1640.0,
345 "translation.y": 0.0,
325 346 "zoom_level": 1.0
326 347 },
327 348 "type": "text"
328 349 },
329 350 {
330 351 "buffer": 1,
331 "file": "test_fft/test_sm_functions.py",
352 "file": "test_fft/test_sm_only_functions.py",
332 353 "settings":
333 354 {
334 "buffer_size": 3914,
355 "buffer_size": 2151,
335 356 "regions":
336 357 {
337 358 },
338 359 "selection":
339 360 [
340 361 [
341 2764,
342 2764
362 1314,
363 1314
343 364 ]
344 365 ],
345 366 "settings":
346 367 {
347 368 "syntax": "Packages/Python/Python.tmLanguage",
348 369 "translate_tabs_to_spaces": false
349 370 },
350 371 "translation.x": 0.0,
351 "translation.y": 1404.0,
372 "translation.y": 324.0,
352 373 "zoom_level": 1.0
353 374 },
354 375 "type": "text"
355 376 },
356 377 {
357 378 "buffer": 2,
358 "file": "test_fft/register_addresses_fft_test.py",
379 "file": "test_fft/test_sm_only_register_addresses.py",
380 "settings":
381 {
382 "buffer_size": 391,
383 "regions":
384 {
385 },
386 "selection":
387 [
388 [
389 297,
390 297
391 ]
392 ],
393 "settings":
394 {
395 "syntax": "Packages/Python/Python.tmLanguage"
396 },
397 "translation.x": 0.0,
398 "translation.y": 0.0,
399 "zoom_level": 1.0
400 },
401 "type": "text"
402 },
403 {
404 "buffer": 3,
405 "file": "test_fft/test_fft_register_addresses.py",
359 406 "settings":
360 407 {
361 408 "buffer_size": 873,
362 409 "regions":
363 410 {
364 411 },
365 412 "selection":
366 413 [
367 414 [
368 703,
369 703
415 0,
416 0
370 417 ]
371 418 ],
372 419 "settings":
373 420 {
374 421 "syntax": "Packages/Python/Python.tmLanguage"
375 422 },
376 423 "translation.x": 0.0,
377 "translation.y": 108.0,
424 "translation.y": 0.0,
378 425 "zoom_level": 1.0
379 426 },
380 427 "type": "text"
381 428 }
382 429 ]
383 430 }
384 431 ],
385 432 "incremental_find":
386 433 {
387 434 "height": 0.0
388 435 },
389 436 "input":
390 437 {
391 "height": 0.0
438 "height": 34.0
392 439 },
393 440 "layout":
394 441 {
395 442 "cells":
396 443 [
397 444 [
398 445 0,
399 446 0,
400 447 1,
401 448 1
402 449 ]
403 450 ],
404 451 "cols":
405 452 [
406 453 0.0,
407 454 1.0
408 455 ],
409 456 "rows":
410 457 [
411 458 0.0,
412 459 1.0
413 460 ]
414 461 },
415 462 "menu_visible": true,
416 463 "output.exec":
417 464 {
418 465 "height": 28.0
419 466 },
420 467 "replace":
421 468 {
422 469 "height": 0.0
423 470 },
424 471 "save_all_on_build": true,
425 472 "select_file":
426 473 {
427 474 "height": 0.0,
428 475 "selected_items":
429 476 [
430 477 ],
431 478 "width": 0.0
432 479 },
433 480 "select_project":
434 481 {
435 482 "height": 500.0,
436 483 "selected_items":
437 484 [
438 485 [
439 486 "",
440 487 "/opt/PYTHON/waveform_analysis/wfmr_plots.sublime-project"
441 488 ]
442 489 ],
443 490 "width": 380.0
444 491 },
445 492 "show_minimap": true,
446 493 "show_open_files": false,
447 494 "show_tabs": true,
448 495 "side_bar_visible": true,
449 496 "side_bar_width": 289.0,
450 497 "status_bar_visible": true
451 498 }
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now