cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
common.hpp
Go to the documentation of this file.
1 
17 
30 #ifndef _TEST_COMMON_H_
31 #define _TEST_COMMON_H_
32 
33 
34 #include <stdio.h>
35 #include <string>
36 #include <hls_stream.h>
37 #include <sys/stat.h>
38 #include "../../../../../HOST/quantitative_finance/mceuropeanengine/languages/cplusplus/include/config.h"
39 #include "../../mceuropeanengine/include/mceuropeanengine.hpp"
40 
41 
42 //---------------------------------------------------------
43 // HELPERS FOR THE DEBUGGING TRACES
44 // .e.g: DEBUG_LEVEL = (MDL_TRACE | IPS_TRACE)
45 //---------------------------------------------------------
46 #define THIS_NAME "TB"
47 
48 #define TRACE_OFF 0x0000
49 #define TRACE_URIF 1 << 1
50 #define TRACE_UAF 1 << 2
51 #define TRACE_MMIO 1 << 3
52 #define TRACE_ALL 0xFFFF
53 
54 #define DEBUG_LEVEL (TRACE_ALL)
55 
56 
57 //------------------------------------------------------
58 //-- TESTBENCH DEFINES
59 //------------------------------------------------------
60 #define OK true
61 #define KO false
62 #define VALID true
63 #define UNVALID false
64 #define DEBUG_TRACE true
65 
66 #define ENABLED (ap_uint<1>)1
67 #define DISABLED (ap_uint<1>)0
68 
69 
70 
71 
72 
80 bool setInputDataStream(stream<UdpWord> &sDataStream, const std::string dataStreamName,
81  const std::string inpFileName, int simCnt);
82 
83 
84 
93 bool readDataStream(stream <UdpWord> &sDataStream, UdpWord *udpWord);
94 
95 
96 
102 ap_uint<64> pack_ap_uint_64_ (ap_uint<8> *buffer);
103 
104 
105 
112 bool dumpDataToFile(UdpWord *udpWord, std::ofstream &outFileStream);
113 
114 
115 
122 bool dumpFileToString(const std::string inpFileName, std::string strOutput, int simCnt);
123 
124 
125 
133 bool getOutputDataStream(stream<UdpWord> &sDataStream,
134  const std::string dataStreamName, const std::string outFileName, int simCnt);
135 
136 
143 bool dumpStructToFile(varin *s, const std::string outFileName, int simCnt);
144 
145 static inline unsigned int
146 readFileConfigToStruct(const char *fname, varin *instruct);
147 
148 #endif
149 
int simCnt
Definition: tb_fmc.cpp:113
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.
Definition: common.cpp:116
bool dumpFileToString(const std::string inpFileName, std::string strOutput, int simCnt)
Initialize an input data stream from a file.
bool setInputDataStream(stream< UdpWord > &sDataStream, const std::string dataStreamName, const std::string inpFileName, int simCnt)
Initialize an input data stream from a file.
bool readDataStream(stream< UdpWord > &sDataStream, UdpWord *udpWord)
Read data from a stream.
Definition: common.cpp:103
bool dumpDataToFile(UdpWord *udpWord, std::ofstream &outFileStream)
Dump a data word to a file.
bool getOutputDataStream(stream< UdpWord > &sDataStream, const std::string dataStreamName, const std::string outFileName, int simCnt)
Fill an output file with data from an output stream.
bool dumpStructToFile(varin *s, const std::string outFileName, int simCnt)
Fill an output file with data from an output stream.
Definition: config.h:85