Belle II Software  release-08-01-10
FpgaUtility Class Reference

A class that holds FPGA related functions. More...

#include <FpgaUtility.h>

Static Public Member Functions

static double roundInt (double value)
 Round double value.
 
static double arbToDouble (std::string in, int inRadix)
 Radix changing functions. More...
 
static std::string doubleToArb (double in, int outRadix, int numberOfDigits=-1)
 Change octal to string.
 
static std::string arbToArb (const std::string &in, int inRadix, int outRadix, int numberOfDigits=-1)
 Change string number to another string number depending on radix.
 
static std::string signedToTwosComplement (std::string in, int numberOfDigits)
 Changes string signed binary(-sign) to two complements.
 
static std::string twosComplementToSigned (std::string in)
 Changes string two complements to string signed binary(-sign).
 
static void writeSignals (std::string outFilePath, std::map< std::string, std::vector< signed long long > > &data)
 COE file functions. More...
 
static void multipleWriteCoe (int lutInBitsize, std::map< std::string, std::vector< signed long long > > &data, const std::string &fileDirectory)
 Writes multiple signal values to a file in coe format.
 
static void writeCoe (std::string outFilePath, int lutInBitsize, std::vector< signed long long > &data)
 Writes a signal's values to a file in coe format.
 
static void readCoe (std::string inFilePath, std::vector< signed long long > &data, bool twoscomplement=0)
 Reads a coe format file and stores the values in vector.
 

Detailed Description

A class that holds FPGA related functions.

Definition at line 16 of file FpgaUtility.h.

Member Function Documentation

◆ arbToDouble()

double arbToDouble ( std::string  in,
int  inRadix 
)
static

Radix changing functions.

Change string to octal. Possible radix=[2,26].

Definition at line 60 of file FpgaUtility.cc.

61 {
62  if (inRadix < 2 || inRadix > 26) {
63  cout << "[Error] arbToDouble() => Radix is out of range [2,26]. Aborting." << endl;
64  return 0;
65  }
66  double result = 0;
67  for (unsigned int iChar = 0; iChar < in.size(); iChar++) {
68  if (in[iChar] == '-') continue;
69  result = result * inRadix;
70  if (in[iChar] >= '0' && in[iChar] <= '9') result += in[iChar] - 48;
71  else if (in[iChar] >= 'A' && in[iChar] <= 'Z') result += in[iChar] - 55;
72  else if (in[iChar] >= 'a' && in[iChar] <= 'z') result += in[iChar] - 87;
73  else {
74  cout << "[Error] arbToDouble() => Strange character detected. Aborting." << endl;
75  return 0;
76  }
77  } // end of string loop.
78  if (in[0] == '-') result *= -1;
79  return result;
80 }

◆ writeSignals()

void writeSignals ( std::string  outFilePath,
std::map< std::string, std::vector< signed long long > > &  data 
)
static

COE file functions.

Writes values to a file.

Definition at line 202 of file FpgaUtility.cc.


The documentation for this class was generated from the following files: