cloudFPGA (cF) API
1.0
The documentation of the source code of cloudFPGA (cF)
|
This is a set of projects developed by IBM Research Zurich Lab. The group contains educational projects and platform-stressing ones. More...
Modules | |
Uppercase | |
This is the Uppercase educational example. The FPGA accepts a string and returns the upper-case converted one. | |
Memtest | |
This is the Memtest platform stressing project. The FPGA tests its DRAM memory. | |
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... | |
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< MemoryTestResult > | parseMemoryTestOutput (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... | |
bool | setInputDataStream (stream< UdpWord > &sDataStream, const string dataStreamName, const string inpFileName, int simCnt) |
Initialize an input data stream from a file. More... | |
void | unpack_ap_uint_64_ (ap_uint< 64 > value, ap_uint< 8 > *buffer) |
Unpack an ap_uint<64> word to an array of 8 x ap_uint<8>. More... | |
bool | getOutputDataStream (stream< UdpWord > &sDataStream, const string dataStreamName, const string outFileName, int simCnt) |
Fill an output file with data from an output stream. More... | |
bool | dumpStringToFile (const string s, const string outFileName, int simCnt) |
Fill an output file with data from an image. More... | |
bool | dumpStringToFileOnlyRawData (const string s, const string outFileName, int simCnt, size_t out_size) |
Fill an output file with data from an image. More... | |
bool | dumpStringToFileWithLastSetEveryGnoPackets (string s, const 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 string inpFileName, char *charOutput, int simCnt) |
Initialize an input data stream from a file. More... | |
template<unsigned int bytes_per_line = 8> | |
string | dumpFileToStringRawDataString (const string inpFileName, int *rawdatalines, size_t outputSize) |
Initialize an input data stream from a file with only data. More... | |
void | hex2ascii (const string &in, string &out) |
Convert a hexadecimal string to a ascii string FIXME: More... | |
void | ascii2hex (const string &in, string &out) |
Convert a ascii string to a hexadecimal string FIXME: More... | |
void | ascii2hexWithSize (const string &in, string &out, size_t bytesize) |
Convert a ascii string to a hexadecimal string FIXME: More... | |
bool | isCornerPresent (string str, 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 string &in, char *out, size_t byteSize) |
Convert a hex string to a integer into a char buffer with the SAME dimensions FIXME: More... | |
void | stringHex2Unsigned (const string &in, unsigned int *out, size_t byteSize) |
void | string2hexnumericsString (const string &in, string &out, size_t byteSize) |
Convert a hex string to a integer into a char buffer with the SAME dimensions FIXME: More... | |
template<unsigned int bytes_per_line = 8> | |
string | createMemTestCommands (unsigned long long int mem_address, unsigned int testingNumber, unsigned int burst_size) |
Create the commands for a memory test with start/max address to test-nop to execute-stop. More... | |
template<unsigned int bytes_per_line = 8> | |
string | createMemTestGoldenOutput (unsigned long long int mem_address, unsigned int testingNumber, bool with_bw_analysis) |
Create the expected output results for the memory test (with FAULT INJECTION) More... | |
void | reverseStr (string &str) |
reverse a given string More... | |
template<unsigned int bytes_per_line = 8> | |
std::vector< MemoryTestResult > | parseMemoryTestOutput (const string longbuf, size_t charOutputSize, int rawdatalines) |
Parse the memory test output contained in astring with a given size. More... | |
void | printStringHex (const string inStr, size_t strSize) |
print byte-per-byte a given string in hexadecimal format More... | |
This is a set of projects developed by IBM Research Zurich Lab. The group contains educational projects and platform-stressing ones.
#define DEBUG_LEVEL (TRACE_ALL) |
Definition at line 71 of file common.hpp.
#define DEBUG_TRACE true |
Definition at line 81 of file common.hpp.
#define DISABLED (ap_uint<1>)0 |
Definition at line 84 of file common.hpp.
#define ENABLED (ap_uint<1>)1 |
Definition at line 83 of file common.hpp.
#define KO false |
Definition at line 78 of file common.hpp.
#define OK true |
Definition at line 77 of file common.hpp.
#define THIS_NAME "TB" |
Definition at line 63 of file common.hpp.
#define TRACE_ALL 0xFFFF |
Definition at line 69 of file common.hpp.
#define TRACE_MMIO 1 << 3 |
Definition at line 68 of file common.hpp.
#define TRACE_OFF 0x0000 |
Definition at line 65 of file common.hpp.
#define TRACE_UAF 1 << 2 |
Definition at line 67 of file common.hpp.
#define TRACE_URIF 1 << 1 |
Definition at line 66 of file common.hpp.
#define UNVALID false |
Definition at line 80 of file common.hpp.
#define VALID true |
Definition at line 79 of file common.hpp.
void ascii2hex | ( | const std::string & | in, |
std::string & | out | ||
) |
Convert a ascii string to a hexadecimal string.
[in] | in | the input ascii string |
[out] | out | the output hexadecimal string |
void ascii2hex | ( | const string & | in, |
string & | out | ||
) |
Convert a ascii string to a hexadecimal string FIXME:
[in] | in | the input ascii string |
[out] | out | the output hexadecimal string |
Definition at line 574 of file common.cpp.
void ascii2hexWithSize | ( | const std::string & | in, |
std::string & | out, | ||
size_t | bytesize | ||
) |
Convert a ascii string to a hexadecimal string.
[in] | in | the input ascii string |
[out] | out | the output hexadecimal string |
[in] | bytesize | the input ascii string size |
void ascii2hexWithSize | ( | const string & | in, |
string & | out, | ||
size_t | bytesize | ||
) |
Convert a ascii string to a hexadecimal string FIXME:
[in] | in | the input ascii string |
[out] | out | the output hexadecimal string |
[in] | bytesize | the input ascii string size |
Definition at line 590 of file common.cpp.
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.
[in] | mem_address | max target address to test |
[in] | testingNumber | the number of tests to perform on the memory |
string createMemTestCommands | ( | unsigned long long int | mem_address, |
unsigned int | testingNumber, | ||
unsigned int | burst_size | ||
) |
Create the commands for a memory test with start/max address to test-nop to execute-stop.
[in] | mem_address | max target address to test |
[out] | out | the output string with start/max address-nops4trgtCCsNeeded-stop |
[in] | testingNumber | the number of tests to perform on the memory |
Definition at line 671 of file common.cpp.
std::string createMemTestGoldenOutput | ( | unsigned long long int | mem_address, |
int | testingNumber | ||
) |
Create the expected output results for the memory test (with FAULT INJECTION)
[in] | mem_address | max target address to test |
[in] | testingNumber | the number of tests to perform on the memory |
string createMemTestGoldenOutput | ( | unsigned long long int | mem_address, |
unsigned int | testingNumber, | ||
bool | with_bw_analysis | ||
) |
Create the expected output results for the memory test (with FAULT INJECTION)
[in] | mem_address | max target address to test |
[out] | out | the results of the memory test (with FAULT INJECTION) |
[in] | testingNumber | the number of tests to perform on the memory |
Definition at line 710 of file common.cpp.
std::string createUppercaseGoldenOutput | ( | std::string | input_string | ) |
Create the expected output results for the uppercase.
[in] | input_string | the input string of the uppercase |
Definition at line 815 of file common.cpp.
bool dumpDataToFile | ( | UdpWord * | udpWord, |
std::ofstream & | outFileStream | ||
) |
Dump a data word to a file.
[in] | udpWord,a | pointer to the data word to dump. |
[in] | outFileStream,the | output file stream to write to. |
bool dumpFileToString | ( | const std::string | inpFileName, |
std::string | strOutput, | ||
int | simCnt | ||
) |
Initialize an input data stream from a file.
[in] | inpFileName | the name of the input file to read from. |
[out] | strOutput | the output string to set. |
bool dumpFileToString | ( | const string | inpFileName, |
char * | charOutput, | ||
int | simCnt | ||
) |
Initialize an input data stream from a file.
[in] | inpFileName | the name of the input file to read from. |
[out] | strOutput | the output string to set. |
Definition at line 424 of file common.cpp.
std::string dumpFileToStringRawDataString | ( | const std::string | inpFileName, |
int * | rawdatalines, | ||
size_t | outputSize | ||
) |
Initialize an input data stream from a file with only data.
[in] | inpFileName | the name of the input file to read from. |
[out] | strOutput | the output string to set. |
string dumpFileToStringRawDataString | ( | const string | inpFileName, |
int * | rawdatalines, | ||
size_t | outputSize | ||
) |
Initialize an input data stream from a file with only data.
[in] | inpFileName | the name of the input file to read from. |
[out] | strOutput | the output string to set. |
Definition at line 481 of file common.cpp.
bool dumpStringToFile | ( | const string | s, |
const string | outFileName, | ||
int | simCnt | ||
) |
Fill an output file with data from an image.
[in] | sDataStream | the input image in xf::cv::Mat format. |
[in] | outFileName | the name of the output file to write to. |
Definition at line 222 of file common.cpp.
bool dumpStringToFile | ( | std::string | s, |
const std::string | outFileName, | ||
int | simCnt | ||
) |
Initialize an input data stream from a file.
[in] | inpFileName | the name of the input file to read from. |
[out] | strOutput | the output string to set. |
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.
[in] | sDataStream | the input image in xf::cv::Mat format. |
[in] | outFileName | the name of the output file to write to. |
bool dumpStringToFileOnlyRawData | ( | const string | s, |
const string | outFileName, | ||
int | simCnt, | ||
size_t | out_size | ||
) |
Fill an output file with data from an image.
[in] | sDataStream | the input image in xf::cv::Mat format. |
[in] | outFileName | the name of the output file to write to. |
Definition at line 292 of file common.cpp.
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.
[in] | sDataStream | the input image in xf::cv::Mat format. |
[in] | outFileName | the name of the output file to write to. |
[in] | simCnt | |
[in] | gno | the counter value at which this function set the tlast=1 |
bool dumpStringToFileWithLastSetEveryGnoPackets | ( | string | s, |
const string | outFileName, | ||
int | simCnt, | ||
int | gno | ||
) |
Fill an output file with data from a string and set the tlast every gno packets.
[in] | sDataStream | the input image in xf::cv::Mat format. |
[in] | outFileName | the name of the output file to write to. |
[in] | simCnt | |
[in] | gno | the counter value at which this function set the tlast=1 |
Definition at line 354 of file common.cpp.
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.
[in] | sDataStream,the | output data stream to set. |
[in] | dataStreamName,the | name of the data stream. |
[in] | outFileName,the | name of the output file to write to. |
bool getOutputDataStream | ( | stream< UdpWord > & | sDataStream, |
const string | dataStreamName, | ||
const string | outFileName, | ||
int | simCnt | ||
) |
Fill an output file with data from an output stream.
[in] | sDataStream,the | output data stream to set. |
[in] | dataStreamName,the | name of the data stream. |
[in] | outFileName,the | name of the output file to write to. |
Definition at line 176 of file common.cpp.
void hex2ascii | ( | const std::string & | in, |
std::string & | out | ||
) |
Convert a hexadecimal string to a ascii string.
[in] | in | the input hexadecimal string |
[out] | out | the output ascii string |
void hex2ascii | ( | const string & | in, |
string & | out | ||
) |
Convert a hexadecimal string to a ascii string FIXME:
[in] | in | the input hexadecimal string |
[out] | out | the output ascii string |
Definition at line 554 of file common.cpp.
unsigned char hexval | ( | unsigned char | c | ) |
convert a char to its hexadecimal representation.
[in] | c | the standard char value to convert to hex |
Definition at line 537 of file common.cpp.
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.
[in] | str | the input string to be checked |
[in] | corner | the corner char to find |
bool isCornerPresent | ( | string | str, |
string | corner | ||
) |
Check the presence of a given corner value at the begin and the end of a string.
[in] | str | the input string to be checked |
[in] | corner | the corner char to find |
Definition at line 606 of file common.cpp.
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.
[in] | buffer | A pointer to an array of 8 x ap_uint<8> |
Definition at line 116 of file common.cpp.
std::vector<MemoryTestResult> parseMemoryTestOutput | ( | const std::string | longbuf, |
size_t | charOutputSize, | ||
int | rawdatalines | ||
) |
Parse the memory test output contained in astring with a given size.
[in] | longbuf | the buffer containing the output |
[in] | charOutputSize | the bytesize of the buffer |
[in] | rawdatalines | the number of lines in the given outbuf |
std::vector<MemoryTestResult> parseMemoryTestOutput | ( | const string | longbuf, |
size_t | charOutputSize, | ||
int | rawdatalines | ||
) |
Parse the memory test output contained in astring with a given size.
[in] | longbuf | the buffer containing the output |
[in] | charOutputSize | the bytesize of the buffer |
[in] | rawdatalines | the number of lines in the given outbuf |
Definition at line 855 of file common.cpp.
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.
[in] | size | the bytesize to print from ptr. |
[in] | ptr | the buffer pointer. |
Definition at line 1010 of file common.cpp.
void printCharBuffHex | ( | const char * | inStr, |
size_t | strSize | ||
) |
print byte-per-byte a given char buff in hexadecimal format
[in] | inStr | char buff to print |
[in] | strSize | bytsize to print (can be even less, NOT more ) |
Definition at line 990 of file common.cpp.
void printStringHex | ( | const std::string | inStr, |
size_t | strSize | ||
) |
print byte-per-byte a given string in hexadecimal format
[in] | inStr | string to print |
[in] | strSize | bytsize to print (can be even less, NOT more ) |
void printStringHex | ( | const string | inStr, |
size_t | strSize | ||
) |
print byte-per-byte a given string in hexadecimal format
[in] | inStr | string to print |
[in] | strSize | bytsize to print (can be even less, NOT more ) |
Definition at line 971 of file common.cpp.
void reverseStr | ( | std::string & | str | ) |
reverse a given string
[in] | str | the string to reverse. |
void reverseStr | ( | string & | str | ) |
reverse a given string
[in] | str | the string to reverse. |
Definition at line 835 of file common.cpp.
bool setInputDataStream | ( | stream< UdpWord > & | sDataStream, |
const std::string | dataStreamName, | ||
const std::string | inpFileName, | ||
int | simCnt | ||
) |
Initialize an input data stream from a file.
[in] | sDataStream | the input data stream to set. |
[in] | dataStreamName | the name of the data stream. |
[in] | inpFileName | the name of the input file to read from. |
bool setInputDataStream | ( | stream< UdpWord > & | sDataStream, |
const string | dataStreamName, | ||
const string | inpFileName, | ||
int | simCnt | ||
) |
Initialize an input data stream from a file.
[in] | sDataStream | the input data stream to set. |
[in] | dataStreamName | the name of the data stream. |
[in] | inpFileName | the name of the input file to read from. |
Definition at line 45 of file common.cpp.
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.
[in] | in | the input hex string |
[out] | out | the output numerical hexadec string string |
[in] | byteSize | the bytesize of the input string and the buffer, it assumes equal dimension |
void string2hexnumerics | ( | const string & | in, |
char * | out, | ||
size_t | byteSize | ||
) |
Convert a hex string to a integer into a char buffer with the SAME dimensions FIXME:
[in] | in | the input hex string |
[out] | out | the output numerical hexadec string string |
[in] | byteSize | the bytesize of the input string and the buffer, it assumes equal dimension |
Definition at line 630 of file common.cpp.
void string2hexnumericsString | ( | const string & | in, |
string & | out, | ||
size_t | byteSize | ||
) |
Convert a hex string to a integer into a char buffer with the SAME dimensions FIXME:
[in] | in | the input hex string |
[out] | out | the output numerical hexadec string string |
[in] | byteSize | the bytesize of the input string and the buffer, it assumes equal dimension |
Definition at line 652 of file common.cpp.
void stringHex2Unsigned | ( | const string & | in, |
unsigned int * | out, | ||
size_t | byteSize | ||
) |
Definition at line 638 of file common.cpp.
void unpack_ap_uint_64_ | ( | ap_uint< 64 > | value, |
ap_uint< 8 > * | buffer | ||
) |
Unpack an ap_uint<64> word to an array of 8 x ap_uint<8>.
[in] | buffer | A pointer to an ap_uint<64> word |
Definition at line 139 of file common.cpp.