-
Notifications
You must be signed in to change notification settings - Fork 2
/
sb_vacc_core_config.m
120 lines (93 loc) · 3.75 KB
/
sb_vacc_core_config.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
function sb_vacc_core_config(this_block)
% Revision History:
%
% 11-Nov-2013 (17:03 hours):
% Original code was machine generated by Xilinx's System Generator after parsing
% /media/data/jack/ami/ami_correlator/sb_vacc_core.vhd
%
%
this_block.setTopLevelLanguage('VHDL');
this_block.setEntityName('sb_vacc_core');
% System Generator has to assume that your entity has a combinational feed through;
% if it doesn't, then comment out the following line:
this_block.tagAsCombinational;
this_block.addSimulinkInport('sync_in');
this_block.addSimulinkInport('din00');
this_block.addSimulinkInport('din01');
this_block.addSimulinkInport('din11');
this_block.addSimulinkOutport('dout00');
this_block.addSimulinkOutport('dout01');
this_block.addSimulinkOutport('dout11');
this_block.addSimulinkOutport('vld');
dout00_port = this_block.port('dout00');
dout00_port.setType('UFix_12_0');
dout01_port = this_block.port('dout01');
dout01_port.setType('UFix_12_0');
dout11_port = this_block.port('dout11');
dout11_port.setType('UFix_12_0');
vld_port = this_block.port('vld');
vld_port.setType('UFix_1_0');
vld_port.useHDLVector(false);
% -----------------------------
if (this_block.inputTypesKnown)
% do input type checking, dynamic output type and generic setup in this code block.
if (this_block.port('din00').width ~= 144);
this_block.setError('Input data type for port "din00" must have width=144.');
end
if (this_block.port('din01').width ~= 144);
this_block.setError('Input data type for port "din01" must have width=144.');
end
if (this_block.port('din11').width ~= 144);
this_block.setError('Input data type for port "din11" must have width=144.');
end
if (this_block.port('sync_in').width ~= 1);
this_block.setError('Input data type for port "sync_in" must have width=1.');
end
this_block.port('sync_in').useHDLVector(false);
end % if(inputTypesKnown)
% -----------------------------
% -----------------------------
if (this_block.inputRatesKnown)
setup_as_single_rate(this_block,'clk_1','ce_1')
end % if(inputRatesKnown)
% -----------------------------
% (!) Set the inout port rate to be the same as the first input
% rate. Change the following code if this is untrue.
uniqueInputRates = unique(this_block.getInputRates);
% Add addtional source files as needed.
% |-------------
% | Add files in the order in which they should be compiled.
% | If two files "a.vhd" and "b.vhd" contain the entities
% | entity_a and entity_b, and entity_a contains a
% | component of type entity_b, the correct sequence of
% | addFile() calls would be:
% | this_block.addFile('b.vhd');
% | this_block.addFile('a.vhd');
% |-------------
% this_block.addFile('');
% this_block.addFile('');
this_block.addFile('sb_vacc_core.vhd');
return;
% ------------------------------------------------------------
function setup_as_single_rate(block,clkname,cename)
inputRates = block.inputRates;
uniqueInputRates = unique(inputRates);
if (length(uniqueInputRates)==1 & uniqueInputRates(1)==Inf)
block.addError('The inputs to this block cannot all be constant.');
return;
end
if (uniqueInputRates(end) == Inf)
hasConstantInput = true;
uniqueInputRates = uniqueInputRates(1:end-1);
end
if (length(uniqueInputRates) ~= 1)
block.addError('The inputs to this block must run at a single rate.');
return;
end
theInputRate = uniqueInputRates(1);
for i = 1:block.numSimulinkOutports
block.outport(i).setRate(theInputRate);
end
block.addClkCEPair(clkname,cename,theInputRate);
return;
% ------------------------------------------------------------