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