36 #include "../src/dhcp_client.hpp"
46 static ap_uint<6> wordCount = 0;
47 static bool done =
false;
55 sendWord.
tdata = 0x34aad42800060102;
85 sendWord.
tdata = 0x0105050a0a05050a;
88 sendWord.
tdata = 0x0304050600000000;
91 sendWord.
tdata = 0x0000000000000102;
100 sendWord.
tdata = 0x6353826300000000;
103 sendWord.
tdata = 0x05050a0436020135;
106 sendWord.
tdata = 0x0158020000043301;
109 sendWord.
tdata = 0x0a040300ffffff04;
112 sendWord.
tdata = 0x05050a041c010505;
115 sendWord.
tdata = 0x7265746e69140fff;
118 sendWord.
tdata = 0x6d6178652e6c616e;
121 sendWord.
tdata = 0xff67726f2e656c70;
137 sendWord.
tkeep = 0xff;
142 sendWord.
tkeep = 0x0f;
145 outData.write(sendWord);
153 static ap_uint<6> wordCount = 0;
154 static bool done =
false;
162 sendWord.
tdata = 0x34aad42800060102;
192 sendWord.
tdata = 0x0105050a0a05050a;
195 sendWord.
tdata = 0x0304050600000000;
198 sendWord.
tdata = 0x0000000000000102;
207 sendWord.
tdata = 0x6353826300000000;
210 sendWord.
tdata = 0x05050a0436050135;
213 sendWord.
tdata = 0x0158020000043301;
216 sendWord.
tdata = 0x0a040300ffffff04;
219 sendWord.
tdata = 0x05050a041c010505;
222 sendWord.
tdata = 0x7265746e69140fff;
225 sendWord.
tdata = 0x6d6178652e6c616e;
228 sendWord.
tdata = 0xff67726f2e656c70;
244 sendWord.
tkeep = 0xff;
249 sendWord.
tkeep = 0x0f;
252 outData.write(sendWord);
260 stream<ap_uint<16> > openPort(
"openPort");
261 stream<bool> confirmPortStatus(
"confirmPortStatus");
263 stream<UdpMeta> dataInMeta(
"dataInMeta");
264 stream<UdpWord> dataIn(
"dataIn");
265 stream<UdpMeta> dataOutMeta(
"dataOutMeta");
266 stream<UdpPLen> dataOutLength(
"dataOutLength");
267 stream<UdpWord> dataOut(
"dataOut");
268 ap_uint<32> ipAddressOut;
269 ap_uint<1> dhcpEnable = 0;
270 ap_uint<32> inputIpAddress = 0x0C0C0C0C;
271 ap_uint<48> myMacAddress = 0x010203040506;
279 outputFile.open(
"../../../../test/out.dat");
281 cout <<
"Error: could not open output vector file." << endl;
284 goldenFile.open(
"../../../../test/out.gold");
286 cout <<
"Error: could not open golden output vector file." << endl;
289 while (
count < 1000) {
302 if (!openPort.empty()) {
304 confirmPortStatus.write(
true);
310 else if (
count == 800)
316 else if (
count > 300) {
334 while (!dataOut.empty()) {
335 if (wasLast && !dataOutMeta.empty()) {
336 dataOutMeta.read(outMeta);
337 std::cout <<
"Src: " << outMeta.
src.
addr(31, 24)<<
"." << outMeta.
src.
addr(23, 16) <<
".";
338 std::cout << outMeta.
src.
addr(15, 8)<<
"." << outMeta.
src.
addr(7, 0) <<
":";
339 std::cout <<
":" << outMeta.
src.
port << std::endl;
340 std::cout <<
"Dst: " << outMeta.
dst.
addr(31, 24)<<
"." << outMeta.
dst.
addr(23, 16) <<
".";
341 std::cout << outMeta.
dst.
addr(15, 8)<<
"." << outMeta.
dst.
addr(7, 0) <<
":";
342 std::cout << outMeta.
dst.
port << std::endl;
344 if (wasLast && !dataOutLength.empty()) {
345 dataOutLength.read(outLen);
346 std::cout <<
"Length: " << outLen << std::endl;
348 dataOut.read(outWord);
349 std::cout << std::hex << std::setfill(
'0');
350 std::cout << std::setw(8) << ((uint32_t) outWord.
tdata(63, 32)) << std::setw(8) << ((uint32_t) outWord.
tdata(31, 0)) <<
"\t";
351 std::cout << std::setw(2) << outWord.
tkeep <<
" " << outWord.
tlast << std::endl;
352 wasLast = outWord.
tlast;
354 outputFile << std::hex << std::noshowbase;
355 outputFile << std::setfill(
'0');
356 outputFile << std::setw(8) << ((uint32_t) outWord.
tdata(63, 32));
357 outputFile << std::setw(8) << ((uint32_t) outWord.
tdata(31, 0));
358 outputFile <<
" " << std::setw(2) << ((uint32_t) outWord.
tkeep) <<
" ";
359 outputFile << std::setw(1) << ((uint32_t) outWord.
tlast) << std::endl;
361 goldenFile >> std::hex >> dataTemp >> keepTemp >> lastTemp;
363 if (outWord.
tdata != dataTemp || outWord.
tkeep != keepTemp || outWord.
tlast != lastTemp) {
372 std::cout <<
"computed length: " << std::dec << (outCount*8) << std::endl;
377 std::cout << std::dec<<
"IP Address: " << ipAddressOut(7,0) <<
"." << ipAddressOut(15,8) <<
".";
378 std::cout << ipAddressOut(23,16) <<
"." << ipAddressOut(31,24) << std::endl;
381 cerr <<
" done." << endl << endl;
383 printf(
"#####################################################\n");
385 printf(
"## ERROR - TESTBENCH FAILED (RC=%d) !!! ##\n", errCount);
389 printf(
"## SUCCESSFULL END OF TESTBENCH (RC=0) ##\n");
391 printf(
"#####################################################\n");
void dhcp_client(ap_uint< 1 > &piMMIO_This_Enable, ap_uint< 48 > &piMMIO_This_MacAddress, ap_uint< 32 > &poTHIS_Nts_IpAddress, stream< AxisAck > &siUDMX_This_OpnAck, stream< UdpPort > &soTHIS_Udmx_OpnReq, stream< UdpWord > &siUDMX_This_Data, stream< UdpMeta > &siUDMX_This_Meta, stream< UdpWord > &soTHIS_Udmx_Data, stream< UdpMeta > &soTHIS_Udmx_Meta, stream< UdpPort > &soTHIS_Udmx_PLen)
Main process of the DHCP-client.
void getAck(stream< UdpWord > &outData)
void getOffer(stream< UdpWord > &outData)