3.5.2.5 Force Register

The SmartHLS Scheduler will attempt to find the best approach to schedule the circuit based on the information it has at that time. Usually, this is enough to generate a hardware with good performance. However, sometimes users may want to have explicit control about certain location to insert the register. SmartHLS does provide the flexibility to force a register at specific location.

To do so, you need to include the header file:

#include "hls/utils.hpp"

and call the function hls_reg for the data you want to register as below:

val_reg = hls_reg(val);

This will force SmartHLS to register the value, val, and any operations that depend on val will be scheduled accordingly, taking into the account the 1-cycle latency required to register the value.