| |||
| Home > Components > Composition section > Overriding component parameter attributes | |||
Parameters of subcomponents that are set in the composition section of their parent component can not be set or configured in the debugger or run-time environment. They are hard coded in the system.
All other parameters can be configured in the debugger or when starting the run-time environment.
In Fast Models 4.1.20 or later however, you can override the default value
for a parameter and, for integer parameters, the min and max values.
Overriding is done in the component instantiation statement in the form of assignments and must use the following syntax:
parameter_name.attribute_name=attribute_value
If done, the override assignments must be included in the normal parameter assignments in an instantiation statement as shown in Example 2.15
Example 2.15. Parameter overriding
component CPU
{
resources
{
PARAMETER { default(0x8a0000) } itcm_size;
PARAMETER { default(0xda0000), min(0x450000), max(0xff0000) } dtcm_size;
}
}
component Board
{
composition
{
cpu : CPU(itcm_size=0x440000, dtcm_size.default=0xaa0000, dtcm_size.min=0x600000);
}
}
The code in Example 2.15 overrides
the default value of dtcm_size and its min boundary. This
means that the parameter is published and the user can set it, but:
the user cannot specify
a value less than 0x60000
the parameter is initialized with 0xaa0000 if
the user does not specify anything.
For min and max attributes
of integer parameters, the global rule also applies to the overridden
variants. If the value specified during system instantiation is
not within the [ range,
it is truncated to fit.min, max]
If a component overrides the min or max attribute
of a parameter in a subcomponent, the new value can only restrict
the [ range:min, max]
min can
only be overridden with a greater value
max can only be overridden with
a smaller value.
If an integer parameter forwards another, whose [ range
is not identical, then the resulting range is the intersection of
the restrictions:min, max]
If this intersection is not identical to that of the forwarder, a warning is issued.
If the intersection is void, an error is issued.
For Example 2.16, the
LISA+ parser warns that the range of parameter b_dtcm_size is being
restricted to [0x450000, 0xef0000].
Example 2.16. Range restriction warning
component CPU
{
resources
{
PARAMETER { default(0x8a0000) } itcm_size;
PARAMETER { default(0xda0000), min(0x450000), max(0xff0000) } dtcm_size;
}
}
component Board
{
resources
{
PARAMETER { default(0xda0000), min(0x350000), max(0xef0000) } b_dtcm_size;
}
composition
{
// b_dtcm_size is the forwarder
cpu : CPU(dtcm_size=b_dtcm_size);
}
}
As is the case with parameter fixing and forwarding, an override
assignment must use the attribute
of the parameter on the left-hand side, if specified. If the name
is not a valid C identifier, it must be enclosed in double quotes.
For example:name
cpu : CPU("semihosting-enable".default=true);