MatchLib
Macros

Macros for synthesizable and non-synthesizable assertions. More...

Macros

#define NVHLS_ASSERT(X)   __NVHLS_ASSERT_SC(X)
 
#define CMOD_ASSERT(X)   __NVHLS_ASSERT(X)
 
#define NVHLS_ASSERT_MSG(X, MSG)   __NVHLS_ASSERT_SC(X && MSG)
 
#define CMOD_ASSERT_MSG(X, MSG)
 

Detailed Description

Macros for synthesizable and non-synthesizable assertions.

Macro Definition Documentation

◆ NVHLS_ASSERT

#define NVHLS_ASSERT (   X)    __NVHLS_ASSERT_SC(X)

Synthesizable assertion to check x. It will be synthesized by Catapult HLS tool to either psl or ovl assertions in RTL depending on HLS tool settings. If HLS_CATAPULT flag is not set, then assertions are enabled only in SystemC/C++ simulation and not synthesized to RTL.

A Simple Example
#include <nvhls_assert.h>
...
while(1) {
if (in.PopNB(in_var)) {
NVHLS_ASSERT(in_var!=0); // Assert that input is never 0
...
}
}
#define NVHLS_ASSERT(X)
Definition: nvhls_assert.h:71

Definition at line 71 of file nvhls_assert.h.

◆ CMOD_ASSERT

#define CMOD_ASSERT (   X)    __NVHLS_ASSERT(X)

Non-synthesizable assertion to check x. It will be checked only in C++ simulation and not synthesized by HLS tool.

A Simple Example
#include <nvhls_assert.h>
...
while(1) {
if (in.PopNB(in_var)) {
CMOD_ASSERT(in_var!=0); // Assert that input is never 0
...
}
}
#define CMOD_ASSERT(X)
Definition: nvhls_assert.h:102

Definition at line 102 of file nvhls_assert.h.

◆ NVHLS_ASSERT_MSG

#define NVHLS_ASSERT_MSG (   X,
  MSG 
)    __NVHLS_ASSERT_SC(X && MSG)

Synthesizable assertion to check x and print msg if assertion fails. It will be synthesized by Catapult HLS tool to either psl or ovl assertions in RTL depending on HLS tool settings. If HLS_CATAPULT flag is not set, then assertions are enabled only in SystemC/C++ simulation and not synthesized to RTL.

A Simple Example
#include <nvhls_assert.h>
...
while(1) {
if (in.PopNB(in_var)) {
NVHLS_ASSERT_MSG(in_var!=0, "Input is Zero"); // Assert that input is never 0
...
}
}
#define NVHLS_ASSERT_MSG(X, MSG)
Definition: nvhls_assert.h:135

Definition at line 135 of file nvhls_assert.h.

◆ CMOD_ASSERT_MSG

#define CMOD_ASSERT_MSG (   X,
  MSG 
)
Value:
if (!(X)) { \
DCOUT("Error: Assertion failed. " << MSG << endl); \
} \
__NVHLS_ASSERT(X)

Non-synthesizable assertion to check x and print msg if assertion fails. It will be checked only in C++ simulation and not synthesized by HLS tool.

A Simple Example
#include <nvhls_assert.h>
...
while(1) {
if (in.PopNB(in_var)) {
CMOD_ASSERT_MSG(in_var!=0, "Input is Zero"); // Assert that input is never 0
...
}
}
#define CMOD_ASSERT_MSG(X, MSG)
Definition: nvhls_assert.h:166

Definition at line 166 of file nvhls_assert.h.