MatchLib
Macros

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

Macros

#define NVHLS_ASSERT(X)   CTC_SKIP_ASSERT sc_assert(X); CTC_ENDSKIP_ASSERT
 
#define CMOD_ASSERT(x)   CTC_SKIP_ASSERT assert(x); CTC_ENDSKIP_ASSERT
 
#define NVHLS_ASSERT_MSG(X, MSG)   CTC_SKIP_ASSERT sc_assert(X && MSG); CTC_ENDSKIP_ASSERT
 
#define CMOD_ASSERT_MSG(X, MSG)
 

Detailed Description

Macros for synthesizable and non-synthesizable assertions.

Macro Definition Documentation

#define NVHLS_ASSERT (   X)    CTC_SKIP_ASSERT sc_assert(X); CTC_ENDSKIP_ASSERT

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
1 #include <nvhls_assert.h>
2 
3 ...
4 while(1) {
5  if (in.PopNB(in_var)) {
6  NVHLS_ASSERT(in_var!=0); // Assert that input is never 0
7  ...
8  }
9 }

Definition at line 58 of file nvhls_assert.h.

#define CMOD_ASSERT (   x)    CTC_SKIP_ASSERT assert(x); CTC_ENDSKIP_ASSERT

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

A Simple Example
1 #include <nvhls_assert.h>
2 
3 ...
4 while(1) {
5  if (in.PopNB(in_var)) {
6  CMOD_ASSERT(in_var!=0); // Assert that input is never 0
7  ...
8  }
9 }

Definition at line 85 of file nvhls_assert.h.

#define NVHLS_ASSERT_MSG (   X,
  MSG 
)    CTC_SKIP_ASSERT sc_assert(X && MSG); CTC_ENDSKIP_ASSERT

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
1 #include <nvhls_assert.h>
2 
3 ...
4 while(1) {
5  if (in.PopNB(in_var)) {
6  NVHLS_ASSERT_MSG(in_var!=0, "Input is Zero"); // Assert that input is never 0
7  ...
8  }
9 }

Definition at line 116 of file nvhls_assert.h.

#define CMOD_ASSERT_MSG (   X,
  MSG 
)
Value:
if (!(X)) { \
DCOUT("Assertion Failed. " << MSG << endl); \
} \
CTC_SKIP_ASSERT assert(X); CTC_ENDSKIP_ASSERT
#define DCOUT(x)
Definition: hls_globals.h:72

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
1 #include <nvhls_assert.h>
2 
3 ...
4 while(1) {
5  if (in.PopNB(in_var)) {
6  CMOD_ASSERT_MSG(in_var!=0, "Input is Zero"); // Assert that input is never 0
7  ...
8  }
9 }

Definition at line 144 of file nvhls_assert.h.