Managing Clock Frequencies - 2022.1 English

Vitis Unified Software Platform Documentation: Application Acceleration Development (UG1393)

Document ID
UG1393
Release Date
2022-05-25
Version
2022.1 English

During the compilation process (v++ -c), you can specify a kernel frequency using the --hls.clock command. This lets you compile the kernel targeting the specified frequency, and lets the Vitis HLS tool perform validation of the kernel logic at the specified frequency. While this is just a target frequency for compilation, it does provide optimization and feedback.

To implement the kernel using a different frequency from the platform default frequency, you can use the --clock Options for platforms with fixed clocks as described in Identifying Platform Clocks. When generating the device binary (.xclbin) you can connect multiple kernels to the platform using different clock frequencies. Each kernel, or unique instance (CU) of the kernel can connect to a specified clock frequency, or multiple clocks, and different kernels can use different clock frequencies.

Tip: For platforms with scalable clocks use the v++ --kernel_frequency option to specify the clock frequency for one or both clocks on the platform, as described in Vitis Compiler General Options.

Therefore the process for managing clock frequencies for kernels is as follows:

  1. Compile the HLS code at a specified frequency using the Vitis compiler:
    v++ -c -k <krnl_name> --hls.clock freqHz:<krnl_name>
    Tip: freqHz must be in Hz (for example, 250000000Hz is 250 MHz).
  2. During linking, specify the clock frequency or clock ID for each clock signal in a kernel with the following command:
    v++ -l ... --clock.freqHz <freqHz>:kernelName.clk_name

You can specify the --clock option using either a clock ID from the platform shell, or by specifying a frequency for the kernel clock. When specifying the clock ID, the kernel frequency is defined by the frequency of that clock ID on the platform. When specifying the kernel frequency, the platform attempts to create the specified frequency by scaling one of the available fixed platform clocks.

In some cases, the clock frequency can only be achieved in some approximation, and you can specify the --clock.tolerance or --clock.default_tolerance to indicate an acceptable range. If the available fixed clock cannot be scaled within the acceptable tolerance, a warning is issued and the kernel is connected to the default clock.