36 #include "../../common/src/common.cpp"
44 #define THIS_NAME "TB"
46 #define TRACE_OFF 0x0000
47 #define TRACE_URIF 1 << 1
48 #define TRACE_UAF 1 << 2
49 #define TRACE_MMIO 1 << 3
50 #define TRACE_ALL 0xFFFF
52 #define DEBUG_LEVEL (TRACE_ALL)
62 #define DEBUG_TRACE true
64 #define ENABLED (ap_uint<1>)1
65 #define DISABLED (ap_uint<1>)0
83 stream<NetworkMetaStream>
siUdp_meta (
"siUdp_meta");
84 stream<NetworkMetaStream>
soUdp_meta (
"soUdp_meta");
105 printf(
"[%4.4d] STEP DUT \n",
simCnt);
115 int main(
int argc,
char** argv) {
122 printf(
"#####################################################\n");
123 printf(
"## TESTBENCH STARTS HERE ##\n");
124 printf(
"#####################################################\n");
130 printf(
"Usage : %s <input string> , provided %d\n", argv[0], argc);
133 string strInput = argv[1];
137 strInput = strInput.substr(1,strInput.length()-2);
139 if (!strInput.length()) {
140 printf(
"ERROR: Empty string provided. Aborting...\n");
144 printf(
"Succesfully loaded string ... %s\n", argv[1]);
152 unsigned int sim_time = 2 *
CEIL(strInput.length(), 8) + 10;
153 unsigned int tot_trasnfers = (
CEIL(strInput.length()+1,
PACK_SIZE));
154 char *charOutput = (
char*)malloc((strInput.length()+8) *
sizeof(
char));
155 char *charInput = (
char*)malloc((strInput.length())+8 *
sizeof(
char));
156 if (!charOutput || !charInput) {
157 printf(
"ERROR: Cannot allocate memory for output string. Aborting...\n");
165 if (!dumpStringToFileWithCommands(strInput,
"ifsSHL_Uaf_Data.dat",
simCnt)) {
174 printf(
"### ERROR : Failed to set input data stream \"sSHL_Uaf_Data\". \n");
180 for (
unsigned int i=0; i<tot_trasnfers; i++) {
219 printf(
"## End of simulation at cycle=%3d. \n",
simCnt);
241 printf(
"NRC received NRCmeta stream from rank %d to rank %d.\n", (
int) tmp_meta.
tdata.
src_rank, (
int) tmp_meta.
tdata.
dst_rank);
246 assert(i == tot_trasnfers);
249 printf(
"Error No metadata received...\n");
256 if (!dumpFileToStringWithoutCommands(
"ifsSHL_Uaf_Data.dat", charInput,
simCnt)) {
257 printf(
"### ERROR : Failed to set string from file \"ofsUAF_Shl_Data.dat\". \n");
260 printf(
"Input string : ");
261 for (
unsigned int i = 0; i < strInput.length(); i++)
262 printf(
"%c", charInput[i]);
264 if (!dumpFileToStringWithoutCommands(
"ofsUAF_Shl_Data.dat", charOutput,
simCnt)) {
265 printf(
"### ERROR : Failed to set string from file \"ofsUAF_Shl_Data.dat\". \n");
268 __file_write(
"./hls_out.txt", charOutput, strInput.length());
269 printf(
"Output string: ");
270 for (
unsigned int i = 0; i < strInput.length(); i++)
271 printf(
"%c", charOutput[i]);
277 int rc1 = system(
"diff --brief -w -i -y ../../../../test/ofsUAF_Shl_Data.dat \
278 ../../../../test/verify_UAF_Shl_Data.dat");
281 printf(
"## Error : File \'ofsUAF_Shl_Data.dat\' does not match \'verify_UAF_Shl_Data.dat\'.\n");
283 printf(
"Output data in file \'ofsUAF_Shl_Data.dat\' verified.\n");
288 printf(
"#####################################################\n");
291 printf(
"## ERROR - TESTBENCH FAILED (RC=%d) !!! ##\n", nrErr);
293 printf(
"## SUCCESSFULL END OF TESTBENCH (RC=0) ##\n");
295 printf(
"#####################################################\n");
bool isCornerPresent(std::string str, std::string corner)
Check the presence of a given corner value at the begin and the end of a string.
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.
void uppercase(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 Uppercase Application directives.
stream< NetworkMetaStream > siUdp_meta("siUdp_meta")
int main(int argc, char **argv)
Main testbench of Hrris.
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")
stream< UdpWord > image_stream_from_uppercase("image_stream_from_uppercase")
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