cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
RLB_TEST

Testbench for the Ready Logic Barrier (RLB) for the Network Transport Stack (NTS). More...

Collaboration diagram for RLB_TEST:

Macros

#define THIS_NAME   "TB"
 
#define TRACE_OFF   0x0000
 
#define TRACE_CGRF   1 << 1
 
#define TRACE_CGTF   1 << 2
 
#define TRACE_DUMTF   1 << 3
 
#define TRACE_ALL   0xFFFF
 
#define DEBUG_LEVEL   (TRACE_OFF)
 
#define TB_MAX_SIM_CYCLES   100
 
#define TB_STARTUP_DELAY   0
 
#define TB_GRACE_TIME   0
 

Functions

void stepSim ()
 Increment the simulation counter. More...
 
int main (int argc, char *argv[])
 Main function. More...
 

Variables

bool gTraceEvent = false
 
bool gFatalError = false
 
unsigned int gSimCycCnt = 0
 
unsigned int gMaxSimCycles = 0 + 100
 

Detailed Description

Testbench for the Ready Logic Barrier (RLB) for the Network Transport Stack (NTS).

Macro Definition Documentation

◆ DEBUG_LEVEL

#define DEBUG_LEVEL   (TRACE_OFF)

Definition at line 46 of file test_rlb.cpp.

◆ TB_GRACE_TIME

#define TB_GRACE_TIME   0

Definition at line 40 of file test_rlb.hpp.

◆ TB_MAX_SIM_CYCLES

#define TB_MAX_SIM_CYCLES   100

Definition at line 38 of file test_rlb.hpp.

◆ TB_STARTUP_DELAY

#define TB_STARTUP_DELAY   0

Definition at line 39 of file test_rlb.hpp.

◆ THIS_NAME

#define THIS_NAME   "TB"

Definition at line 39 of file test_rlb.cpp.

◆ TRACE_ALL

#define TRACE_ALL   0xFFFF

Definition at line 45 of file test_rlb.cpp.

◆ TRACE_CGRF

#define TRACE_CGRF   1 << 1

Definition at line 42 of file test_rlb.cpp.

◆ TRACE_CGTF

#define TRACE_CGTF   1 << 2

Definition at line 43 of file test_rlb.cpp.

◆ TRACE_DUMTF

#define TRACE_DUMTF   1 << 3

Definition at line 44 of file test_rlb.cpp.

◆ TRACE_OFF

#define TRACE_OFF   0x0000

Definition at line 41 of file test_rlb.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Main function.

Definition at line 66 of file test_rlb.cpp.

