cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
test_iprx.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2016 -- 2021 IBM Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
30 #include "test_iprx.hpp"
31 
32 using namespace hls;
33 using namespace std;
34 
35 //---------------------------------------------------------
36 // HELPERS FOR THE DEBUGGING TRACES
37 // .e.g: DEBUG_LEVEL = (MDL_TRACE | IPS_TRACE)
38 //---------------------------------------------------------
39 #define THIS_NAME "TB"
40 
41 #define TRACE_OFF 0x0000
42 #define TRACE_CGF 1 << 1
43 #define TRACE_ALL 0xFFFF
44 #define DEBUG_LEVEL (TRACE_OFF)
45 
46 
49 void stepSim() {
50  gSimCycCnt++;
51  if (gTraceEvent || ((gSimCycCnt % 1000) == 0)) {
52  printInfo(THIS_NAME, "-- [@%4.4d] -----------------------------\n", gSimCycCnt);
53  gTraceEvent = false;
54  }
55  else if (0) {
56  printInfo(THIS_NAME, "------------------- [@%d] ------------\n", gSimCycCnt);
57  }
58 }
59 
60 
72 int createGoldenFiles(EthAddr myMacAddress,
73  string inpDAT_FileName,
74  string outARP_GoldName, string outICMP_GoldName,
75  string outTOE_GoldName, string outUOE_GoldName)
76 {
77  const char *myName = concat3(THIS_NAME, "/", "CGF");
78 
79  ifstream ifsDAT;
80  string ofNameArray[4] = { outARP_GoldName, outICMP_GoldName, \
81  outTOE_GoldName, outUOE_GoldName };
82  ofstream ofsArray[4]; // Stored in the same alphabetic same order
83 
84  string strLine;
85  char currPath[FILENAME_MAX];
86  deque<SimEthFrame> ethRxFramer; // Double-ended queue of frames for IPRX
87  int ret = NTS_OK;
88  int inpChunks=0, arpChunks=0, icmpChunks=0, tcpChunks=0, udpChunks=0, outChunks=0;
89  int inpFrames=0, arpFrames=0, icmpFrames=0, tcpFrames=0, udpFrames=0, outFrames=0;
90  int inpBytes=0, arpBytes=0, icmpBytes=0, tcpBytes=0, udpBytes=0, outBytes=0;
91  bool assessTkeepTlast = true;
92 
93  //-- STEP-1 : OPEN INPUT FILE AND ASSESS ITS EXTENSION
94  ifsDAT.open(inpDAT_FileName.c_str());
95  if (!ifsDAT) {
96  getcwd(currPath, sizeof(currPath));
97  printError(myName, "Cannot open the file: %s \n\t (FYI - The current working directory is: %s) \n", inpDAT_FileName.c_str(), currPath);
98  return(NTS_KO);
99  }
100  if (not isDatFile(inpDAT_FileName)) {
101  printError(myName, "Cannot create golden files from input file \'%s\' because file is not of type \'.dat\'.\n", inpDAT_FileName.c_str());
102  ifsDAT.close();
103  return(NTS_KO);
104  }
105 
106  //-- STEP-2 : OPEN THE OUTPUT GOLD FILES
107  for (int i=0; i<4; i++) {
108  remove(ofNameArray[i].c_str());
109  if (!ofsArray[i].is_open()) {
110  ofsArray[i].open (ofNameArray[i].c_str(), ofstream::out);
111  if (!ofsArray[i]) {
112  printFatal(THIS_NAME, "Could not open the output gold file \'%s\'. \n", ofNameArray[i].c_str());
113  }
114  }
115  }
116 
117  //-- STEP-3 : READ AND PARSE THE INPUT ETHERNET FILE
118  while ((ifsDAT.peek() != EOF) && (ret != NTS_KO)) {
119  SimEthFrame ethFrame;
120  AxisEth axisEth;
121  vector<string> stringVector;
122  string stringBuffer;
123  bool endOfFrame=false;
124  bool rc;
125  // Build a new frame from data file
126  while ((ifsDAT.peek() != EOF) && (!endOfFrame)) {
127  //-- Read one line at a time from the input DAT file
128  getline(ifsDAT, stringBuffer);
129  stringVector = myTokenizer(stringBuffer, ' ');
130  //-- Read an AxisChunk from line
131  rc = readAxisRawFromLine(axisEth, stringBuffer);
132  if (rc) {
133  if (axisEth.isValid()) {
134  ethFrame.pushChunk(axisEth);
135  if (axisEth.getLE_TLast() == 1) {
136  inpFrames++;
137  endOfFrame = true;
138  }
139  }
140  else {
141  // We always abort the stream as this point by asserting
142  // 'tlast' and de-asserting 'tkeep'.
143  ethFrame.pushChunk(AxisEth(axisEth.getLE_TData(), 0x00, 1));
144  inpFrames++;
145  endOfFrame = true;
146  }
147  inpChunks++;
148  inpBytes += axisEth.getLen();
149  }
150  }
151  if (endOfFrame) {
152  // Assess MAC_DA is valid
153  EthAddr macDA = ethFrame.getMacDestinAddress();
154  if((macDA != myMacAddress) and (macDA != 0xFFFFFFFFFFFF)) {
155  printWarn(THIS_NAME, "Frame #%d is dropped because MAC_DA does not match.\n", inpFrames);
156  }
157  else {
158  // Parse this frame and generate corresponding golden file(s)
159  EtherType etherType = ethFrame.getTypeLength();
160  SimIp4Packet ipPacket;
161  SimArpPacket arpPacket;
162  if (etherType.to_uint() >= 0x0600) {
163  switch (etherType.to_uint()) {
164  case ETH_ETHERTYPE_ARP:
165  arpPacket = ethFrame.getArpPacket();
166  if (DEBUG_LEVEL & TRACE_CGF) {
167  printInfo(myName, "Frame #%d is an ARP frame.\n", inpFrames);
168  }
169  if (ethFrame.sizeOfPayload() > 0) {
170  if (ethFrame.writeToDatFile(ofsArray[0]) == false) {
171  printError(myName, "Failed to write ARP frame to DAT file.\n");
172  rc = NTS_KO;
173  }
174  arpFrames += 1;
175  arpChunks += arpPacket.size();
176  arpBytes += arpPacket.length();
177  }
178  else {
179  printError(myName, "This Ethernet frame has zero payload bytes!?\n");
180  rc = NTS_KO;
181  }
182  break;
183  case ETH_ETHERTYPE_IP4:
184  ipPacket = ethFrame.getIpPacket();
185  if (ipPacket.getIpVersion() != 4) {
186  printWarn(myName, "Frame #%d is dropped because IP version is not \'4\'.\n", inpFrames);
187  continue;
188  }
189  else if (DEBUG_LEVEL & TRACE_CGF) {
190  printInfo(myName, "Frame #%d is an IPv4 frame (EtherType=0x%4.4X).\n",
191  inpFrames, etherType.to_uint());
192  }
193  if (ipPacket.verifyIpHeaderChecksum()) {
194  if (ethFrame.sizeOfPayload() > 0) {
195  if (ipPacket.writeToDatFile(ofsArray[2]) == false) {
196  printError(THIS_NAME, "Failed to write IPv4 packet to DAT file.\n");
197  rc = NTS_KO;
198  }
199  }
200  switch (ipPacket.getIpProtocol()) {
201  case 1: // ICMP
202  icmpFrames += 1;
203  icmpChunks += ipPacket.size();
204  icmpBytes += ipPacket.length();
205  break;
206  case 6: // TCP
207  tcpFrames += 1;
208  tcpChunks += ipPacket.size();
209  tcpBytes += ipPacket.length();
210  break;
211  case 17: // UDP
212  udpFrames += 1;
213  udpChunks += ipPacket.size();
214  udpBytes += ipPacket.length();
215  break;
216  default:
217  printError(myName, "Unknown IP protocol #%d.\n",
218  ipPacket.getIpProtocol());
219  rc = NTS_KO;
220  }
221  }
222  else {
223  printWarn(myName, "Frame #%d is dropped because IPv4 header checksum does not match.\n", inpFrames);
224  }
225  break;
226  default:
227  printError(myName, "Unsupported protocol 0x%4.4X.\n", etherType.to_ushort());
228  rc = NTS_KO;
229  break;
230  }
231  }
232  }
233  }
234  }
235 
236  //-- STEP-3: CLOSE FILES
237  ifsDAT.close();
238  for (int i=0; i<4; i++) {
239  ofsArray[i].close();
240  }
241 
242  //-- STEP-4: PRINT RESULTS
243  outFrames = arpFrames + icmpFrames + tcpFrames + udpFrames;
244  outChunks = arpChunks + icmpChunks + tcpChunks + udpChunks;
245  outBytes = arpBytes + icmpBytes + tcpBytes + udpBytes;
246  printInfo(myName, "Done with the creation of the golden files.\n");
247  printInfo(myName, "\tProcessed %5d chunks in %4d frames, for a total of %6d bytes.\n",
248  inpChunks, inpFrames, inpBytes);
249  printInfo(myName, "\tGenerated %5d chunks in %4d frames, for a total of %6d bytes.\n\n",
250  outChunks, outFrames, outBytes);
251  printInfo(myName, "\tARP : %5d chunks in %4d frames, for a total of %6d bytes.\n",
252  arpChunks, arpFrames, arpBytes);
253  printInfo(myName, "\tICMP : %5d chunks in %4d frames, for a total of %6d bytes.\n",
254  icmpChunks, icmpFrames, icmpBytes);
255  printInfo(myName, "\tTCP : %5d chunks in %4d frames, for a total of %6d bytes.\n",
256  tcpChunks, tcpFrames, tcpBytes);
257  printInfo(myName, "\tUDP : %5d chunks in %4d frames, for a total of %6d bytes.\n\n",
258  udpChunks, udpFrames, udpBytes);
259 
260  return(ret);
261 }
262 
263 #if HLS_VERSION != 2017
264 
282  //-- MMIO Interfaces
283  EthAddr piMMIO_MacAddress,
284  Ip4Addr piMMIO_Ip4Address,
285  //-- ETHernet MAC Layer Interface
286  stream<AxisEth> &siETH_Data,
287  //-- ARP Interface
288  stream<AxisArp> &soARP_Data,
289  //-- ICMP Interfaces
290  stream<AxisIp4> &soICMP_Data,
291  stream<AxisIp4> &soICMP_Derr,
292  //-- UOE Interface
293  stream<AxisIp4> &soUOE_Data,
294  //-- TOE Interface
295  stream<AxisIp4> &soTOE_Data)
296 {
297  //-- LOCAL INPUT and OUTPUT STREAMS -------------------
298  static stream<AxisRaw> ssiETH_Data ("ssiETH_Data");
299  static stream<AxisRaw> ssoARP_Data ("ssoARP_Data");
300  static stream<AxisRaw> ssoICMP_Data("ssoICMP_Data");
301  static stream<AxisRaw> ssoICMP_Derr("ssoICMP_Derr");
302  static stream<AxisRaw> ssoUOE_Data ("ssoUOE_Data");
303  static stream<AxisRaw> ssoTOE_Data ("ssoTOE_Data");
304 
305  //-- INPUT STREAM CASTING -----------------------------
306  pAxisRawCast(siETH_Data, ssiETH_Data);
307 
308  //-- MAIN IPRX_TOP PROCESS ----------------------------
309  iprx_top(
310  piMMIO_MacAddress,
311  piMMIO_Ip4Address,
312  ssiETH_Data,
313  ssoARP_Data,
314  ssoICMP_Data,
315  ssoICMP_Derr,
316  ssoUOE_Data,
317  ssoTOE_Data);
318 
319  //-- OUTPUT STREAM CASTING ----------------------------
320  pAxisRawCast(ssoARP_Data, soARP_Data);
321  pAxisRawCast(ssoICMP_Data, soICMP_Data);
322  pAxisRawCast(ssoICMP_Derr, soICMP_Derr);
323  pAxisRawCast(ssoUOE_Data, soUOE_Data);
324  pAxisRawCast(ssoTOE_Data, soTOE_Data);
325  }
326 #endif
327 
328 
333 int main(int argc, char* argv[]) {
334 
335  //------------------------------------------------------
336  //-- TESTBENCH GLOBAL VARIABLES
337  //------------------------------------------------------
338  gTraceEvent = false;
339  gFatalError = false;
340  gSimCycCnt = 0;
342 
343  //------------------------------------------------------
344  //-- TESTBENCH LOCAL VARIABLES
345  //------------------------------------------------------
346  int nrErr = 0; // Tb error counter.
347 
348  string ofsARP_Data_FileName = "../../../../test/simOutFiles/soARP_Data.dat";
349  string ofsTOE_Data_FileName = "../../../../test/simOutFiles/soTOE_Data.dat";
350  string ofsUOE_Data_FileName = "../../../../test/simOutFiles/soUOE_Data.dat";
351  string ofsICMP_Data_FileName= "../../../../test/simOutFiles/soICMP_Data.dat";
352  string dataFileArray[4] = { ofsARP_Data_FileName, ofsTOE_Data_FileName, \
353  ofsUOE_Data_FileName, ofsICMP_Data_FileName };
354 
355  string ofsARP_Gold_FileName = "../../../../test/simOutFiles/soARP_Gold.dat";
356  string ofsTOE_Gold_FileName = "../../../../test/simOutFiles/soTOE_Gold.dat";
357  string ofsUOE_Gold_FileName = "../../../../test/simOutFiles/soUOE_Gold.dat";
358  string ofsICMP_Gold_FileName= "../../../../test/simOutFiles/soICMP_Gold.dat";
359  string goldFileArray[4] = { ofsARP_Gold_FileName, ofsTOE_Gold_FileName, \
360  ofsUOE_Gold_FileName, ofsICMP_Gold_FileName };
361 
362  Ip4Addr myIp4Address = 0x01010101;
363  EthAddr myMacAddress = 0x010203040506;
364  int errCount = 0;
365 
366  //------------------------------------------------------
367  //-- DUT STREAM INTERFACES and RELATED VARIABLEs
368  //------------------------------------------------------
369  //-- Incoming streams
370  stream<AxisEth> ssETH_IPRX_Data ("ssETH_IPRX_Data");
371  int nrETH_IPRX_Chunks = 0;
372  int nrETH_IPRX_Frames = 0;
373  int nrETH_IPRX_Bytes = 0;
374  //-- Outgoing streams
375  stream<AxisArp> ssIPRX_ARP_Data ("ssIPRX_ARP_Data");
376  int nrIPRX_ARP_Chunks = 0;
377  int nrIPRX_ARP_Frames = 0;
378  int nrIPRX_ARP_Bytes = 0;
379  stream<AxisIp4> ssIPRX_TOE_Data ("ssIPRX_TOE_Data");
380  int nrIPRX_TOE_Chunks = 0;
381  int nrIPRX_TOE_Frames = 0;
382  int nrIPRX_TOE_Bytes = 0;
383  stream<AxisIp4> ssIPRX_UOE_Data ("ssIPRX_UOE_Data");
384  int nrIPRX_UOE_Chunks = 0;
385  int nrIPRX_UOE_Frames = 0;
386  int nrIPRX_UOE_Bytes = 0;
387  stream<AxisIp4> ssIPRX_ICMP_Data ("ssIPRX_ICMP_Data");
388  int nrIPRX_ICMP_Chunks = 0;
389  int nrIPRX_ICMP_Frames = 0;
390  int nrIPRX_ICMP_Bytes = 0;
391  stream<AxisIp4> ssIPRX_ICMP_DErr ("ssIPRX_ICMP_DErr");
392 
393  //------------------------------------------------------
394  //-- OPEN INPUT TEST VECTOR FILE
395  //------------------------------------------------------
396  if (argc != 2) {
397  printFatal(THIS_NAME, "Missing testbench parameter:\n\t Expecting an input test vector file.\n");
398  }
399 
400  //------------------------------------------------------
401  //-- CREATE DUT INPUT TRAFFIC AS STREAMS
402  //------------------------------------------------------
403  if (feedAxisFromFile<AxisEth>(ssETH_IPRX_Data, "ssETH_IPRX_Data", string(argv[1]),
404  nrETH_IPRX_Chunks, nrETH_IPRX_Frames, nrETH_IPRX_Bytes)) {
405  printInfo(THIS_NAME, "Done with the creation of the input traffic as streams:\n");
406  printInfo(THIS_NAME, "\tGenerated %d chunks in %d frames, for a total of %d bytes.\n\n",
407  nrETH_IPRX_Chunks, nrETH_IPRX_Frames, nrETH_IPRX_Bytes);
408  }
409  else {
410  printError(THIS_NAME, "Failed to create traffic as input stream. \n");
411  nrErr++;
412  }
413 
414  //------------------------------------------------------
415  //-- CREATE OUTPUT GOLD TRAFFIC
416  //------------------------------------------------------
417  if (not createGoldenFiles(myMacAddress, string(argv[1]),
418  ofsARP_Gold_FileName, ofsICMP_Gold_FileName,
419  ofsTOE_Gold_FileName, ofsUOE_Gold_FileName)) {
420  printError(THIS_NAME, "Failed to create golden files. \n");
421  nrErr++;
422  }
423 
424  printInfo(THIS_NAME, "############################################################################\n");
425  printInfo(THIS_NAME, "## TESTBENCH 'test_iprx' STARTS HERE ##\n");
426  printInfo(THIS_NAME, "############################################################################\n");
427  printInfo(THIS_NAME, "This testbench will be executed with the following parameters: \n");
428  for (int i=1; i<argc; i++) {
429  printInfo(THIS_NAME, "\t==> Param[%d] = %s\n", (i-1), argv[i]);
430  }
431  printf("\n\n");
432 
433  int tbRun = nrETH_IPRX_Chunks + TB_GRACE_TIME;
434 
435  while (tbRun) {
436  //-- RUN DUT --------------------------------------
437  #if HLS_VERSION == 2017
438  iprx_top(
439  myMacAddress,
440  myIp4Address,
441  ssETH_IPRX_Data,
442  ssIPRX_ARP_Data,
443  ssIPRX_ICMP_Data,
444  ssIPRX_ICMP_DErr,
445  ssIPRX_UOE_Data,
446  ssIPRX_TOE_Data);
447  #else
449  myMacAddress,
450  myIp4Address,
451  ssETH_IPRX_Data,
452  ssIPRX_ARP_Data,
453  ssIPRX_ICMP_Data,
454  ssIPRX_ICMP_DErr,
455  ssIPRX_UOE_Data,
456  ssIPRX_TOE_Data);
457  #endif
458  tbRun--;
459  stepSim();
460  }
461 
462  //---------------------------------------------------------------
463  //-- DRAIN DUT OUTPUT STREAMS
464  //---------------------------------------------------------------
465  if (not drainAxisToFile<AxisIp4>(ssIPRX_TOE_Data, "ssIPRX_TOE_Data", ofsTOE_Data_FileName,
466  nrIPRX_TOE_Chunks, nrIPRX_TOE_Frames, nrIPRX_TOE_Bytes)) {
467  printError(THIS_NAME, "Failed to drain TOE traffic from DUT. \n");
468  nrErr++;
469  }
470  if (not drainAxisToFile<AxisIp4>(ssIPRX_UOE_Data, "ssIPRX_UOE_Data", ofsUOE_Data_FileName,
471  nrIPRX_UOE_Chunks, nrIPRX_UOE_Frames, nrIPRX_UOE_Bytes)) {
472  printError(THIS_NAME, "Failed to drain UDP traffic from DUT. \n");
473  nrErr++;
474  }
475  if (not drainAxisToFile<AxisArp>(ssIPRX_ARP_Data, "ssIPRX_ARP_Data", ofsARP_Data_FileName,
476  nrIPRX_ARP_Chunks, nrIPRX_ARP_Frames, nrIPRX_ARP_Bytes)) {
477  printError(THIS_NAME, "Failed to drain ARP traffic from DUT. \n");
478  nrErr++;
479  }
480  if (not drainAxisToFile<AxisIp4>(ssIPRX_ICMP_Data, "ssIPRX_ICMP_Data", ofsICMP_Data_FileName,
481  nrIPRX_ICMP_Chunks, nrIPRX_ICMP_Frames, nrIPRX_ICMP_Bytes)) {
482  printError(THIS_NAME, "Failed to drain ICMP traffic from DUT. \n");
483  nrErr++;
484  }
485 
486  printInfo(THIS_NAME, "############################################################################\n");
487  printInfo(THIS_NAME, "## TESTBENCH 'test_iprx' ENDS HERE ##\n");
488  printInfo(THIS_NAME, "############################################################################\n");
489  stepSim();
490 
491  //---------------------------------------------------------------
492  //-- COMPARE OUTPUT DAT and GOLD STREAMS
493  //---------------------------------------------------------------
494  int res[4] = { 0, 0, 0, 0 };
495  for (int i=0; i<4; i++ ) {
496  res[i] = system(("diff --brief -w " + std::string(dataFileArray[i]) + " " + std::string(goldFileArray[i]) + " ").c_str());
497  if (res[i]) {
498  printError(THIS_NAME, "File \'%s\' does not match \'%s\'.\n", dataFileArray[i].c_str(), goldFileArray[i].c_str());
499  nrErr += 1;
500  }
501  }
502 
503  //---------------------------------------------------------------
504  //-- PRINT TESTBENCH STATUS
505  //---------------------------------------------------------------
506  printf("\n\n");
507  printInfo(THIS_NAME, "This testbench was executed with the following ETH test-file: \n");
508  for (int i=1; i<argc; i++) {
509  printInfo(THIS_NAME, "\t==> Param[%d] = %s\n", (i-1), argv[i]);
510  }
511 
512  if (nrErr) {
513  printError(THIS_NAME, "###########################################################\n");
514  printError(THIS_NAME, "#### TEST BENCH FAILED : TOTAL NUMBER OF ERROR(S) = %2d ####\n", nrErr);
515  printError(THIS_NAME, "###########################################################\n\n");
516 
517  printInfo(THIS_NAME, "FYI - You may want to check for \'ERROR\' and/or \'WARNING\' alarms in the LOG file...\n\n");
518  }
519  else {
520  printInfo(THIS_NAME, "#############################################################\n");
521  printInfo(THIS_NAME, "#### SUCCESSFUL END OF TEST ####\n");
522  printInfo(THIS_NAME, "#############################################################\n");
523  }
524 
525  return nrErr;
526 }
527 
LE_tData getLE_TData(int leHi=64 -1, int leLo=0) const
Definition: AxisRaw.hpp:260
int getLen() const
Definition: AxisRaw.hpp:411
bool isValid() const
Definition: AxisRaw.hpp:434
LE_tLast getLE_TLast() const
Definition: AxisRaw.hpp:268
Class ARP Packet for simulation.
Class ETHERNET Frame.
Definition: SimEthFrame.hpp:55
void pushChunk(AxisEth ethChunk)
int sizeOfPayload()
SimIp4Packet getIpPacket()
bool writeToDatFile(ofstream &outFileStream)
Dump this Ethernet frame as raw AxisEth chunks into a file.
EthAddr getMacDestinAddress()
SimArpPacket getArpPacket()
EthTypeLen getTypeLength()
Class IPv4 Packet for simulation.
bool verifyIpHeaderChecksum()
Recalculate the IPv4 header checksum and compare it with the one embedded into the packet.
bool writeToDatFile(ofstream &outFileStream)
Dump this IP packet as AxisIp4 chunks into a file.
unsigned int gSimCycCnt
Definition: tb_nal.cpp:150
bool gTraceEvent
Definition: tb_nal.cpp:151
bool gFatalError
Definition: tb_nal.cpp:152
#define TB_STARTUP_DELAY
Definition: test_arp.hpp:53
#define TB_GRACE_TIME
Definition: test_arp.hpp:54
#define TB_MAX_SIM_CYCLES
Definition: test_arp.hpp:52
unsigned int gMaxSimCycles
Definition: test_arp.hpp:69
void iprx_top_wrap(EthAddr piMMIO_MacAddress, Ip4Addr piMMIO_Ip4Address, stream< AxisEth > &siETH_Data, stream< AxisArp > &soARP_Data, stream< AxisIp4 > &soICMP_Data, stream< AxisIp4 > &soICMP_Derr, stream< AxisIp4 > &soUOE_Data, stream< AxisIp4 > &soTOE_Data)
A wrapper for the Toplevel of the IP Receive handler (IPRX).
Definition: test_iprx.cpp:281
int createGoldenFiles(EthAddr myMacAddress, string inpDAT_FileName, string outARP_GoldName, string outICMP_GoldName, string outTOE_GoldName, string outUOE_GoldName)
Create the golden reference files from an input test file.
Definition: test_iprx.cpp:72
int main(int argc, char *argv[])
Main function.
Definition: test_iprx.cpp:333
#define TRACE_CGF
Definition: test_iprx.cpp:42
void stepSim()
Increment the simulation counter.
Definition: test_iprx.cpp:49
#define THIS_NAME
Definition: test_iprx.cpp:39
#define DEBUG_LEVEL
Definition: test_iprx.cpp:44
void iprx_top(EthAddr piMMIO_MacAddress, Ip4Addr piMMIO_Ip4Address, stream< AxisRaw > &siETH_Data, stream< AxisRaw > &soARP_Data, stream< AxisRaw > &soICMP_Data, stream< AxisRaw > &soICMP_Derr, stream< AxisRaw > &soUOE_Data, stream< AxisRaw > &soTOE_Data)
Top of IP Receive handler (IPRX)
Definition: iprx.cpp:1032
bool readAxisRawFromLine(AxisRaw &axisRaw, string stringBuffer)
Retrieve an AxisRaw chunk from a string.
vector< string > myTokenizer(string strBuff, char delimiter)
Brakes a string into tokens by using the 'delimiter' character.
bool isDatFile(string fileName)
Checks if a file has a ".dat" extension.
Definition: SimNtsUtils.cpp:52
#define NTS_KO
Definition: nts_types.hpp:56
ap_uint< 48 > EthAddr
Definition: AxisEth.hpp:120
#define printError(callerName, format,...)
A macro to print an error message.
Definition: nts_utils.hpp:195
ap_uint< 32 > Ip4Addr
Definition: AxisIp4.hpp:169
void pAxisRawCast(hls::stream< TypeIn > &si, hls::stream< TypeOut > &so)
AxisRaw cast - Casts an AxisRaw stream to/from an AxisRaw derived class.
Definition: AxisRaw.hpp:148
#define NTS_OK
Definition: nts_types.hpp:55
#define ETH_ETHERTYPE_ARP
Definition: nts_types.hpp:156
#define printInfo(callerName, format,...)
A macro to print an information message.
Definition: nts_utils.hpp:169
#define printWarn(callerName, format,...)
A macro to print a warning message.
Definition: nts_utils.hpp:182
#define concat3(firstCharConst, secondCharConst, thirdCharConst)
Definition: nts_utils.hpp:161
#define ETH_ETHERTYPE_IP4
Definition: nts_types.hpp:155
#define printFatal(callerName, format,...)
A macro to print a fatal error message and exit.
Definition: nts_utils.hpp:208
ap_uint< 16 > EtherType
Definition: AxisEth.hpp:122
out
Definition: test.py:12
: Testbench for the IP Receiver packet handler (IPRX).