Description
The RESET pragma or directive adds or disables reset ports for specific state variables (global or static).
Use the reset port to restore the registers and block RAM connecting
to the port to an initial value. Do this anytime when you apply a reset signal.
Globally, the syn.rtl.reset configuration settings
configure the presence and behavior of the RTL reset port. The reset configuration
settings include the ability to define the polarity of the reset, and specify
whether the reset is synchronous or asynchronous. More importantly, the reset
configuration settings controls which registers are reset when the reset signal is
applied. For more information, see Controlling Initialization and Reset Behaviour in
Vitis High-Level Synthesis User Guide (UG1399).
The RESET pragma provides more specific control over reset. For global
or static variables, the RESET pragma explicitly enables a reset when none is
present. You can also remove the variable from the reset by turning off the pragma. This can be particularly useful when
static or global arrays are present in the design.
Syntax
Place the pragma in the C source within the boundaries of the variable life cycle.
syn.directive.reset=<location> [ variable=<a> | off=true ]
Where:
-
location> - Specifies the location (in the format
function[/label]) where you define the variable. -
variable=<a> - Specifies the variable to which you apply the RESET pragma.
-
offoroff=true - Indicates that reset is not generated for the specified variable.
Examples
Adds reset to variable a in function
foo even when the global reset (syn.rtl.reset) setting is none or control.
syn.directive.reset=foo a
Removes reset from variable static int
a in function foo even when the global
reset setting is state or all.
syn.directive.reset=off foo a
The following example shows the use of the RESET pragma or directive with class variables and methods. When you declare a variable in a class, it must be a public static variable in the class. You can create the RESET pragma for the variable in a method of the class. You can also create the RESET pragma after creating an object in the top function or sub-function of the HLS design.
class bar {
public:
static int a; // class level static; must be public
int a1; // class-level non-static; must be public
bar(...) {
// #pragma reset does not work here for a or a1
}
// this is the function that is called in the top
void run(...) {
// #pragma reset does not work here for non-static variable a1
// but does work for static variable a
#pragma reset variable=a
}
};
static int c; // file level
int d; // file level
void top(...) {
#pragma HLS top
static int b; // function level
bar t;
static bar s;
// #pragma reset works here for b, c and d, as well as t and s members
// except for t.a1 because it is not static
#pragma reset variable=b
#pragma reset variable=c
#pragma reset variable=d
#pragma reset variable=t.a
#pragma reset variable=s.a
#pragma reset variable=s.a1
t.run(...);
s.run(...);
}
syn.directive.reset command specified for the function top.syn.directive.reset=top variable=b
syn.directive.reset=top variable=c
syn.directive.reset=top variable=d
syn.directive.reset=top variable=t.a
syn.directive.reset=top variable=s.a
syn.directive.reset=top variable=s.a1