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
|
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
|
-
+
-
+
|
if length(known)<2 # Invalid
known = " ";
endif
if length(Name)>0
cbg = mtt_cbg(Name); # Structure for this subsystem
if struct_contains (cbg, "ports")
if isfield (cbg, "ports")
## Combine ports with the other subsystems
for [component_structure, component] = cbg.ports
eval(sprintf("cbg.subsystems.%s=cbg.ports.%s;",component,component));
endfor
endif
endif
if length(name)>0 # Alias
##Alias arguments
eval(sprintf("ARG=cbg.subsystems.%s.arg;", name)); # Arguments
ARG = mtt_alias (Name,ARG,arg_default); # Alias them
eval(sprintf("cbg.subsystems.%s.arg=ARG;", name)); # and copy
## Alias CRs
eval(sprintf("CR=cbg.subsystems.%s.cr;", name)); # CRs
CR = mtt_alias (Name,CR,cr_default); # Alias them
eval(sprintf("cbg.subsystems.%s.cr=CR;", name)); # and copy
else # Call to a subsystem (represented by name="")
if !struct_contains(cbg,"portlist")
if !isfield(cbg,"portlist")
N_ports = 0;
else
[N_ports,M_ports] = size(cbg.portlist);
endif
if port>N_ports
error(sprintf("port (%i) > N_ports (%i)", port, N_ports));
|
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
-
-
+
+
|
outsig
insigs
innames
endif
## Is the signal the output of a port?
is_port_output = 0; # Default
if struct_contains (cbg, "ports")
if struct_contains (cbg.ports,name)
if isfield (cbg, "ports")
if isfield (cbg.ports,name)
is_port_output = (outsig(2)!=insigs(1,2));
endif
endif
if is_port_output
## Which port (number) is it?
[N_ports,M_ports] = size(cbg.portlist);
|