39 #define THIS_NAME "TB"
41 #define TRACE_OFF 0x0000
42 #define TRACE_TOE 1 << 1
43 #define TRACE_ALL 0xFFFF
45 #define DEBUG_LEVEL (TRACE_OFF)
76 stream<CamSessionLookupRequest> &soCAM_SssLkpReq,
77 stream<CamSessionLookupReply> &siCAM_SssLkpRep,
78 stream<CamSessionUpdateRequest> &soCAM_SssUpdReq,
79 stream<CamSessionUpdateReply> &siCAM_SssUpdRep)
83 static enum slcStates { LOOKUP_REQ, LOOKUP_REP,
84 INSERT_REQ, INSERT_REP, \
85 DELETE_REQ, DELETE_REP, \
86 TB_ERROR, TB_DONE } slcState = LOOKUP_REQ;
96 if (!soCAM_SssLkpReq.full()) {
103 soCAM_SssLkpReq.write(lkpRequest);
104 printInfo(myName,
"Sending LOOKUP request[%d] to [CAM].\n", i);
107 printWarn(myName,
"Cannot send LOOKUP request to [CAM] because stream is full.\n");
113 slcState = LOOKUP_REP;
118 if (!siCAM_SssLkpRep.empty()) {
120 siCAM_SssLkpRep.read(lkpReply);
122 printInfo(myName,
"Received a lookup reply from [CAM]. \n");
123 printInfo(myName,
"Src=%d, SessId=%d, Hit=%d\n", lkpReply.
source.to_int(),
132 slcState = INSERT_REQ;
137 if (!soCAM_SssUpdReq.full()) {
145 soCAM_SssUpdReq.write(updRequest);
146 printInfo(myName,
"Sending UPDATE request[%d] to [CAM].\n", i);
149 printWarn(myName,
"Cannot send INSERT request to [CAM] because stream is full.\n");
155 slcState = INSERT_REP;
160 if (!siCAM_SssUpdRep.empty()) {
162 siCAM_SssUpdRep.read(updReply);
164 printInfo(myName,
"Received an insert reply from [CAM]. \n");
165 printInfo(myName,
"Src=%d, Op=%d, SessId=%d.\n",
166 updReply.
source.to_int(), updReply.
op,
170 printError(myName,
"Got a wrong session ID (%d) as reply from [CAM].\n",
171 updReply.
source.to_int());
181 slcState = DELETE_REQ;
186 if (!soCAM_SssUpdReq.full()) {
194 soCAM_SssUpdReq.write(updRequest);
195 printInfo(myName,
"Sending DELETE request[%d] to [CAM].\n", i);
198 printWarn(myName,
"Cannot send DELETE request to [CAM] because stream is full.\n");
204 slcState = DELETE_REP;
209 if (!siCAM_SssUpdRep.empty()) {
211 siCAM_SssUpdRep.read(updReply);
213 printInfo(myName,
"Received a delete reply from [CAM]. \n");
214 printInfo(myName,
"Src=%d, Op=%d, SessId=%d.\n",
215 updReply.
source.to_int(), updReply.
op,
219 printError(myName,
"Got a wrong session ID (%d) as reply from [CAM].\n",
220 updReply.
source.to_int());
247 int main(
int argc,
char* argv[]) {
260 ap_uint<1> sMMIO_CamReady(
"sMMIO_CamReady");
262 stream<CamSessionLookupRequest> ssTOE_CAM_SssLkpReq(
"ssTOE_CAM_SssLkpReq");
263 stream<CamSessionLookupReply> ssCAM_TOE_SssLkpRep(
"ssCAM_TOE_SssLkpRep");
264 stream<CamSessionUpdateRequest> ssTOE_CAM_SssUpdReq(
"ssTOE_CAM_SssUpdReq");
265 stream<CamSessionUpdateReply> ssCAM_TOE_SssUpdRep(
"ssCAM_TOE_SssUpdRep");
273 printInfo(
THIS_NAME,
"############################################################################\n");
275 printInfo(
THIS_NAME,
"############################################################################\n");
276 printInfo(
THIS_NAME,
"This testbench will be executed with the following parameters: \n");
277 for (
int i=1; i<argc; i++) {
290 if (sMMIO_CamReady == 1) {
321 printInfo(
THIS_NAME,
"############################################################################\n");
323 printInfo(
THIS_NAME,
"############################################################################\n");
328 printError(
THIS_NAME,
"#### TEST BENCH FAILED : TOTAL NUMBER OF ERROR(S) = %2d ####\n", nrErr);
330 printInfo(
THIS_NAME,
"FYI - You may want to check for \'ERROR\' and/or \'WARNING\' alarms in the LOG file...\n\n");
333 printInfo(
THIS_NAME,
"#############################################################\n");
335 printInfo(
THIS_NAME,
"#############################################################\n");
#define DEFAULT_SESSION_ID
#define DEFAULT_HOST_IP4_ADDR
#define DEFAULT_FPGA_IP4_ADDR
#define TB_MAX_SIM_CYCLES
int main(int argc, char *argv[])
Main function.
void stepSim()
Increment the simulation counter.
#define DEFAULT_HOST_TCP_PORT
void pTOE(int &nrErr, stream< CamSessionLookupRequest > &soCAM_SssLkpReq, stream< CamSessionLookupReply > &siCAM_SssLkpRep, stream< CamSessionUpdateRequest > &soCAM_SssUpdReq, stream< CamSessionUpdateReply > &siCAM_SssUpdRep)
Emulate the behavior of the TCP Offload Engine (TOE).
#define DEFAULT_FPGA_TCP_PORT
void toecam_top(ap_uint< 1 > *poMMIO_CamReady, stream< CamSessionLookupRequest > &siTOE_SssLkpReq, stream< CamSessionLookupReply > &soTOE_SssLkpRep, stream< CamSessionUpdateRequest > &siTOE_SssUpdReq, stream< CamSessionUpdateReply > &soTOE_SssUpdRep)
Top of Content-Addressable Memory (TOECAM).
#define printError(callerName, format,...)
A macro to print an error message.
#define printInfo(callerName, format,...)
A macro to print an information message.
#define printWarn(callerName, format,...)
A macro to print a warning message.
#define concat3(firstCharConst, secondCharConst, thirdCharConst)