-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbiplex_cplx_unscrambler_init_xblock.m
179 lines (157 loc) · 9.55 KB
/
biplex_cplx_unscrambler_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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Center for Astronomy Signal Processing and Electronics Research %
% http://casper.berkeley.edu %
% Copyright (C) 2011 Hong Chen %
% %
% 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 biplex_cplx_unscrambler_init_xblock(FFTSize, bram_latency)
% depend {'reorder_init_xblock','delay_bram_en_plus_init_xblock','dbl_buffer_init_xblock','sync_delay_en_init_xblock'}
% depend {'barrel_switcher_init_xblock'}
map = bit_reverse(0:2^(FFTSize-1)-1, FFTSize-1);
%% inports
xlsub2_even = xInport('even');
xlsub2_odd = xInport('odd');
xlsub2_sync = xInport('sync');
%% outports
xlsub2_pol1 = xOutport('pol1');
xlsub2_pol2 = xOutport('pol2');
xlsub2_sync_out = xOutport('sync_out');
%% diagram
% block: temp_biplex_cplx_unscrambler/biplex_cplx_unscrambler/Constant
xlsub2_Constant_out1 = xSignal;
xlsub2_Constant = xBlock(struct('source', 'Constant', 'name', 'Constant'), ...
struct('arith_type', 'Boolean', ...
'n_bits', 1, ...
'bin_pt', 0, ...
'explicit_period', 'on'), ...
{}, ...
{xlsub2_Constant_out1});
% block: temp_biplex_cplx_unscrambler/biplex_cplx_unscrambler/Constant1
xlsub2_Constant1_out1 = xSignal;
xlsub2_Constant1 = xBlock(struct('source', 'Constant', 'name', 'Constant1'), ...
struct('arith_type', 'Unsigned', ...
'const', 2^(FFTSize-1), ...
'n_bits', FFTSize, ...
'bin_pt', 0, ...
'explicit_period', 'on'), ...
{}, ...
{xlsub2_Constant1_out1});
% block: temp_biplex_cplx_unscrambler/biplex_cplx_unscrambler/Constant2
xlsub2_Constant2_out1 = xSignal;
xlsub2_Constant2 = xBlock(struct('source', 'Constant', 'name', 'Constant2'), ...
struct('arith_type', 'Unsigned', ...
'const', 2^(FFTSize-1), ...
'n_bits', FFTSize, ...
'bin_pt', 0, ...
'explicit_period', 'on'), ...
{}, ...
{xlsub2_Constant2_out1});
% block: temp_biplex_cplx_unscrambler/biplex_cplx_unscrambler/Convert
xlsub2_Relational_out1 = xSignal;
xlsub2_Convert_out1 = xSignal;
xlsub2_Convert = xBlock(struct('source', 'Convert', 'name', 'Convert'), ...
struct('arith_type', 'Unsigned', ...
'n_bits', 1, ...
'bin_pt', 0), ...
{xlsub2_Relational_out1}, ...
{xlsub2_Convert_out1});
% block: temp_biplex_cplx_unscrambler/biplex_cplx_unscrambler/Convert1
xlsub2_Relational1_out1 = xSignal;
xlsub2_Convert1_out1 = xSignal;
xlsub2_Convert1 = xBlock(struct('source', 'Convert', 'name', 'Convert1'), ...
struct('arith_type', 'Unsigned', ...
'n_bits', 1, ...
'bin_pt', 0), ...
{xlsub2_Relational1_out1}, ...
{xlsub2_Convert1_out1});
% block: temp_biplex_cplx_unscrambler/biplex_cplx_unscrambler/Counter
xlsub2_Counter_out1 = xSignal;
xlsub2_Counter = xBlock(struct('source', 'Counter', 'name', 'Counter'), ...
struct('n_bits', FFTSize, ...
'rst', 'on', ...
'explicit_period', 'off', ...
'use_rpm', 'on'), ...
{xlsub2_sync}, ...
{xlsub2_Counter_out1});
% block: temp_biplex_cplx_unscrambler/biplex_cplx_unscrambler/Counter1
xlsub2_reorder_out1 = xSignal;
xlsub2_Counter1_out1 = xSignal;
xlsub2_Counter1 = xBlock(struct('source', 'Counter', 'name', 'Counter1'), ...
struct('n_bits', FFTSize, ...
'rst', 'on', ...
'explicit_period', 'off', ...
'use_rpm', 'on'), ...
{xlsub2_reorder_out1}, ...
{xlsub2_Counter1_out1});
% block: temp_biplex_cplx_unscrambler/biplex_cplx_unscrambler/Relational
xlsub2_Relational = xBlock(struct('source', 'Relational', 'name', 'Relational'), ...
struct('mode', 'a<=b', ...
'latency', 0), ...
{xlsub2_Constant1_out1, xlsub2_Counter_out1}, ...
{xlsub2_Relational_out1});
% block: temp_biplex_cplx_unscrambler/biplex_cplx_unscrambler/Relational1
xlsub2_Relational1 = xBlock(struct('source', 'Relational', 'name', 'Relational1'), ...
struct('mode', 'a<=b', ...
'latency', 0), ...
{xlsub2_Constant2_out1, xlsub2_Counter1_out1}, ...
{xlsub2_Relational1_out1});
% block: temp_biplex_cplx_unscrambler/biplex_cplx_unscrambler/barrel_switcher1
xlsub2_reorder_out3 = xSignal;
xlsub2_reorder1_out3 = xSignal;
xlsub2_barrel_switcher1_config.source = str2func('barrel_switcher_init_xblock');
xlsub2_barrel_switcher1_config.name = 'barrel_switcher1';
xlsub2_barrel_switcher1_config.depend = {'barrel_switcher_init_xblock'};
xlsub2_barrel_switcher1_args = {1};
xlsub2_barrel_switcher1 = xBlock(xlsub2_barrel_switcher1_config, ...
xlsub2_barrel_switcher1_args, ...
{xlsub2_Convert1_out1, xlsub2_reorder_out1, xlsub2_reorder_out3, xlsub2_reorder1_out3}, ...
{xlsub2_sync_out, xlsub2_pol1, xlsub2_pol2});
% block: temp_biplex_cplx_unscrambler/biplex_cplx_unscrambler/barrel_switcher
xlsub2_barrel_switcher_out1 = xSignal;
xlsub2_barrel_switcher_out2 = xSignal;
xlsub2_barrel_switcher_out3 = xSignal;
xlsub2_barrel_switcher_config.source = str2func('barrel_switcher_init_xblock');
xlsub2_barrel_switcher_config.name = 'barrel_switcher';
xlsub2_barrel_switcher_config.depend = {'barrel_switcher_init_xblock'};
xlsub2_barrel_switcher_args = {1};
xlsub2_barrel_switcher_sub = xBlock(xlsub2_barrel_switcher_config, ...
xlsub2_barrel_switcher_args, ...
{xlsub2_Convert_out1, xlsub2_sync, xlsub2_even, xlsub2_odd}, ...
{xlsub2_barrel_switcher_out1, xlsub2_barrel_switcher_out2, xlsub2_barrel_switcher_out3});
% block: temp_biplex_cplx_unscrambler/biplex_cplx_unscrambler/reorder
xlsub2_reorder_config.source = str2func('reorder_init_xblock');
xlsub2_reorder_config.name = 'reorder';
xlsub2_reorder_config.depend = {'reorder_init_xblock','delay_bram_en_plus_init_xblock','dbl_buffer_init_xblock','sync_delay_en_init_xblock'};
xlsub2_reorder_args = {'map',[map,map+2^(FFTSize-1)], ... % {[map,map+2^(FFTSize-1)], 1, 2, 0, 0, 'off'}, ...
'bram_latency',bram_latency};
xlsub2_reorder_sub = xBlock(xlsub2_reorder_config, ...
[{gcb},xlsub2_reorder_args],...
{xlsub2_barrel_switcher_out1, xlsub2_Constant_out1, xlsub2_barrel_switcher_out2}, ...
{xlsub2_reorder_out1, [], xlsub2_reorder_out3});
% block: temp_biplex_cplx_unscrambler/biplex_cplx_unscrambler/reorder1
xlsub2_reorder1_config.source = str2func('reorder_init_xblock');
xlsub2_reorder1_config.name = 'reorder1';
xlsub2_reorder1_config.depend = {'reorder_init_xblock','delay_bram_en_plus_init_xblock','dbl_buffer_init_xblock','sync_delay_en_init_xblock'};
xlsub2_reorder1_args = {'map',[map+2^(FFTSize-1),map], ... % notice the map for two reroder blocks are different % {[map,map+2^(FFTSize-1)], 1, 2, 0, 0, 'off'}, ...
'bram_latency',bram_latency};
xlsub2_reorder1_sub = xBlock(xlsub2_reorder1_config, ...
[{gcb}, ...
xlsub2_reorder1_args], ...
{xlsub2_barrel_switcher_out1, xlsub2_Constant_out1, xlsub2_barrel_switcher_out3}, ...
{[], [], xlsub2_reorder1_out3});
end