##// 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
@@ -4,6 +4,10
4 "selected_items":
4 "selected_items":
5 [
5 [
6 [
6 [
7 "nb",
8 "nbFrequencyBins"
9 ],
10 [
7 "fi",
11 "fi",
8 "fifo_to_wait_for"
12 "fifo_to_wait_for"
9 ],
13 ],
@@ -172,23 +176,31
172 "buffers":
176 "buffers":
173 [
177 [
174 {
178 {
175 "file": "test_fft/test_sm_mini_lfr.py",
179 "file": "test_fft/test_sm_only.py",
176 "settings":
180 "settings":
177 {
181 {
178 "buffer_size": 5847,
182 "buffer_size": 6506,
179 "line_ending": "Unix"
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 "settings":
188 "settings":
185 {
189 {
186 "buffer_size": 3914,
190 "buffer_size": 2151,
187 "line_ending": "Unix"
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 "settings":
204 "settings":
193 {
205 {
194 "buffer_size": 873,
206 "buffer_size": 873,
@@ -220,9 +232,18
220 },
232 },
221 "file_history":
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 "/opt/LFR_EMULATOR/test_fft/fft_test_functions.py",
245 "/opt/LFR_EMULATOR/test_fft/fft_test_functions.py",
224 "/opt/LFR_EMULATOR/test_fft/test_fft_mini_lfr.py",
246 "/opt/LFR_EMULATOR/test_fft/test_fft_mini_lfr.py",
225 "/opt/LFR_EMULATOR/test_fft/register_addresses_fft_test.py",
226 "/opt/LFR_EMULATOR/test_fft/functions_evaluations.py",
247 "/opt/LFR_EMULATOR/test_fft/functions_evaluations.py",
227 "/opt/LFR_EMULATOR/SRC/processing_chain.py",
248 "/opt/LFR_EMULATOR/SRC/processing_chain.py",
228 "/opt/LFR_EMULATOR/main.py",
249 "/opt/LFR_EMULATOR/main.py",
@@ -301,18 +322,18
301 [
322 [
302 {
323 {
303 "buffer": 0,
324 "buffer": 0,
304 "file": "test_fft/test_sm_mini_lfr.py",
325 "file": "test_fft/test_sm_only.py",
305 "settings":
326 "settings":
306 {
327 {
307 "buffer_size": 5847,
328 "buffer_size": 6506,
308 "regions":
329 "regions":
309 {
330 {
310 },
331 },
311 "selection":
332 "selection":
312 [
333 [
313 [
334 [
314 5847,
335 3548,
315 5847
336 3548
316 ]
337 ]
317 ],
338 ],
318 "settings":
339 "settings":
@@ -321,25 +342,25
321 "translate_tabs_to_spaces": false
342 "translate_tabs_to_spaces": false
322 },
343 },
323 "translation.x": 0.0,
344 "translation.x": 0.0,
324 "translation.y": 1640.0,
345 "translation.y": 0.0,
325 "zoom_level": 1.0
346 "zoom_level": 1.0
326 },
347 },
327 "type": "text"
348 "type": "text"
328 },
349 },
329 {
350 {
330 "buffer": 1,
351 "buffer": 1,
331 "file": "test_fft/test_sm_functions.py",
352 "file": "test_fft/test_sm_only_functions.py",
332 "settings":
353 "settings":
333 {
354 {
334 "buffer_size": 3914,
355 "buffer_size": 2151,
335 "regions":
356 "regions":
336 {
357 {
337 },
358 },
338 "selection":
359 "selection":
339 [
360 [
340 [
361 [
341 2764,
362 1314,
342 2764
363 1314
343 ]
364 ]
344 ],
365 ],
345 "settings":
366 "settings":
@@ -348,14 +369,40
348 "translate_tabs_to_spaces": false
369 "translate_tabs_to_spaces": false
349 },
370 },
350 "translation.x": 0.0,
371 "translation.x": 0.0,
351 "translation.y": 1404.0,
372 "translation.y": 324.0,
352 "zoom_level": 1.0
373 "zoom_level": 1.0
353 },
374 },
354 "type": "text"
375 "type": "text"
355 },
376 },
356 {
377 {
357 "buffer": 2,
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 "settings":
406 "settings":
360 {
407 {
361 "buffer_size": 873,
408 "buffer_size": 873,
@@ -365,8 +412,8
365 "selection":
412 "selection":
366 [
413 [
367 [
414 [
368 703,
415 0,
369 703
416 0
370 ]
417 ]
371 ],
418 ],
372 "settings":
419 "settings":
@@ -374,7 +421,7
374 "syntax": "Packages/Python/Python.tmLanguage"
421 "syntax": "Packages/Python/Python.tmLanguage"
375 },
422 },
376 "translation.x": 0.0,
423 "translation.x": 0.0,
377 "translation.y": 108.0,
424 "translation.y": 0.0,
378 "zoom_level": 1.0
425 "zoom_level": 1.0
379 },
426 },
380 "type": "text"
427 "type": "text"
@@ -388,7 +435,7
388 },
435 },
389 "input":
436 "input":
390 {
437 {
391 "height": 0.0
438 "height": 34.0
392 },
439 },
393 "layout":
440 "layout":
394 {
441 {
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now