|
cloudFPGA (cF) API
1.0
The documentation of the source code of cloudFPGA (cF)
|
Support and utilities for the simulation of the Network Transport Stack (NTS). More...
Files | |
| file | SimAppData.hpp |
| : A simulation class to build APP data streams. | |
| file | SimArpPacket.hpp |
| : A simulation class to build and handle ARP packets. | |
| file | SimEthFrame.hpp |
| : A simulation class to build and handle Ethernet frames. | |
| file | SimIcmpPacket.hpp |
| : A simulation class to build and handle ICMP packets. | |
| file | SimIp4Packet.hpp |
| : A simulation class to build and handle IPv4 packets. | |
| file | SimNtsUtils.cpp |
| : Utilities for the simulation of the Network-Transport-Stack (NTS) cores. | |
| file | SimNtsUtils.hpp |
| : Utilities for the simulation of the Network-Transport-Stack (NTS) components. | |
| file | SimTcpSegment.hpp |
| : A simulation class to build TCP segments. | |
| file | SimUdpDatagram.hpp |
| : A simulation class to build UDP datagrams. | |
Classes | |
| class | SimAppData |
| Class App Data. More... | |
| class | SimArpPacket |
| Class ARP Packet for simulation. More... | |
| class | SimEthFrame |
| Class ETHERNET Frame. More... | |
| class | SimIcmpPacket |
| Class ICMP Packet for simulation. More... | |
| class | SimIp4Packet |
| Class IPv4 Packet for simulation. More... | |
| class | SimTcpSegment |
| Class TCP Segment. More... | |
| class | SimUdpDatagram |
| Class UDP Datagram. More... | |
Macros | |
| #define | THIS_NAME "SimNtsUtils" |
Functions | |
| bool | isDatFile (string fileName) |
| Checks if a file has a ".dat" extension. More... | |
| bool | isDottedDecimal (string ipStr) |
| Checks if a string contains an IP address represented in dot-decimal notation. More... | |
| bool | isHexString (string str) |
| Checks if a string contains a hexadecimal number. More... | |
| ap_uint< 32 > | myDottedDecimalIpToUint32 (string ipStr) |
| Converts an IPv4 address represented with a dotted-decimal string into an UINT32. More... | |
| vector< string > | myTokenizer (string strBuff, char delimiter) |
| Brakes a string into tokens by using the 'delimiter' character. More... | |
| string | myUint64ToStrHex (ap_uint< 64 > inputNumber) |
| Converts an UINT64 into a string of 16 HEX characters. More... | |
| string | myUint8ToStrHex (ap_uint< 8 > inputNumber) |
| Converts an UINT8 into a string of 2 HEX characters. More... | |
| ap_uint< 64 > | myStrHexToUint64 (string dataString) |
| Converts a string of 16 HEX characters into an UINT64. More... | |
| ap_uint< 8 > | myStrHexToUint8 (string keepString) |
| Converts a string of 2 HEX characters into an UINT8. More... | |
| int | myDiffTwoFiles (string dataFileName, string goldFileName) |
| Compares 2 files line-by-line, up to length of the 2nd file. More... | |
| bool | readAxisRawFromLine (AxisRaw &axisRaw, string stringBuffer) |
| Retrieve an AxisRaw chunk from a string. More... | |
| bool | writeAxisRawToFile (AxisRaw &axisRaw, ofstream &outFileStream) |
| Dump an Axis raw data chunk to a file. More... | |
| int | writeAxisAppToFile (AxisApp &axisApp, ofstream &outFile) |
| Dump a TCP or UDP application data chunk into a file. The data are stored as a stream of bytes which is terminated by a newline when the 'TLAST' bit of the data chunk is set. More... | |
| int | writeAxisAppToFile (AxisApp &axisApp, ofstream &outFile, int &wrCount) |
| Dump a TCP or UDP application data chunk into a file. Data are stored as a stream of bytes with a newline being appended every time the write-counter reaches the Maximum Segment Size (.i.e, MY_MSS) or the TLAST' bit of the data chunk is set. More... | |
| bool | readFpgaSocketFromLine (SockAddr &fpgaSock, string stringBuffer) |
| Retrieve an Fpga socket from a string. More... | |
| bool | readHostSocketFromLine (SockAddr &hostSock, string stringBuffer) |
| Retrieve a Host socket from a string. More... | |
| bool | readFpgaSndPortFromLine (Ly4Port &port, string stringBuffer) |
| Retrieve an FPGA send port from a string. More... | |
| bool | readAxisRawFromFile (AxisRaw &axisRaw, ifstream &inpFileStream) |
| Retrieve an Axis raw data chunk from a file. More... | |
| bool | readTbParamFromFile (const string paramName, const string datFile, unsigned int ¶mVal) |
| Retrieve a testbench parameter from a DAT file. More... | |
| template<int D> | |
| bool | writeApUintToFile (ap_uint< D > &data, ofstream &outFileStream) |
| Dump an AP_UINT to a file. More... | |
| bool | writeSocketPairToFile (SocketPair &socketPair, ofstream &outFileStream) |
| Dump a SocketPair to a file. More... | |
| template<class AXIS_T > | |
| bool | feedAxisFromFile (stream< AXIS_T > &ss, const string ssName, string datFile, int &nrChunks, int &nrFrames, int &nrBytes) |
| Initialize an Axi4-Stream (Axis) from a DAT file. More... | |
| template<class AXIS_T > | |
| bool | drainAxisToFile (stream< AXIS_T > &ss, const string ssName, string datFile, int &nrChunks, int &nrFrames, int &nrBytes) |
| Empty an Axi4-Stream (Axis) to a DAT file. More... | |
| void | _fakeCallTo_feedAxisAppFromFile () |
| Create a bunch of fake local calls to functions as workaround to link errors related to template classes. More... | |
| void | _fakeCallTo_feedAxisArpFromFile () |
| void | _fakeCallTo_feedAxisIp4FromFile () |
| void | _fakeCallTo_feedAxisEthFromFile () |
| void | _fakeCallTo_drainAxisAppToFile () |
| void | _fakeCallTo_drainAxisArpToFile () |
| void | _fakeCallTo_drainAxisEthToFile () |
| void | _fakeCallTo_drainAxisIp4ToFile () |
| void | _fakeCallTo_writeApUintToFile () |
| bool | feedAxisRawStreamFromFile (stream< AxisRaw > &ss, const string ssName, string datFile, int &nrChunks, int &nrFrames, int &nrBytes) |
| bool | drainAxisRawStreamToFile (stream< AxisRaw > &ss, const string ssName, string datFile, int &nrChunks, int &nrFrames, int &nrBytes) |
Support and utilities for the simulation of the Network Transport Stack (NTS).
| #define THIS_NAME "SimNtsUtils" |
DEBUG PRINT HELPERS
Definition at line 39 of file SimNtsUtils.cpp.
| void _fakeCallTo_drainAxisAppToFile | ( | ) |
Definition at line 937 of file SimNtsUtils.cpp.
| void _fakeCallTo_drainAxisArpToFile | ( | ) |
Definition at line 942 of file SimNtsUtils.cpp.
| void _fakeCallTo_drainAxisEthToFile | ( | ) |
Definition at line 947 of file SimNtsUtils.cpp.
| void _fakeCallTo_drainAxisIp4ToFile | ( | ) |
Definition at line 952 of file SimNtsUtils.cpp.
| void _fakeCallTo_feedAxisAppFromFile | ( | ) |
Create a bunch of fake local calls to functions as workaround to link errors related to template classes.
Definition at line 916 of file SimNtsUtils.cpp.
| void _fakeCallTo_feedAxisArpFromFile | ( | ) |
Definition at line 921 of file SimNtsUtils.cpp.
| void _fakeCallTo_feedAxisEthFromFile | ( | ) |
Definition at line 931 of file SimNtsUtils.cpp.
| void _fakeCallTo_feedAxisIp4FromFile | ( | ) |
Definition at line 926 of file SimNtsUtils.cpp.
| void _fakeCallTo_writeApUintToFile | ( | ) |
Definition at line 958 of file SimNtsUtils.cpp.
| bool drainAxisRawStreamToFile | ( | stream< AxisRaw > & | ss, |
| const string | ssName, | ||
| string | datFile, | ||
| int & | nrChunks, | ||
| int & | nrFrames, | ||
| int & | nrBytes | ||
| ) |
| bool drainAxisToFile | ( | stream< AXIS_T > & | ss, |
| const string | ssName, | ||
| string | datFile, | ||
| int & | nrChunks, | ||
| int & | nrFrames, | ||
| int & | nrBytes | ||
| ) |
Empty an Axi4-Stream (Axis) to a DAT file.
| [in/out] | ss, a ref to the Axis to drain. | |
| [in] | ssName,the | name of the Axis to drain. |
| [in] | fileName,the | DAT file to write to. |
| [out | nrChunks, a ref to the number of written chuncks. | |
| [out] | nrFrames,a | ref to the number of written frames. |
| [out] | nrBytes,a | ref to the number of written bytes. |
Definition at line 838 of file SimNtsUtils.cpp.
| bool feedAxisFromFile | ( | stream< AXIS_T > & | ss, |
| const string | ssName, | ||
| string | datFile, | ||
| int & | nrChunks, | ||
| int & | nrFrames, | ||
| int & | nrBytes | ||
| ) |
Initialize an Axi4-Stream (Axis) from a DAT file.
| [in/out] | ss A ref to the Axis to set. | |
| [in] | ssName | The name of the Axis to set. |
| [in] | fileName | The DAT file to read from. |
| [out | nrChunks A ref to the number of written chunks. | |
| [out] | nrFrames | A ref to the number of written frames. |
| [out] | nrBytes | A ref to the number of written bytes. |
Definition at line 776 of file SimNtsUtils.cpp.
| bool feedAxisRawStreamFromFile | ( | stream< AxisRaw > & | ss, |
| const string | ssName, | ||
| string | datFile, | ||
| int & | nrChunks, | ||
| int & | nrFrames, | ||
| int & | nrBytes | ||
| ) |
SIMULATION STREAM WRITER HELPERS - PROTOTYPE DEFINITIONS
| bool isDatFile | ( | string | fileName | ) |
Checks if a file has a ".dat" extension.
SIMULATION UTILITY HELPERS
| [in] | fileName,the | name of the file to assess. |
FORWARD DECLARATIONS HELPERS FOR THE DEBUGGING TRACES FYI: The global variable 'gTraceEvent' is set whenever a trace call is done. SIMULATION UTILITY HELPERS - PROTOTYPE DEFINITIONS
Definition at line 52 of file SimNtsUtils.cpp.
| bool isDottedDecimal | ( | string | ipStr | ) |
Checks if a string contains an IP address represented in dot-decimal notation.
| [in] | ipAddStr | The string to assess. |
Definition at line 72 of file SimNtsUtils.cpp.
| bool isHexString | ( | string | str | ) |
Checks if a string contains a hexadecimal number.
| [in] | str | The string to assess. |
Definition at line 90 of file SimNtsUtils.cpp.
| int myDiffTwoFiles | ( | string | dataFileName, |
| string | goldFileName | ||
| ) |
Compares 2 files line-by-line, up to length of the 2nd file.
| [in] | dataFileName | The name of the 1st file. |
| [in] | goldFileName | The name of the 2nd file. |
@info: This comparison is equivalent to the Linux command 'diff –brief -w', except that it offers the possibility to stop the comparison after a certain number of lines. This can be useful when comparing a golden file with the output data file generated by a Vivado HLS C/RTL Co-simulation. In facts, when using the pragma 'HLS INTERFACE ap_ctrl_none', we observe that the simulator is generating unexpected stimuli after the testbench is over (at least with Vivado 2017.4), which can create a discrepancy with the golden file. Therefore, this function can be used to compare two files based on the length of the 2nd file.
Definition at line 305 of file SimNtsUtils.cpp.
| ap_uint< 32 > myDottedDecimalIpToUint32 | ( | string | ipStr | ) |
Converts an IPv4 address represented with a dotted-decimal string into an UINT32.
| [in] | inputNumber | The string to convert. |
Definition at line 117 of file SimNtsUtils.cpp.
| ap_uint< 64 > myStrHexToUint64 | ( | string | dataString | ) |
Converts a string of 16 HEX characters into an UINT64.
| [in] | inputNumber | The string to convert. |
Definition at line 230 of file SimNtsUtils.cpp.
| ap_uint< 8 > myStrHexToUint8 | ( | string | keepString | ) |
Converts a string of 2 HEX characters into an UINT8.
| [in] | inputNumber | The string to convert. |
Definition at line 262 of file SimNtsUtils.cpp.
| vector< string > myTokenizer | ( | string | strBuff, |
| char | delimiter | ||
| ) |
Brakes a string into tokens by using the 'delimiter' character.
| [in] | stringBuffer | The string to tokenize. |
| [in] | delimiter | The delimiter character to use. |
Definition at line 141 of file SimNtsUtils.cpp.
| string myUint64ToStrHex | ( | ap_uint< 64 > | inputNumber | ) |
Converts an UINT64 into a string of 16 HEX characters.
| [in] | inputNumber | The UINT64 to convert. |
Definition at line 182 of file SimNtsUtils.cpp.
| string myUint8ToStrHex | ( | ap_uint< 8 > | inputNumber | ) |
Converts an UINT8 into a string of 2 HEX characters.
| [in] | inputNumber | The UINT8 to convert. |
Definition at line 206 of file SimNtsUtils.cpp.
| bool readAxisRawFromFile | ( | AxisRaw & | axisRaw, |
| ifstream & | inpFileStream | ||
| ) |
Retrieve an Axis raw data chunk from a file.
FILE READ & WRITER HELPERS
| [in] | axisRaw | A reference to the raw data chunk to retrieve. |
| [in] | inpFileStream | The input file stream to read from. |
SIMULATION FILE READ & WRITE HELPERS - PROTOTYPE DEFINITIONS
Definition at line 624 of file SimNtsUtils.cpp.
| bool readAxisRawFromLine | ( | AxisRaw & | axisRaw, |
| string | stringBuffer | ||
| ) |
Retrieve an AxisRaw chunk from a string.
LINE READ & WRITE HELPERS
| [in] | axisRaw | A ref to the AxisRaw to retrieve. |
| [in] | stringBuffer | The string buffer to read from. |
SIMULATION LINE READ & WRITE HELPERS - PROTOTYPE DEFINITIONS
Definition at line 378 of file SimNtsUtils.cpp.
| bool readFpgaSndPortFromLine | ( | Ly4Port & | port, |
| string | stringBuffer | ||
| ) |
Retrieve an FPGA send port from a string.
| [in] | port | A ref to the socket port to retrieve. |
| [in] | stringBuffer | The string buffer to read from. |
Definition at line 591 of file SimNtsUtils.cpp.
| bool readFpgaSocketFromLine | ( | SockAddr & | fpgaSock, |
| string | stringBuffer | ||
| ) |
Retrieve an Fpga socket from a string.
| [in] | fpgaSock | A ref to the socket address to retrieve. |
| [in] | stringBuffer | The string buffer to read from. |
Definition at line 511 of file SimNtsUtils.cpp.
| bool readHostSocketFromLine | ( | SockAddr & | hostSock, |
| string | stringBuffer | ||
| ) |
Retrieve a Host socket from a string.
| [in] | hostSock | A ref to the socket address to retrieve. |
| [in] | stringBuffer | The string buffer to read from. |
Definition at line 551 of file SimNtsUtils.cpp.
| bool readTbParamFromFile | ( | const string | paramName, |
| const string | datFile, | ||
| unsigned int & | paramVal | ||
| ) |
Retrieve a testbench parameter from a DAT file.
| [in] | paramName | The name of the parameter to read. |
| [in] | datFile | The input file to read from. |
| [out] | paramVal | A ref. to the parameter value. |
Definition at line 654 of file SimNtsUtils.cpp.
| bool writeApUintToFile | ( | ap_uint< D > & | data, |
| ofstream & | outFileStream | ||
| ) |
Dump an AP_UINT to a file.
| [in] | data | A reference to the data to dump. |
| [in] | outFileStream | A reference to the file stream to write. |
Definition at line 714 of file SimNtsUtils.cpp.
| int writeAxisAppToFile | ( | AxisApp & | axisApp, |
| ofstream & | outFile | ||
| ) |
Dump a TCP or UDP application data chunk into a file. The data are stored as a stream of bytes which is terminated by a newline when the 'TLAST' bit of the data chunk is set.
| [in] | appData | A reference to AxisApp chunk to write. |
| [in] | outFile | A reference to the file stream to write. |
Definition at line 444 of file SimNtsUtils.cpp.
| int writeAxisAppToFile | ( | AxisApp & | axisApp, |
| ofstream & | outFile, | ||
| int & | wrCount | ||
| ) |
Dump a TCP or UDP application data chunk into a file. Data are stored as a stream of bytes with a newline being appended every time the write-counter reaches the Maximum Segment Size (.i.e, MY_MSS) or the TLAST' bit of the data chunk is set.
| [in] | appData | A reference to the AxisApp chunk to write. |
| [in] | outFile | A reference to the file stream to write. |
| [in] | wrCount | A ref to a segment write counter. |
Definition at line 475 of file SimNtsUtils.cpp.
| bool writeAxisRawToFile | ( | AxisRaw & | axisRaw, |
| ofstream & | outFileStream | ||
| ) |
Dump an Axis raw data chunk to a file.
| [in] | axisRaw | A reference to the raw data chunk to write. |
| [in] | outFileStream | A reference to the file stream to write. |
Definition at line 416 of file SimNtsUtils.cpp.
| bool writeSocketPairToFile | ( | SocketPair & | socketPair, |
| ofstream & | outFileStream | ||
| ) |
Dump a SocketPair to a file.
| [in] | socketPair | A reference to the SocketPair to dump. |
| [in] | outFileStream | The output file stream to write to. |
Definition at line 745 of file SimNtsUtils.cpp.