Belle II Software  release-05-02-19
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 (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, 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 9 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 53 of file FpgaUtility.cc.

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

◆ 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 195 of file FpgaUtility.cc.


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