66  {
67 
68  gSimCycCnt = 0;
69 
70  //------------------------------------------------------
71  //-- TESTBENCH LOCAL VARIABLES
72  //------------------------------------------------------
73  int nrErr = 0; // Tb error counter.
74 
75  //------------------------------------------------------
76  //-- DUT SIGNAL INTERFACES and RELATED VARIABLEs
77  //------------------------------------------------------
78  StsBit sRLB_MMIO_Ready;
79 
80  //------------------------------------------------------
81  //-- DUT STREAM INTERFACES and RELATED VARIABLEs
82  //------------------------------------------------------
83  stream<StsBool> ssTOE_RLB_Data ("ssTOE_RLB_Data");
84  stream<StsBool> ssUOE_RLB_Data ("ssUOE_RLB_Data");
85 
86 
87  printInfo(THIS_NAME, "############################################################################\n");
88  printInfo(THIS_NAME, "## TESTBENCH 'test_rlb' STARTS HERE ##\n");
89  printInfo(THIS_NAME, "############################################################################\n");
90  printf("\n");
91 
92  for (int i=0; i<gMaxSimCycles; i++) {
93  switch(i) {
94  case 1:
95  ssTOE_RLB_Data.write(false);
96  ssUOE_RLB_Data.write(false);
97  break;
98  case 10:
99  if (sRLB_MMIO_Ready != false) {
100  printError(THIS_NAME, "The ready signal is expected inactive (false) but was found to be active (true).\n");
101  nrErr++;
102  }
103  break;
104  case 25:
105  ssTOE_RLB_Data.write(true);
106  break;
107  case 50:
108  ssUOE_RLB_Data.write(true);
109  break;
110  case 75:
111  if (sRLB_MMIO_Ready != true) {
112  printError(THIS_NAME, "The ready signal is expected active (true) but was found to be inactive (false).\n");
113  nrErr++;
114  }
115  break;
116  default:
117  break;
118  }
119  //-- RUN one cycle of the DUT
120  rlb(
121  //-- MMIO Interface
122  &sRLB_MMIO_Ready,
123  //-- UOE / Data Stream Interface
124  ssUOE_RLB_Data,
125  //-- TOE / Data Stream Interface
126  ssTOE_RLB_Data
127  );
128  stepSim();
129  }
130 
131  printInfo(THIS_NAME, "############################################################################\n");
132  printInfo(THIS_NAME, "## TESTBENCH 'test_rlb' ENDS HERE ##\n");
133  printInfo(THIS_NAME, "############################################################################\n");
134  stepSim();
135 
136  if (nrErr) {
137  printError(THIS_NAME, "###########################################################\n");
138  printError(THIS_NAME, "#### TEST BENCH FAILED : TOTAL NUMBER OF ERROR(S) = %2d ####\n", nrErr);
139  printError(THIS_NAME, "###########################################################\n\n");
140 
141  printInfo(THIS_NAME, "FYI - You may want to check for \'ERROR\' and/or \'WARNING\' alarms in the LOG file...\n\n");
142  }
143  else {
144  printInfo(THIS_NAME, "#############################################################\n");
145  printInfo(THIS_NAME, "#### SUCCESSFUL END OF TEST ####\n");
146  printInfo(THIS_NAME, "#############################################################\n");
147  }
148 
149  return nrErr;
150 
151  return 0;
152 }
unsigned int gSimCycCnt
Definition: tb_nal.cpp:150
unsigned int gMaxSimCycles
Definition: test_arp.hpp:69
void stepSim()
Increment the simulation counter.
Definition: test_rlb.cpp:51
#define THIS_NAME
Definition: test_rlb.cpp:39
void rlb(StsBit *poMMIO_Ready, stream< StsBool > &siUOE_Ready, stream< StsBool > &siTOE_Ready)
Main process of the Ready Logic Barrier (RLB).
Definition: rlb.cpp:62
#define printError(callerName, format,...)
A macro to print an error message.
Definition: nts_utils.hpp:195
ap_uint< 1 > StsBit
Definition: nts_types.hpp:116
#define printInfo(callerName, format,...)
A macro to print an information message.
Definition: nts_utils.hpp:169
Here is the call graph for this function:

◆ stepSim()

void stepSim ( )

Increment the simulation counter.

Definition at line 51 of file test_rlb.cpp.

51  {
52  gSimCycCnt++;
53  if (gTraceEvent || ((gSimCycCnt % 1000) == 0)) {
54  printInfo(THIS_NAME, "-- [@%4.4d] -----------------------------\n", gSimCycCnt);
55  gTraceEvent = false;
56  }
57  else if (0) {
58  printInfo(THIS_NAME, "------------------- [@%d] ------------\n", gSimCycCnt);
59  }
60 }
bool gTraceEvent
Definition: tb_nal.cpp:151
Here is the caller graph for this function:

Variable Documentation

◆ gFatalError

bool gFatalError = false

Definition at line 48 of file test_rlb.hpp.

◆ gMaxSimCycles

unsigned int gMaxSimCycles = 0 + 100

Definition at line 50 of file test_rlb.hpp.

◆ gSimCycCnt

unsigned int gSimCycCnt = 0

GLOBAL VARIABLES USED BY THE SIMULATION ENVIRONMENT

Definition at line 49 of file test_rlb.hpp.

◆ gTraceEvent

bool gTraceEvent = false

HELPERS FOR THE DEBUGGING TRACES .e.g: DEBUG_LEVEL = (MDL_TRACE | IPS_TRACE)

Definition at line 47 of file test_rlb.hpp.