-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblock_prototypes.m
More file actions
executable file
·152 lines (118 loc) · 5.93 KB
/
block_prototypes.m
File metadata and controls
executable file
·152 lines (118 loc) · 5.93 KB
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
% Monroe_Library: mask script
% Author: Ryan Monroe
% Copyright 2007, 2005, by the California Institute of Technology.
% ALL RIGHTS RESERVED. United States Government Sponsorship
% acknowledged. Any commercial use must be negotiated with the Office
% of Technology Transfer at the California Institute of Technology.
% This software may be subject to U.S. export control laws. By
% accepting this software, the user agrees to comply with all
% applicable U.S. export laws and regulations. User has the
% responsibility to obtain export licenses, or other export authority
% as may be required before exporting such information to foreign
% countries or providing access to foreign persons.
%%%%%%%%%%%%%%--XILINX GENERIC BLOCKS--%%%%%%%%%%%%%%%%%%
%constant (boolean)
bConstantBool = xBlock(struct('source', 'Constant', 'name', 'constant_bool'), ...
struct('arith_type', 'Boolean', 'const', 0, 'explicit_period', 'on'), ...
{}, {sOut});
bConstantUnsigned = xBlock(struct('source', 'Constant', 'name', 'constant_unsigned'), ...
struct('const', 0, 'n_bits', bit_width, ...
'bin_pt', bit_width-1, 'explicit_period', 'on'), ...
{}, {sOut});
%Concat
bConcat = xBlock(struct('source', 'Concat', 'name', 'concat'), ...
struct('num_inputs', numInputs), ...
sInArr, {sConcatOut});
%Reinterpret
bReinterpret = xBlock(struct('source','Reinterpret', 'name', 'reinterpret'), ...
struct('force_arith_type', 'on', 'arith_type', 'Unsigned', ...
'force_bin_pt', 'on', 'bin_pt', 0), ...
{sIn}, {sOut});
%Slice
bSlice = xBlock(struct('source', 'Slice', 'name', 'sliceUpper'), struct( ...
'nbits', 1, 'boolean_output','off', 'mode', 'Upper Bit Location + Width', ...
'base1', 'MSB of Input', 'base0', 'MSB of Input', 'bit1', 0), ...
{sIn}, {sOut});
%Convert
bConvert = xBlock(struct('source', 'Convert', 'name', 'Convert'), ...
struct('n_bits', nBits, 'bin_pt', nBits-1), ...
{sIn}, {sOut});
%counter (up)
bCountUp = xBlock(struct('source','Counter', 'name', 'Counter_up'), ...
struct('cnt_type', 'Free Running', 'operation', 'Up', 'start_count',...
0, 'cnt_by_val', 1, 'arith_type', 'Unsigned', 'n_bits', FFTSize, 'bin_pt', 0, 'load_pin', 'off',...
'rst', 'on', 'en', 'off', 'period', 1, 'explicit_period', 'on', 'implementation', 'Fabric'), ...
{sReset}, {sCountOut});
%Multiplexer
bMux = xBlock(struct('source', 'Mux', 'name', 'Mux'), struct( ...
'arith_type', 'Signed (2''s comp)', 'n_bits', 8, 'bin_pt', 2), ...
{sSel, sDin0, sDin1}, {sOut});
%scale
xlsub2_Scale = xBlock(struct('source', 'Scale', 'name', 'Scale'), ...
struct('scale_factor', -1*shift), ...
{sIn}, {sOut});
%%%%begin dual port RAM%%%%
xlsub2_Dual_Port_RAM4 = xBlock(struct('source', 'Dual Port RAM', 'name', 'Dual Port RAM4'), ...
struct('depth', length(coeff), 'initVector', coeff, 'latency', 2, ...
'distributed_mem', memory_type, 'write_mode_A', 'No Read On Write', ...
'write_mode_B', 'No Read On Write'));
if(strcmp(memory_type,'Block RAM'))
bDualPortRam.bindPort({sAddrA, sDinA, sWriteEnableA, sAddrB, sDinB, sWriteEnableB}, ...
{sDoutA, sDoutB});
else
bDualPortRam.bindPort({sAddrA, sDinA, sWriteEnableA, sAddrB}, ...
{sDoutA, sDoutB});
end
%%%%end dual port ram%%%%
%%%%%%%%%%%%%%--Monroe_Library blocks--%%%%%%%%%
%sync_delay_fast
bSyncDelay = xBlock(struct('source', 'monroe_library/sync_delay_fast', 'name', 'sync_delay_fast'), ...
struct('delay_len', delay_len), ...
{sIn}, {sOut});
%coeff_gen_dual
bCoeffGenDual = xBlock(struct('source', str2func('coeff_gen_dual_draw'), ...
'name',strcat('coeff_gen',num2str(stageNum))), ...
{coeff, memory_type, bit_width, step_rate, register_coeffs}, ...
{sSyncIn}, {sCoeffOut});
%cram
bCram = xBlock(struct('source', str2func('cram_draw'), 'name', 'cram'), ...
{nInputs}, ...
sInArr , {oCram});
bUnCram= xBlock(struct('source', str2func('uncram_draw'), 'name', 'uncram'), ...
{numSignals, bitWidth, binPt, signalType},{sUncramIn},sOutputArr);
%%%%%%%%%%%%%%--BUTTERFLIES--%%%%%%%%%%%%%%%%%%
%Twiddle_stage1
bTwiddleStg1 = xBlock(struct('source', 'monroe_library/twiddle_stage1', ...
'name', 'twiddle_stage1'), ...
struct('input_bit_width',input_bit_width, ...
'out_n_bits', output_bit_width, 'downshift_at_end', shift), ...
{a_in, b_in, sync_in}, ...
{apbw_out, ambw_out, sync_out});
%Twiddle_stage2
bTwiddleStg2 = xBlock(struct('source', 'monroe_library/twiddle_stage2', 'name', 'twiddle_stage2'), ...
struct('FFTSize', FFTSize, 'input_bit_width',input_bit_width, 'out_n_bits', ...
output_bit_width, 'downshift_at_end', shift), ...
{a_in, b_in, sTwiddleSel, sync_in}, ...
{apbw_out, ambw_out, sync_out});
%Twiddle_cheap
bTwiddleCheap = xBlock(struct('source', 'monroe_library/twiddle_cheap', 'name', 'twiddle_cheap'), ...
struct('a_n_bits',input_bit_width, 'a_bin_pt', input_bit_width-1, ...
'b_n_bits', input_bit_width, 'b_bin_pt', input_bit_width-1, ...
'w_n_bits', coeff_bit_width, 'w_bin_pt', coeff_bit_width-1, 'a_delay', ...
0, 'apbw_delay', 0, 'out_n_bits', output_bit_width, 'downshift_at_end', shift), ...
{a_in, b_in, coeff_in, sync_in}, ...
{apbw_out, ambw_out, sync_out});
%%%%%%%%%%%%%--DELAYS--%%%%%%%%%%%%%%%%
%single_delay_bram_fast
xlsub2_ddbf = xBlock(struct('source', 'monroe_library/delay_bram_fast', ...
'name', 'delay_bram_fast'), ...
struct('delay_len', delay_len, 'bram_latency', bram_latency), ...
{sIn}, {sOut});
%double_delay_bram_fast
xlsub2_ddbf = xBlock(struct('source', 'monroe_library/double_delay_bram_fast', ...
'name', 'double_delay_bram_fast'), ...
struct('delay_len', long_delay_len, 'bram_latency', bram_latency), ...
{sInA, sInB}, {sOutA, sOutB});
bBulkDelay = xBlock(struct('source',str2func('bulk_delay_draw'), ...
'name', 'bulk_delay'), ...
{numInputs,delayArr}, sInArr, sOutArr);