To import a multirate module, you must tell Vitis 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, you must define clock and clock enables as a pair, and they must exist as a pair in the imported module. This is true for both single rate and multirate designs.
Although clock and clock enables must exist as pairs, Model Composer drives all clock ports on your imported module with the FPGA system clock. The FPGA system clock generates clock enable signals that drive the clock enable ports.
SysgenBlockDescriptor provides a method, addClkCEPair, which allows you to define clock and clock
enable information for a black box. This method accepts three parameters. 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
clk - The clock enable must contain the substring
ce - The strings containing the substrings
clkandcemust be the same (for example,my_clk_1andmy_ce_1).
The third parameter defines the rate relationship between the clock and the clock enable port. The rate parameter is not 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 example, assume you have a clock enable port named ce_3 that requires a period three times larger than the
system clock period. The following function call establishes this clock enable port:
addClkCEPair('clk_3','ce_3',3);
When Model Composer compiles a black box into hardware, it produces the appropriate clock enable signals for your module, and automatically wires them up to the appropriate clock enable ports.