xlgetparam and xlsetparam - 2022.1 English

Vitis Model Composer User Guide (UG1483)

Document ID
UG1483
Release Date
2022-05-26
Version
2022.1 English

Used to get and set parameter values in the System Generator token. Both functions are similar to the Simulink get_param and set_param commands and should be used for the System Generator token instead of the Simulink functions.

Syntax

[value1, value2, ...] = xlgetparam(sysgenblock, param1, param2, ...)

xlsetparam(sysgenblock, param1, value1, param2, value2, ...)

Description

The System Generator token differs from other blocks in one significant manner; multiple sets of parameters are stored for an instance of a System Generator token. The different sets of parameters stored correspond to different compilation targets available to the System Generator token. The 'compilation' parameter is the switch used to toggle between different compilation targets stored in the System Generator token. In order to get or set parameters associated with a particular compilation type, it is necessary to first use xlsetparam to change the 'compilation' parameter to the correct compilation target, before getting or setting further values.

[value1, value2, ...] = xlgetparam(sysgenblock, param1, param2, ...)

The first input argument of xlgetparam should be a handle to the System Generator token block. Subsequent arguments are taken as names of parameters. The output returned is an array that matched the number of input parameters. If a requested parameter does not exist, the returned value of xlgetparam is empty. The xlgetparams function can be used to get all the parameters for the current compilation target.

xlsetparam(sysgenblock, param1, value1, param2, value2, ...)

The xlsetparam function also takes a handle to a System Generator token as the first argument. Subsequent arguments must be provided in pairs, the first should be the parameter name and the second the parameter value.

Specifying the Compilation Parameter

The 'compilation' parameter on the System Generator token captures the compilation type chosen; for example 'HDL Netlist' or 'IP Catalog'. As previously stated, when a compilation type is changed, the System Generator token will remember all the options chosen for that particular compilation type. For example, when 'HDL Netlist' is chosen, the corresponding target directory could be set to 'hdl_dir', but when 'IP Catalog' is chosen, the target directory could point to a different location, for example 'ip_cat_dir'. Changing the compilation type causes the System Generator token to recall previous options made for that compilation type. If the compilation type is selected for the first time, default values are use to populate the rest of the options on the System Generator token.

When using xlsetparam to set the compilation type of a System Generator token, be aware of the above behaviour, since the order in which parameters are set is important; be careful to first set a block's 'compilation' type before setting any other parameters.

When xlsetparam is used to set the 'compilation' parameter, it must be the only parameter that is being set on that command. For example. the form below is not permitted:

xlsetparam(sysgenblock,'compilation','HDL Netlist', 'synthesis_tool', 'Vivado synthesis')

Examples

Example 1: Changing the synthesis tool used for HDL netlist.

xlsetparam(sysgenblock, 'compilation', 'HDL Netlist'); 
xlsetparam(sysgenblock, 'synthesis_tool', 'Vivado synthesis')

The first xlsetparam is used to set the compilation target to 'HDL Netlist'. The second xlsetparam is used to change the synthesis tool used to 'Vivado synthesis'.

Example 2: Getting family and part information.

[fam,part]=xlgetparam(sysgenblock,'xilinxfamily','part') 
fam = 
Virtex2 
part = 
xc2v1000