| |||
| Home > Components > Resources section > Parameters | |||
Parameters allow component configuration and parameterization at initialization time or run time of the system model.
Table 2.4 lists
the parameters that can be given to the PARAMETER keyword.
Array syntax is not supported for parameters.
Table 2.4. PARAMETER parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
default | int or string | 0 or "" | Default value is 0 for integers and the empty string for string parameters. |
description | string | "" | Plain text single line description of the parameter. The debugger might display this string next to the parameter to provide additional information about a parameter to the user. |
max | int | 0x7FFFFFFFFFFFFFFF | Maximum admissible value. |
min | int | 0x8000000000000000 | Minimum admissible value. NoteThe minimum value (and therefore the maximum range) for a parameter depends on whether it is signed or unsigned. The maximum ranges are:
|
name | string | "" | A text tag for the parameter that is displayed
in the GUI. Any printable symbol except for # . and = can be used
in name. Double quote characters within the tag
must be escaped with \. If no name is specified,
the parameter identifier is used. |
type | int, bool, or string | int | Data type. NoteThe type can also be |
read_function | string | none | Name of the read access behavior. |
write_function | string | none | Name of the write access behavior. |
runtime | boolean | false | Switch between instantiation-time and run-time parameters. Instantiation-time parameters are set by the user before the system is instantiated and cannot be changed afterwards. This is the default. Run-time parameters can be changed during runtime. |
The access functions have similar semantics as for registers. The access function prototypes are as follows:
integer and bool parameters:
behavior my_read(uint32_t id, int64_t *data) : AccessFuncResult
behavior my_write(uint32_t id, const int64_t *data) : AccessFuncResult
string parameters:
behavior my_read(uint32_t id, string &data) : AccessFuncResult
behavior my_write(uint32_t id, const string &data) : AccessFuncResult
For each parameter with name ,
a constant namePARAMETER_ID_ is
generated. This is passed as nameid when the PARAMETER is
read from or written to.
The default behavior for the read_function is
to return the current value of the PARAMETER.
The default behavior for the write_function is
to set the value of the PARAMETER. If a write_function is
specified, the parameter is no longer updated automatically. This
update must be done in the write function.
Example 2.13 shows an
example of using PARAMETER in a resources section.
Example 2.13. PARAMETER resource
resources
{
PARAMETER { min(0), max(0xFFFF), default(0x80), name(”Base Address”)}
baseAddress;
}
The parameter in the example would default to being called baseAddress if
a name tag was not declared. When choosing parameter
names or tags, you are strongly advised to adhere to the naming
rules for C++ identifiers. This means you can use upper and lower case
letters, numbers, and underscore characters. Avoid using hyphens,
"-" in parameter names or tags. If you are supporting legacy code
that uses hyphens in parameter names, you can use these old names
within the name tag. However, the parameter name
outside the braces must conform to C++ naming rules, and is what
you must use in your LISA+ code.
Parameters that are integers and are entered in decimal format can have the multiplier suffixes listed in Table 2.5.
Table 2.5. Multiplier suffixes for integer properties and parameters
| Suffix | Description | Multiplier |
|---|---|---|
| K | Kilo | 210 |
| M | Mega | 220 |
| G | Giga | 230 |
| T | Tera | 240 |
| P | Peta | 250 |