In order to import a synchronous or asynchronous black box module, you must tell Model Composer information about the module's clocking in the configuration M-function. Model Composer treats clock and clock enables differently than other types of ports. A clock port on an imported module must always be accompanied by a clock enable port, and vice versa. In other words, clock and clock enables must be defined as a pair, and exist as a pair in the imported module. This is true for both single synchronous clock and multiple independent clock designs.
SysgenBlockDescriptor provides a method called addClkCEPair that you can use to define clock, clock enable, and its associated clock period by using clock sub-system domain. The clock domain information is not required for synchronous single clock designs.
The first parameter defines the name of the clock port (as it appears in the module). The second parameter defines the name of the clock enable port (also as it appears in the module).
The port names of a clock and clock enable pair must follow the naming conventions provided below:
- The clock port must contain the substring
- The clock enable must contain the substring
- The strings containing the substrings
cemust be the same, such as:
The third parameter defines the rate relationship between the clock and the clock-enable port. The rate parameter should not be thought of as a Simulink® sample rate. Instead, this parameter tells Model Composer the relationship between the clock sample period, and the desired clock enable sample period. The rate parameter is an integer value that defines the ratio between the clock rate and the corresponding clock enable rate.
For multiple independent clock designs, the fourth and fifth optional parameters are mandatory.
The fourth parameter holds a "Boolean" value, and it defines whether clock and
clock enable pair is tied to ground. If you set it to
true, both clock and clock enable
would be tied to ground during simulation. Setting it to false
would activate clock and clock enable rate transitions.
The fifth parameter defines the clock period for the corresponding clock-clock enable pair. The 'clockDomain' property of the black box "SysgenPortDescriptor" must be used to set the clock periods for multiple independent clock designs.
rate_data = this_block.port('<port_name>').rate; clkDomain_data = this_block.port(<port_name>).clockDomain; this_block.addClkCEPair('clk',ce',rate_data, false, clkDomain_data);