30 #include "../include/common.hpp"
46 const string inpFileName,
int simCnt) {
48 ifstream inpFileStream;
49 string datFile =
"../../../../test/" + inpFileName;
53 inpFileStream.open(datFile.c_str());
54 if ( !inpFileStream ) {
55 cout <<
"### ERROR : Could not open the input data file " << datFile << endl;
60 while (inpFileStream) {
62 if (!inpFileStream.eof()) {
64 getline(inpFileStream, strLine);
65 if (strLine.empty())
continue;
66 sscanf(strLine.c_str(),
"%llx %x %d", &udpWord.
tdata, &udpWord.
tkeep, &udpWord.
tlast);
69 if (sDataStream.full()) {
70 printf(
"### ERROR : Stream is full. Cannot write stream with data from file \"%s\".\n", inpFileName.c_str());
73 sDataStream.write(udpWord);
75 #if DEBUG_LEVEL == TRACE_ALL
76 printf(
"[%4.4d] TB is filling input stream [%s] - Data write = {D=0x%16.16llX, K=0x%2.2X, L=%d} \n",
77 simCnt, dataStreamName.c_str(),
78 udpWord.
tdata.to_long(), udpWord.
tkeep.to_int(), udpWord.
tlast.to_int());
85 inpFileStream.close();
105 sDataStream.read(*udpWord);
118 ap_uint<64> value = 0;
121 value = (value << 8 ) + buffer[6];
122 value = (value << 8 ) + buffer[5];
123 value = (value << 8 ) + buffer[4];
124 value = (value << 8 ) + buffer[3];
125 value = (value << 8 ) + buffer[2];
126 value = (value << 8 ) + buffer[1];
127 value = (value << 8 ) + buffer[0];
141 for (
unsigned int i=0; i<8; i++) {
142 buffer[i] = (value >> 8*i );
154 if (!outFileStream.is_open()) {
155 printf(
"### ERROR : Output file stream is not open. \n");
158 outFileStream << hex << noshowbase << setfill(
'0') << setw(16) << udpWord->
tdata.to_uint64();
159 outFileStream <<
" ";
160 outFileStream << hex << noshowbase << setfill(
'0') << setw(2) << udpWord->
tkeep.to_int();
161 outFileStream <<
" ";
162 outFileStream << setw(1) << udpWord->
tlast.to_int() <<
"\n";
177 const string dataStreamName,
const string outFileName,
int simCnt)
180 ofstream outFileStream;
181 string datFile =
"../../../../test/" + outFileName;
186 outFileStream.open(datFile.c_str());
187 if ( !outFileStream ) {
188 cout <<
"### ERROR : Could not open the output data file " << datFile << endl;
193 while (!sDataStream.empty()) {
196 #if DEBUG_LEVEL == TRACE_ALL
197 printf(
"[%4.4d] TB is draining output stream [%s] - Data read = {D=0x%16.16llX, K=0x%2.2X, L=%d} \n",
198 simCnt, dataStreamName.c_str(),
199 udpWord.
tdata.to_long(), udpWord.
tkeep.to_int(), udpWord.
tlast.to_int());
209 outFileStream.close();
225 ofstream outFileStream;
226 string datFile =
"../../../../test/" + outFileName;
229 unsigned int bytes_per_line = 8;
232 outFileStream.open(datFile.c_str());
233 if ( !outFileStream ) {
234 cout <<
"### ERROR : Could not open the output data file " << datFile << endl;
237 #if DEBUG_LEVEL == TRACE_ALL
238 printf(
"came to dumpStringToFile: s.length()=%u\n", s.length());
241 ap_uint<8> value[bytes_per_line];
242 unsigned int total_bytes = 0;
245 for (
unsigned int i = 0; i < s.length(); i+=bytes_per_line, total_bytes+=bytes_per_line) {
247 for (
unsigned int k = 0; k < bytes_per_line; k++) {
248 if (i+k < s.length()) {
254 #if DEBUG_LEVEL == TRACE_ALL
255 printf(
"DEBUG: In dumpStringToFile: value[%u]=%c\n", k, (
char)value[k]);
261 if ((total_bytes >= (s.length() - bytes_per_line)) ||
262 ((total_bytes + bytes_per_line) %
PACK_SIZE == 0)) {
268 #if DEBUG_LEVEL == TRACE_ALL
269 printf(
"[%4.4d] IMG TB is dumping string to file [%s] - Data read [%u] = {val=%u, D=0x%16.16llX, K=0x%2.2X, L=%d} \n",
270 simCnt, datFile.c_str(), total_bytes, value,
271 udpWord.
tdata.to_long(), udpWord.
tkeep.to_int(), udpWord.
tlast.to_int());
279 outFileStream.close();
297 ofstream outFileStream;
298 string datFile = outFileName;
300 unsigned int bytes_per_line = 8;
301 ap_uint<64> tdata = 0;
304 outFileStream.open(datFile.c_str());
305 if ( !outFileStream ) {
306 cout <<
"### ERROR : Could not open the output data file " << datFile << endl;
309 #if DEBUG_LEVEL == TRACE_ALL
310 printf(
"came to dumpStringToFileOnlyRawData: s.length()=%u\n", out_size);
313 ap_uint<8> value[bytes_per_line];
314 unsigned int total_bytes = 0;
316 for (
unsigned int i = 0; i < out_size; i+=bytes_per_line, total_bytes+=bytes_per_line) {
317 for (
unsigned int k = 0; k < bytes_per_line; k++) {
318 if (i+k < out_size) {
324 #if DEBUG_LEVEL == TRACE_ALL
325 printf(
"DEBUG: In dumpStringToFileOnlyRawData: value[%u]=%c\n", k, (
char)value[k]);
329 #if DEBUG_LEVEL == TRACE_ALL
330 printf(
"[%4.4d] IMG TB is dumping string to file [%s] - Data read [%u] = {val=%u, D=0x%16.16llX} \n",
331 simCnt, datFile.c_str(), total_bytes, value, tdata.to_long());
333 outFileStream << hex << setfill(
'0') << setw(16) << tdata.to_uint64();
335 outFileStream <<
"\n";
338 outFileStream.close();
357 ofstream outFileStream;
358 string datFile =
"../../../../test/" + outFileName;
361 unsigned int bytes_per_line = 8;
364 outFileStream.open(datFile.c_str());
365 if ( !outFileStream ) {
366 cout <<
"### ERROR : Could not open the output data file " << datFile << endl;
369 #if DEBUG_LEVEL == TRACE_ALL
370 printf(
"came to dumpStringToFile: s.length()=%u\n", s.length());
373 ap_uint<8> value[bytes_per_line];
374 unsigned int total_bytes = 0;
378 for (
unsigned int i = 0; i < s.length(); cntr += 1, i+=bytes_per_line, total_bytes+=bytes_per_line) {
380 for (
unsigned int k = 0; k < bytes_per_line; k++) {
381 if (i+k < s.length()) {
387 #if DEBUG_LEVEL == TRACE_ALL
388 printf(
"DEBUG: In dumpStringToFile: value[%u]=%c\n", k, (
char)value[k]);
394 if ((total_bytes >= (s.length() - bytes_per_line)) ||
395 ((total_bytes + bytes_per_line) %
PACK_SIZE == 0) || ( cntr!= 0 && ((cntr+1) % gno == 0))) {
401 #if DEBUG_LEVEL == TRACE_ALL
402 printf(
"[%4.4d] IMG TB is dumping string to file [%s] - Data read [%u] = {val=%u, D=0x%16.16llX, K=0x%2.2X, L=%d} \n",
403 simCnt, datFile.c_str(), total_bytes, value,
404 udpWord.
tdata.to_long(), udpWord.
tkeep.to_int(), udpWord.
tlast.to_int());
412 outFileStream.close();
426 ifstream inpFileStream;
427 string datFile =
"../../../../test/" + inpFileName;
430 unsigned int bytes_per_line = 8;
431 ap_uint<8> value[bytes_per_line];
433 for(i=0; i < bytes_per_line; i++){
438 inpFileStream.open(datFile.c_str());
439 if ( !inpFileStream ) {
440 cout <<
"### ERROR : Could not open the input data file " << datFile << endl;
445 while (inpFileStream) {
447 if (!inpFileStream.eof()) {
449 getline(inpFileStream, strLine);
451 if (strLine.empty())
continue;
452 sscanf(strLine.c_str(),
"%llx %x %d", &udpWord.
tdata, &udpWord.
tkeep, &udpWord.
tlast);
456 for (
unsigned int k = 0; k < bytes_per_line; k++) {
457 charOutput[i++] = value[k];
459 #if DEBUG_LEVEL == TRACE_ALL
460 printf(
"[%4.4d] TB is filling string with character %c\n",
467 inpFileStream.close();
480 template<
unsigned int bytes_per_line = 8>
484 ifstream inpFileStream;
485 string datFile = inpFileName;
490 unsigned long long int mylongunsigned;
491 unsigned long long int zero_byte=0;
493 char my_tmp_buf [bytes_per_line];
495 inpFileStream.open(datFile.c_str());
497 if ( !inpFileStream ) {
498 cout <<
"### ERROR : Could not open the input data file " << datFile << endl;
503 while (inpFileStream) {
505 if (!inpFileStream.eof()) {
507 getline(inpFileStream, strLine);
508 memcpy(my_tmp_buf,&zero_byte, bytes_per_line);
509 if (strLine.empty())
continue;
511 mylongunsigned=stoul(strLine,
nullptr,16);
514 memcpy(my_tmp_buf,(
char *)&mylongunsigned,
sizeof(
unsigned long long int));
515 charOutput.append(my_tmp_buf, bytes_per_line);
520 inpFileStream.close();
523 return string(charOutput);
539 if (
'0' <= c && c <=
'9')
541 else if (
'a' <= c && c <=
'f')
543 else if (
'A' <= c && c <=
'F')
557 out.reserve(in.length() / 2);
558 for (string::const_iterator p = in.begin(); p != in.end(); p++)
560 unsigned char c =
hexval(*p);
562 if (p == in.end())
break;
563 c = (c << 4) +
hexval(*p);
576 std::stringstream sstream;
577 for ( string::const_iterator item = in.begin(); item != in.end(); item++){
578 sstream << std::hex <<
int(*item);
592 std::stringstream sstream;
593 for (
int i=0; i<bytesize; i++){
594 sstream << std::hex <<
int(in[i]);
608 int n =
str.length();
609 int cl = corner.length();
618 return (
str.substr(0, cl).compare(corner) == 0 &&
619 str.substr(n-cl, cl).compare(corner) == 0);
632 for (
unsigned int i = 0; i < byteSize; i++)
634 std::sprintf(
out+i,
"%d", (T)in[i]);
640 for (
unsigned int i = 0; i < byteSize; i++)
642 std::sprintf((
char*)
out+i,
"%u", (
unsigned int)in[i]);
654 char tmp_out [byteSize];
655 for (
unsigned int i = 0; i < byteSize; i++)
657 std::sprintf(tmp_out+i,
"%d", (
int)in[i]);
670 template<
unsigned int bytes_per_line = 8>
671 string createMemTestCommands(
unsigned long long int mem_address,
unsigned int testingNumber,
unsigned int burst_size)
674 char start_cmd [bytes_per_line];
675 char stop_cmd [bytes_per_line];
676 char value_cmd[bytes_per_line];
677 char burst_cmd[bytes_per_line];
679 for (
unsigned int k = 0; k < bytes_per_line; k++) {
680 value_cmd[k] = (char)0;
682 stop_cmd[k] = (char)0;
683 start_cmd[k] = (char)0;
684 burst_cmd[k] = (char)0;
687 start_cmd[k] = (char)1;
688 stop_cmd[k] = (char)2;
689 burst_cmd[k] = (char)4;
692 memcpy(start_cmd+1, (
char*)&testingNumber, 2);
693 out =
out.append(start_cmd,3);
694 memcpy(value_cmd, (
char*)&mem_address, 5);
695 out =
out.append(value_cmd,5);
696 memcpy(burst_cmd+1,(
char*)&burst_size,2);
697 out =
out.append(burst_cmd,8);
709 template<
unsigned int bytes_per_line = 8>
712 char addr_cmd [bytes_per_line];
713 char fault_cntr_cmd [bytes_per_line];
714 char fault_addr_cmd [bytes_per_line];
715 char filler_cmd [bytes_per_line];
716 char clock_cycles_cmd [bytes_per_line];
717 char end_of_tests_cmd [bytes_per_line];
718 char stop_cmd [bytes_per_line];
719 unsigned int fault_addr = 0;
720 unsigned int clock_cycles = 0;
721 const unsigned int first_faultTests = 3;
725 unsigned int mem_word_size = 512;
726 unsigned int mem_size_of_word_size = 20;
728 unsigned int mem_addr_per_word = mem_word_size / 8;
729 unsigned int fault_cntr = 0;
731 clock_cycles = mem_address % mem_addr_per_word == 0 ? mem_address / mem_addr_per_word : (
unsigned int) mem_address / mem_addr_per_word + 1;
735 for (
unsigned int j = 1; j < mem_address/64; j++)
737 ap_uint<512> currentNumber = j;
738 ap_uint<512> nextNumber = (currentNumber+1) xor 1;
739 ap_uint<512> tmpNumber = nextNumber;
740 tmpNumber = nextNumber & 0;
741 if( nextNumber != (tmpNumber)){
767 for(
unsigned int i = 0; i < testingNumber; i++){
768 for (
unsigned int k = 0; k < bytes_per_line; k++) {
769 addr_cmd[k] = (char)0;
770 filler_cmd[k] = (char)0;
771 fault_cntr_cmd[k] = (char)0;
772 fault_addr_cmd[k] = (char)0;
773 stop_cmd[k] = (char)0;
774 stop_cmd[k] = (char)0;
775 end_of_tests_cmd[k] = (char)0;
776 clock_cycles_cmd[k] = (char)0;
778 stop_cmd[0] = (char)2;
779 end_of_tests_cmd[0] = (char)3;
780 memcpy(end_of_tests_cmd+1, (
char*)&testingNumber, 2);
781 memcpy(addr_cmd, (
char*)&mem_address,
sizeof(
unsigned long long int));
782 out =
out.append(addr_cmd,bytes_per_line);
784 if(i < first_faultTests-1 || mem_address <= mem_addr_per_word)
786 out =
out.append(filler_cmd,bytes_per_line);
787 out =
out.append(filler_cmd,bytes_per_line);
789 memcpy(fault_cntr_cmd, (
char*)&fault_cntr,
sizeof(
unsigned int));
790 out =
out.append(fault_cntr_cmd,bytes_per_line);
791 memcpy(fault_addr_cmd, (
char*)&mem_addr_per_word,
sizeof(
unsigned int));
792 out =
out.append(fault_addr_cmd,bytes_per_line);
798 const unsigned int dummycc=1;
799 memcpy(clock_cycles_cmd,(
char*)& dummycc,
sizeof(
unsigned int));
800 out =
out.append(clock_cycles_cmd,bytes_per_line);
801 out =
out.append(filler_cmd,bytes_per_line);
803 out =
out.append(end_of_tests_cmd,bytes_per_line);
817 strGold = input_string;
818 uppercase_conversion:
819 for (
unsigned int i = 0; i < strGold.length(); i++ ) {
820 if (strGold[i] >=
'a' && strGold[i] <=
'z'){
821 strGold[i] = strGold[i] - (
'a' -
'A');
837 int n =
str.length();
841 for (
int i = 0; i < n / 2; i++)
842 swap(
str[i],
str[n - i - 1]);
854 template<
unsigned int bytes_per_line=8>
857 std::vector<MemoryTestResult> testResults_vector;
859 int rawiterations = charOutputSize / 8;
860 unsigned int mem_word_size = 512;
861 unsigned int mem_word_byte_size = mem_word_size/8;
862 bool is_stop_present = rawdatalines % (3+1+1) == 0;
865 char myTmpOutBuff [bytes_per_line];
866 for (
int i = 0; i < bytes_per_line; ++i)
868 myTmpOutBuff[i]=(char)0;
870 unsigned int testingNumber_out=0, fault_cntr_out=0, fault_addr_out=0;
871 unsigned long long int max_memory_addr_out=0, clock_cycles_read=0, clock_cycles_write=0;
872 for (
int i = 1; i < rawdatalines+1; i++)
875 tmp_outbuff= longbuf.substr((i-1)*bytes_per_line,bytes_per_line);
876 if(is_stop_present && k==7){
877 cout <<
"DEBUG the stop is present and is here" << endl;
878 }
else if( ( (i == rawdatalines-1) || (i == rawdatalines) ) && k==6){
882 memcpy(&testingNumber_out,tmp_outbuff.c_str()+1,bytes_per_line/2);
884 #if DEBUG_LEVEL == TRACE_ALL
885 cout <<
"DEBUG last command with the iterations " << testingNumber_out << endl;
890 memcpy(&clock_cycles_read,tmp_outbuff.c_str(),bytes_per_line);
892 #if DEBUG_LEVEL == TRACE_ALL
893 cout <<
"DEBUG clock_cycles_read (or the fourth half data pckt) " << clock_cycles_read << endl;
894 cout <<
"DEBUG clock_cycles_write (or the fourth half data pckt) " << clock_cycles_write << endl;
896 MemoryTestResult tmpResult(max_memory_addr_out,fault_cntr_out,fault_addr_out,clock_cycles_write,clock_cycles_read);
897 testResults_vector.push_back(tmpResult);
898 if(!( (i+1 == rawdatalines-1) || (i+1 == rawdatalines) )){
900 #if DEBUG_LEVEL == TRACE_ALL
901 cout <<
"DEBUG reinit the counter" << endl;
904 unsigned int written_words = max_memory_addr_out%mem_word_byte_size == 0 ? max_memory_addr_out/mem_word_byte_size : max_memory_addr_out/mem_word_byte_size + 1;
905 double rd_bndwdth = ( (double)written_words*(
double)mem_word_size / ( (double)tmpResult.
clock_cycles_read * ( 6.4 ) ) );
906 double wr_bndwdth = ( (double)written_words*(
double)mem_word_size / ( (double)tmpResult.
clock_cycles_write * ( 6.4 ) ) );
907 #if DEBUG_LEVEL == TRACE_ALL
908 cout <<
"Written " << written_words <<
" words" << endl;
909 cout <<
"DEBUG overall test results: target address " << tmpResult.
target_address <<
" ";
910 cout <<
"Fault counter: " << tmpResult.
fault_cntr <<
" ";
912 cout <<
" RD BW " << rd_bndwdth <<
"[GBit/s] with cc equal to " << tmpResult.
clock_cycles_read <<
" " << endl;
913 cout <<
" WR BW " << wr_bndwdth <<
"[GBit/s] with cc equal to " << tmpResult.
clock_cycles_write <<
" " << endl;
930 memcpy(&clock_cycles_write,tmp_outbuff.c_str(),bytes_per_line);
936 memcpy(&fault_addr_out,tmp_outbuff.c_str(),bytes_per_line/2);
938 #if DEBUG_LEVEL == TRACE_ALL
939 cout <<
"DEBUG first fault address (or the third data pckt) " << fault_addr_out << endl;
944 memcpy(&fault_cntr_out,tmp_outbuff.c_str(),bytes_per_line/2);
946 #if DEBUG_LEVEL == TRACE_ALL
947 cout <<
"DEBUG the fault counters (or the second data pack) " << fault_cntr_out << endl;
953 memcpy(&max_memory_addr_out,tmp_outbuff.c_str(),bytes_per_line);
954 #if DEBUG_LEVEL == TRACE_ALL
955 cout <<
"DEBUG max address (or the first data pack) " << max_memory_addr_out << endl;
961 return testResults_vector;
972 #if DEBUG_LEVEL == TRACE_ALL
973 printf(
"Going to print a hex string :D\n");
975 for (
size_t i = 0; i < strSize; i++)
977 printf(
"%x",inStr[i]);
991 #if DEBUG_LEVEL == TRACE_ALL
992 printf(
"Going to prit a hex char buff :D\n");
994 for (
size_t i = 0; i < strSize; i++)
996 printf(
"%x",inStr[i]);
1012 unsigned char *b = (
unsigned char*) ptr;
1016 for (i =
size-1; i >= 0; i--) {
1017 for (j = 7; j >= 0; j--) {
1018 byte = (b[i] >> j) & 1;
1025 static inline ssize_t
1026 __file_size(
const char *fname)
1031 rc = lstat(fname, &s);
1033 fprintf(stderr,
"err: Cannot find %s!\n", fname);
1039 static inline ssize_t
1040 __file_read(
const char *fname,
char *buff,
size_t len)
1045 if ((fname == NULL) || (buff == NULL) || (len == 0))
1048 fp = fopen(fname,
"r");
1050 fprintf(stderr,
"err: Cannot open file %s: %s\n",
1051 fname, strerror(errno));
1054 rc = fread(buff, len, 1, fp);
1056 fprintf(stderr,
"err: Cannot read from %s: %s\n",
1057 fname, strerror(errno));
1065 static inline ssize_t
1066 __file_write(
const char *fname,
const char *buff,
size_t len)
1071 if ((fname == NULL) || (buff == NULL) || (len == 0))
1074 fp = fopen(fname,
"w+");
1076 fprintf(stderr,
"err: Cannot open file %s: %s\n",
1077 fname, strerror(errno));
1080 rc = fwrite(buff, len, 1, fp);
1082 fprintf(stderr,
"err: Cannot write to %s: %s\n",
1083 fname, strerror(errno));
void ascii2hex(const string &in, string &out)
Convert a ascii string to a hexadecimal string FIXME:
void reverseStr(string &str)
reverse a given string
bool dumpStringToFile(const string s, const string outFileName, int simCnt)
Fill an output file with data from an image.
ap_uint< 64 > pack_ap_uint_64_(ap_uint< 8 > *buffer)
Pack an array of 8 x ap_uint<8> into a ap_uint<64> word.
void string2hexnumericsString(const string &in, string &out, size_t byteSize)
Convert a hex string to a integer into a char buffer with the SAME dimensions FIXME:
std::vector< MemoryTestResult > parseMemoryTestOutput(const string longbuf, size_t charOutputSize, int rawdatalines)
Parse the memory test output contained in astring with a given size.
bool dumpStringToFileWithLastSetEveryGnoPackets(string s, const string outFileName, int simCnt, int gno)
Fill an output file with data from a string and set the tlast every gno packets.
bool isCornerPresent(string str, string corner)
Check the presence of a given corner value at the begin and the end of a string.
void string2hexnumerics(const string &in, char *out, size_t byteSize)
Convert a hex string to a integer into a char buffer with the SAME dimensions FIXME:
string createMemTestGoldenOutput(unsigned long long int mem_address, unsigned int testingNumber, bool with_bw_analysis)
Create the expected output results for the memory test (with FAULT INJECTION)
string dumpFileToStringRawDataString(const string inpFileName, int *rawdatalines, size_t outputSize)
Initialize an input data stream from a file with only data.
bool dumpFileToString(const string inpFileName, char *charOutput, int simCnt)
Initialize an input data stream from a file.
void stringHex2Unsigned(const string &in, unsigned int *out, size_t byteSize)
void unpack_ap_uint_64_(ap_uint< 64 > value, ap_uint< 8 > *buffer)
Unpack an ap_uint<64> word to an array of 8 x ap_uint<8>.
void ascii2hexWithSize(const string &in, string &out, size_t bytesize)
Convert a ascii string to a hexadecimal string FIXME:
string createMemTestCommands(unsigned long long int mem_address, unsigned int testingNumber, unsigned int burst_size)
Create the commands for a memory test with start/max address to test-nop to execute-stop.
bool dumpDataToFile(UdpWord *udpWord, ofstream &outFileStream)
Dump a data word to a file.
std::string createUppercaseGoldenOutput(std::string input_string)
Create the expected output results for the uppercase.
bool setInputDataStream(stream< UdpWord > &sDataStream, const string dataStreamName, const string inpFileName, int simCnt)
Initialize an input data stream from a file.
void printStringHex(const string inStr, size_t strSize)
print byte-per-byte a given string in hexadecimal format
void hex2ascii(const string &in, string &out)
Convert a hexadecimal string to a ascii string FIXME:
bool dumpStringToFileOnlyRawData(const string s, const string outFileName, int simCnt, size_t out_size)
Fill an output file with data from an image.
bool getOutputDataStream(stream< UdpWord > &sDataStream, const string dataStreamName, const string outFileName, int simCnt)
Fill an output file with data from an output stream.
unsigned char hexval(unsigned char c)
convert a char to its hexadecimal representation.
unsigned long long int clock_cycles_read
void printBits(size_t const size, void const *const ptr)
print the binary representation of a target pointer buffer of a given size. Assumes little endian.
unsigned int first_fault_address
void printCharBuffHex(const char *inStr, size_t strSize)
print byte-per-byte a given char buff in hexadecimal format
unsigned long long int clock_cycles_write
unsigned long long int target_address
bool readDataStream(stream< UdpAppData > &sDataStream, UdpAppData *udpWord)
Read data from a stream.