-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmirror_spectrum_init_xblock.m
273 lines (244 loc) · 10.7 KB
/
mirror_spectrum_init_xblock.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Center for Astronomy Signal Processing and Electronics Research %
% http://casper.berkeley.edu %
% Copyright (C) 2011 Suraj Gowda %
% %
% This program is free software; you can redistribute it and/or modify %
% it under the terms of the GNU General Public License as published by %
% the Free Software Foundation; either version 2 of the License, or %
% (at your option) any later version. %
% %
% This program is distributed in the hope that it will be useful, %
% but WITHOUT ANY WARRANTY; without even the implied warranty of %
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %
% GNU General Public License for more details. %
% %
% You should have received a copy of the GNU General Public License along %
% with this program; if not, write to the Free Software Foundation, Inc., %
% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function mirror_spectrum_init_xblock(FFTSize, input_bitwidth, bram_latency, negate_latency, negate_mode)
%% inports
sync = xInport('sync');
din0 = xInport('din0');
reo_in0 = xInport('reo_in0');
din1 = xInport('din1');
reo_in1 = xInport('reo_in1');
din2 = xInport('din2');
reo_in2 = xInport('reo_in2');
din3 = xInport('din3');
reo_in3 = xInport('reo_in3');
%% outports
sync_out = xOutport('sync_out');
dout0 = xOutport('dout0');
dout1 = xOutport('dout1');
dout2 = xOutport('dout2');
dout3 = xOutport('dout3');
input_bin_pt = input_bitwidth - 1;
%% diagram
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/Constant3
Constant3_out1 = xSignal;
Constant3 = xBlock(struct('source', 'Constant', 'name', 'Constant3'), ...
struct('arith_type', 'Unsigned', ...
'const', 2^(FFTSize - 1), ...
'n_bits', FFTSize, ...
'bin_pt', 0, ...
'explicit_period', 'on'), ...
{}, ...
{Constant3_out1});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/Counter
Delay1_out1 = xSignal;
Counter_out1 = xSignal;
Counter = xBlock(struct('source', 'Counter', 'name', 'Counter'), ...
struct('n_bits', FFTSize, ...
'rst', 'on', ...
'explicit_period', 'off', ...
'use_rpm', 'on'), ...
{Delay1_out1}, ...
{Counter_out1});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/Delay1
Delay1 = xBlock(struct('source', 'Delay', 'name', 'Delay1'), ...
struct('latency', bram_latency - 2 + 1 + negate_latency), ...
{sync}, ...
{Delay1_out1});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/Delay2
Delay2 = xBlock(struct('source', 'Delay', 'name', 'Delay2'), ...
struct('latency', 2), ...
{Delay1_out1}, ...
{sync_out});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/Delay3
Delay3_out1 = xSignal;
Delay3 = xBlock(struct('source', 'Delay', 'name', 'Delay3'), ...
struct('latency', bram_latency - 1 + 1 + negate_latency), ...
{din0}, ...
{Delay3_out1});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/Delay4
Delay4_out1 = xSignal;
Delay4 = xBlock(struct('source', 'Delay', 'name', 'Delay4'), ...
struct('latency', bram_latency - 1 + 1 + negate_latency), ...
{din1}, ...
{Delay4_out1});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/Delay5
Delay5_out1 = xSignal;
Delay5 = xBlock(struct('source', 'Delay', 'name', 'Delay5'), ...
struct('latency', bram_latency - 1 + 1 + negate_latency), ...
{din2}, ...
{Delay5_out1});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/Delay6
Delay6_out1 = xSignal;
Delay6 = xBlock(struct('source', 'Delay', 'name', 'Delay6'), ...
struct('latency', bram_latency - 1 + 1 + negate_latency), ...
{din3}, ...
{Delay6_out1});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/Mux
Relational_out1 = xSignal;
complex_conj0_out1 = xSignal;
Mux = xBlock(struct('source', 'Mux', 'name', 'Mux'), ...
struct('latency', 1, ...
'arith_type', 'Signed (2''s comp)', ...
'n_bits', 8, ...
'bin_pt', 2), ...
{Relational_out1, Delay3_out1, complex_conj0_out1}, ...
{dout0});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/Mux1
complex_conj1_out1 = xSignal;
Mux1 = xBlock(struct('source', 'Mux', 'name', 'Mux1'), ...
struct('latency', 1, ...
'arith_type', 'Signed (2''s comp)', ...
'n_bits', 8, ...
'bin_pt', 2), ...
{Relational_out1, Delay4_out1, complex_conj1_out1}, ...
{dout1});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/Mux2
complex_conj2_out1 = xSignal;
Mux2 = xBlock(struct('source', 'Mux', 'name', 'Mux2'), ...
struct('latency', 1, ...
'arith_type', 'Signed (2''s comp)', ...
'n_bits', 8, ...
'bin_pt', 2), ...
{Relational_out1, Delay5_out1, complex_conj2_out1}, ...
{dout2});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/Mux3
complex_conj3_out1 = xSignal;
Mux3 = xBlock(struct('source', 'Mux', 'name', 'Mux3'), ...
struct('latency', 1, ...
'arith_type', 'Signed (2''s comp)', ...
'n_bits', 8, ...
'bin_pt', 2), ...
{Relational_out1, Delay6_out1, complex_conj3_out1}, ...
{dout3});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/Relational
Relational = xBlock(struct('source', 'Relational', 'name', 'Relational'), ...
struct('mode', 'a>b'), ...
{Counter_out1, Constant3_out1}, ...
{Relational_out1});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/complex_conj0
complex_conj_config.source = str2func('complex_conj_init');
complex_conj_config.name = 'complex_conj0';
complex_conj_config.depend = {'complex_conj_init.m'};
complex_conj0 = xBlock( complex_conj_config, {input_bitwidth, input_bin_pt, negate_latency, negate_mode}, ...
{reo_in0}, {complex_conj0_out1});
complex_conj_config.name = 'complex_conj1';
complex_conj1 = xBlock( complex_conj_config, {input_bitwidth, input_bin_pt, negate_latency, negate_mode}, ...
{reo_in1}, {complex_conj1_out1} );
complex_conj_config.name = 'complex_conj2';
complex_conj2 = xBlock( complex_conj_config, {input_bitwidth, input_bin_pt, negate_latency, negate_mode}, ...
{reo_in2}, {complex_conj2_out1});
complex_conj_config.name = 'complex_conj3';
complex_conj3 = xBlock( complex_conj_config, {input_bitwidth, input_bin_pt, negate_latency, negate_mode}, ...
{reo_in3}, {complex_conj3_out1});
% complex_conj0_sub = complex_conj0(18, 17, negate_latency, 'logic');
% complex_conj0_sub.bindPort({reo_in0}, {complex_conj0_out1});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/complex_conj1
% complex_conj1_sub = complex_conj1(18, 17, negate_latency, 'logic');
% complex_conj1_sub.bindPort({reo_in1}, {complex_conj1_out1});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/complex_conj2
% complex_conj2_sub = complex_conj2(18, 17, negate_latency, 'logic');
% complex_conj2_sub.bindPort({reo_in2}, {complex_conj2_out1});
% block: single_pol/fft_wideband_real1/fft_biplex_real_4x0/bi_real_unscr_4x/mirror_spectrum1/complex_conj3
% complex_conj3_sub = complex_conj3(18, 17, negate_latency, 'logic');
% complex_conj3_sub.bindPort({reo_in3}, {complex_conj3_out1});
%
%
% function xblock_obj = complex_conj0(bitwidth, bin_pt, latency, mode)
%
%
% % Mask Initialization code
% config.source = str2func('complex_conj_init');
%
% config.depend = {'complex_conj_init.m'};
% xblock_obj = xBlock( config, {bitwidth, bin_pt, latency, mode});
%
%
% %% inports
%
% %% outports
%
% %% diagram
%
%
%
% end
%
% function xblock_obj = complex_conj1(bitwidth, bin_pt, latency, mode)
%
%
% % Mask Initialization code
% config.source = str2func('complex_conj_init');
%
% config.depend = {'complex_conj_init.m'};
% xblock_obj = xBlock( config, {bitwidth, bin_pt, latency, mode});
%
%
% %% inports
%
% %% outports
%
% %% diagram
%
%
%
% end
%
% function xblock_obj = complex_conj2(bitwidth, bin_pt, latency, mode)
%
%
% % Mask Initialization code
% config.source = str2func('complex_conj_init');
%
% config.depend = {'complex_conj_init.m'};
% xblock_obj = xBlock( config, {bitwidth, bin_pt, latency, mode});
%
%
% %% inports
%
% %% outports
%
% %% diagram
%
%
%
% end
%
% function xblock_obj = complex_conj3(bitwidth, bin_pt, latency, mode)
%
%
% % Mask Initialization code
% config.source = str2func('complex_conj_init');
%
% config.depend = {'complex_conj_init.m'};
% xblock_obj = xBlock( config, {bitwidth, bin_pt, latency, mode});
%
%
% %% inports
%
% %% outports
%
% %% diagram
%
%
%
% end
end