cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
common.hpp File Reference
#include <stdio.h>
#include <string>
#include <hls_stream.h>
#include <sys/stat.h>
#include <cstdlib>
#include <cstring>
#include <string.h>
#include <bitset>
#include <bits/stdc++.h>
#include <typeinfo>
Include dependency graph for common.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MemoryTestResult
 

Macros

#define THIS_NAME   "TB"
 
#define TRACE_OFF   0x0000
 
#define TRACE_URIF   1 << 1
 
#define TRACE_UAF   1 << 2
 
#define TRACE_MMIO   1 << 3
 
#define TRACE_ALL   0xFFFF
 
#define DEBUG_LEVEL   (TRACE_ALL)
 
#define OK   true
 
#define KO   false
 
#define VALID   true
 
#define UNVALID   false
 
#define DEBUG_TRACE   true
 
#define ENABLED   (ap_uint<1>)1
 
#define DISABLED   (ap_uint<1>)0
 

Functions

bool setInputDataStream (stream< UdpWord > &sDataStream, const std::string dataStreamName, const std::string inpFileName, int simCnt)
 Initialize an input data stream from a file. More...
 
bool readDataStream (stream< UdpWord > &sDataStream, UdpWord *udpWord)
 Read data from a stream. More...
 
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. More...
 
bool dumpDataToFile (UdpWord *udpWord, std::ofstream &outFileStream)
 Dump a data word to a file. More...
 
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. More...
 
bool dumpStringToFile (std::string s, const std::string outFileName, int simCnt)
 Initialize an input data stream from a file. More...
 
bool dumpStringToFileOnlyRawData (const std::string s, const std::string outFileName, int simCnt, size_t out_size)
 Fill an output file with data from an image. More...
 
bool dumpStringToFileWithLastSetEveryGnoPackets (std::string s, const std::string outFileName, int simCnt, int gno)
 Fill an output file with data from a string and set the tlast every gno packets. More...
 
bool dumpFileToString (const std::string inpFileName, std::string strOutput, int simCnt)
 Initialize an input data stream from a file. More...
 
template<unsigned int bytes_per_line = 8>
std::string dumpFileToStringRawDataString (const std::string inpFileName, int *rawdatalines, size_t outputSize)
 Initialize an input data stream from a file with only data. More...
 
unsigned char hexval (unsigned char c)
 convert a char to its hexadecimal representation. More...
 
void hex2ascii (const std::string &in, std::string &out)
 Convert a hexadecimal string to a ascii string. More...
 
void ascii2hex (const std::string &in, std::string &out)
 Convert a ascii string to a hexadecimal string. More...
 
void ascii2hexWithSize (const std::string &in, std::string &out, size_t bytesize)
 Convert a ascii string to a hexadecimal string. More...
 
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. More...
 
template<typename T >
void string2hexnumerics (const std::string &in, char *out, size_t byteSize)
 Convert a hex string to a T type into a char buffer with the SAME dimensions. More...
 
std::string createMemTestCommands (unsigned long long int mem_address, int testingNumber, unsigned int burst_size)
 Create the commands for a memory test with start/max address to test-nop to execute-stop. More...
 
std::string createMemTestGoldenOutput (unsigned long long int mem_address, int testingNumber)
 Create the expected output results for the memory test (with FAULT INJECTION) More...
 
std::string createUppercaseGoldenOutput (std::string input_string)
 Create the expected output results for the uppercase. More...
 
void reverseStr (std::string &str)
 reverse a given string More...
 
template<unsigned int bytes_per_line = 8>
std::vector< MemoryTestResultparseMemoryTestOutput (const std::string longbuf, size_t charOutputSize, int rawdatalines)
 Parse the memory test output contained in astring with a given size. More...
 
void printStringHex (const std::string inStr, size_t strSize)
 print byte-per-byte a given string in hexadecimal format More...
 
void printCharBuffHex (const char *inStr, size_t strSize)
 print byte-per-byte a given char buff in hexadecimal format More...
 
void printBits (size_t const size, void const *const ptr)
 print the binary representation of a target pointer buffer of a given size. Assumes little endian. More...