Description
The RESET pragma or directive adds or disables reset ports for specific state variables (global or static).
The reset port is used to restore the registers and block RAM,
connected to the port, to an initial value any time the reset signal is applied.
Globally, the presence and behavior of the RTL reset port is controlled using the
syn.rtl.reset
configuration settings. The
reset configuration settings include the ability to define the polarity of the
reset, and specify whether the reset is synchronous or asynchronous, but more
importantly it controls, through the reset option, 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).
More specific control over reset is provided through the RESET pragma.
For global or static variables the RESET pragma is used to explicitly enable a reset
when none is present, or the variable can be removed 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]
) at which the variable is defined. -
variable=<a>
- Specifies the variable to which the RESET pragma is applied.
-
off
oroff=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. A variable declared in a class must be a public static variable in the class and can have the RESET pragma specified for the variable in a method of the class, or after an object of the class has been created 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
shown above would be as follows:
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