syn.directive.reset - 2025.2 English - UG1399

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2025-11-20
Version
2025.2 English

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.

Note: For public variables of a class, you must use the RESET pragma as the reset configuration settings only apply to variables declared at the function or file level. In addition, you must apply the RESET pragma to an object of the class in the top-function or sub-function. You cannot apply it to private variables of the class.

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.
off or off=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(...); 
} 
The following shows the 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