32 #include "../../common/src/common.cpp"
40 #define THIS_NAME "TB"
42 #define TRACE_OFF 0x0000
43 #define TRACE_URIF 1 << 1
44 #define TRACE_UAF 1 << 2
45 #define TRACE_MMIO 1 << 3
46 #define TRACE_ALL 0xFFFF
48 #define DEBUG_LEVEL (TRACE_ALL)
58 #define DEBUG_TRACE true
60 #define ENABLED (ap_uint<1>)1
61 #define DISABLED (ap_uint<1>)0
100 printf(
"[%4.4d] STEP DUT \n",
simCnt);
110 int main(
int argc,
char** argv) {
117 printf(
"#####################################################\n");
118 printf(
"## TESTBENCH STARTS HERE ##\n");
119 printf(
"#####################################################\n");
125 printf(
"Usage : %s <configuration file>. Provided %d\n", argv[0], argc);
136 const char *fname = argv[1];
137 if (readFileConfigToStruct(fname, &instruct) !=
INSIZE) {
138 printf(
"WARNING: Invalid read size of configration file %s. Will use default...\n", fname);
140 instruct.
seed = 4332 ;
155 printf(
"WARNING tb Invalid instruct->loop_nm = %u. Will assign %u\n", (
unsigned int)instruct.
loop_nm,
OUTDEP);
171 printf(
"ERROR: Cannot allocate memory for output array. Aborting...\n");
183 for (
unsigned int tb_loop = 0; tb_loop < 1; tb_loop++) {
189 printf(
"### ERROR : Failed to set input data stream \"sSHL_Uaf_Data\". \n");
195 for (
unsigned int i = 0; i < tot_trasnfers_in; i++) {
234 printf(
"## End of simulation at cycle=%3d. \n",
simCnt);
256 printf(
"NRC received NRCmeta stream from rank %d to rank %d.\n", (
int) tmp_meta.
tdata.
src_rank, (
int) tmp_meta.
tdata.
dst_rank);
262 assert(i == tot_trasnfers_out);
265 printf(
"Error No metadata received...\n");
274 printf(
"### ERROR : Failed to set array from file \"ofsUAF_Shl_Data.dat\". \n");
277 writeArrayToFile(
"./hls_out.txt",
out);
278 for (
unsigned int i = 0; i < instruct.
loop_nm; i++) {
279 printf(
"Option price %u: %f\n", i,
out[i]);
284 int rc1 = system(
"diff --brief -w -i -y ../../../../test/ofsUAF_Shl_Data.dat \
285 ../../../../test/verify_UAF_Shl_Data.dat");
288 printf(
"## Error : File \'ofsUAF_Shl_Data.dat\' does not match \'verify_UAF_Shl_Data.dat\'.\n");
290 printf(
"Output data in file \'ofsUAF_Shl_Data.dat\' verified.\n");
297 printf(
"#####################################################\n");
300 printf(
"## ERROR - TESTBENCH FAILED (RC=%d) !!! ##\n", nrErr);
302 printf(
"## SUCCESSFULL END OF TESTBENCH (RC=0) ##\n");
304 printf(
"#####################################################\n");
void mceuropeanengine(ap_uint< 32 > *pi_rank, ap_uint< 32 > *pi_size, stream< NetworkWord > &siSHL_This_Data, stream< NetworkWord > &soTHIS_Shl_Data, stream< NetworkMetaStream > &siNrc_meta, stream< NetworkMetaStream > &soNrc_meta, ap_uint< 32 > *po_rx_ports)
Main process of the MCEuropeanEngine Application directives.
stream< NetworkMetaStream > siUdp_meta("siUdp_meta")
int main(int argc, char **argv)
Main testbench of MCEuropeanEngine.
stream< NetworkMetaStream > soUdp_meta("soUdp_meta")
ap_uint< 1 > piSHL_This_MmioCaptPktEn
ap_uint< 1 > piSHL_This_MmioPostPktEn
stream< UdpWord > sUAF_Shl_Data("sUAF_Shl_Data")
void stepDut()
Run a single iteration of the DUT model.
stream< UdpWord > sSHL_Uaf_Data("sSHL_Uaf_Data")
ap_uint< 32 > cluster_size
ap_uint< 32 > s_udp_rx_ports
bool setInputDataStream(stream< UdpAppData > &sDataStream, const string dataStreamName, const string inpFileName)
Initialize an input data stream from a file.
bool getOutputDataStream(stream< UdpAppData > &sDataStream, const string dataStreamName, const string outFileName)
Fill an output file with data from an output stream.
bool dumpFileToArray(const string inpFileName, double *out, int simCnt)
Initialize an input data stream from a file.
bool dumpStructToFile(varin *s, const std::string outFileName, int simCnt)
Fill an output file with data from an output stream.
DtUsedInt requiredSamples