cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
test_rx_sar_table.cpp
Go to the documentation of this file.
1 
27 #include "rx_sar_table.hpp"
28 
29 using namespace hls;
30 
31 void emptyFifos(std::ofstream& out, stream<rxSarEntry>& rxFifoOut, stream<rxSarAppd>& appFifoOut, stream<rxSarEntry>& txFifoOut, int iter)
32 {
33  rxSarEntry outData;
34  rxSarAppd outAppData;
35  while (!(rxFifoOut.empty()))
36  {
37  rxFifoOut.read(outData);
38  out << "Step " << iter << ": RX Fifo\t\t";
39  out << std::hex;
40  out << std::setfill('0');
41  out << std::setw(8) << outData.recvd << " " << std::setw(4) << outData.appd << " ";
42  out << std::endl;
43  }
44 
45  while (!(appFifoOut.empty()))
46  {
47  appFifoOut.read(outAppData);
48  out << "Step " << iter << ": App Fifo\t\t";
49  out << std::hex;
50  out << std::setfill('0');
51  out << std::setw(8) << outData.recvd << " " << std::setw(4) << outData.appd << " ";
52  out << std::endl;
53  }
54 
55  while (!(txFifoOut.empty()))
56  {
57  txFifoOut.read(outData);
58  out << "Step " << iter << ": TX Fifo\t\t";
59  out << std::hex;
60  out << std::setfill('0');
61  out << std::setw(8) << outData.recvd << " " << std::setw(4) << outData.appd << " ";
62  out << std::endl;
63  }
64 }
65 
66 int main()
67 {
68 #pragma HLS inline region off
69  ap_uint<16> inData;
70  //rxSarEntry outData;
71  //rxSarAppd outAppData;
72  stream<ap_uint<16> > txFifoIn;
73 
74  stream<rxSarRecvd> rxFifoIn;
75  stream<rxSarAppd> appFifo;
76  stream<rxSarAppd> appFifoOut;
77  stream<rxSarEntry> rxFifoOut;
78  stream<rxSarEntry> txFifoOut;
79 
80  //std::vector<int> rxValues;
81  //std::vector<int> appValues;
82  //std::vector<int> txValues;
83  //std::vector<int> values3;
84 
85  std::ifstream inputFile;
86  std::ofstream outputFile;
87 
88  /*inputFile.open("/home/dsidler/workspace/vivado_projects/ip_checksum_validator/in.dat");
89 
90  if (!inputFile)
91  {
92  std::cout << "Error: could not open test input file." << std::endl;
93  return -1;
94  }*/
95  outputFile.open("/home/dasidler/toe/hls/toe/rx_sar_table/out.dat");
96  if (!outputFile)
97  {
98  std::cout << "Error: could not open test output file." << std::endl;
99  }
100 
101  //uint16_t strbTemp;
102  //uint64_t dataTemp;
103  //uint16_t lastTemp;
104  int count = 0;
105 
106 
107  /*
108  * Test1: tx(r); rx(w); tx(r);
109  */
110  //ap_uint<16> id = rand() % 100;
111  //ap_uint<32> val = rand() % 65536;
112  ap_uint<16> id = 0x57;
113  ap_uint<32> val = 0x25ca;
114  outputFile << "Test1" << std::endl;
115  outputFile << "ID: " << id << " Write value: " << val << std::endl;
116  while(count < 20)
117  {
118  switch(count)
119  {
120  case 0:
121  txFifoIn.write(id);
122  break;
123  case 1:
124  rxFifoIn.write(rxSarRecvd(id, val, 1)); //TODO change to boolean
125  break;
126  case 2:
127  txFifoIn.write(id);
128  break;
129  case 3:
130  rxFifoIn.write(id);
131  break;
132  default:
133  break;
134  }
135  rx_sar_table(rxFifoIn, appFifo, txFifoIn, rxFifoOut, appFifoOut, txFifoOut);
136  emptyFifos(outputFile, rxFifoOut, appFifoOut, txFifoOut, count);
137  count++;
138  }
139 
140  outputFile << "------------------------------------------------" << std::endl;
141 
142  //emptyFifos(outputFile, rxFifoOut, appFifoOut, txFifoOut, count);
143 
144 
145  while (count < 250)
146  {
147  rx_sar_table(rxFifoIn, appFifo, txFifoIn, rxFifoOut, appFifoOut, txFifoOut);
148  //bram_test(inFifo0, outFifo0);
149  count++;
150  }
151 
152  return 0;
153 }
void rx_sar_table(stream< RXeRxSarQuery > &siRXe_RxSarQry, stream< RxSarReply > &soRXe_RxSarRep, stream< RAiRxSarQuery > &siRAi_RxSarQry, stream< RAiRxSarReply > &soRAi_RxSarRep, stream< SessionId > &siTXe_RxSarReq, stream< RxSarReply > &soTxe_RxSarRep)
Rx SAR Table (RSt)
out
Definition: test.py:12
: Rx Segmentation And Re-assembly Table (RSt).
void emptyFifos(std::ofstream &out, stream< rxSarEntry > &rxFifoOut, stream< rxSarAppd > &appFifoOut, stream< rxSarEntry > &txFifoOut, int iter)
int main()