Belle II Software  release-08-01-10
FpgaUtility.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #ifndef FPGAUTILITY_H
9 #define FPGAUTILITY_H
10 
11 #include <map>
12 #include <string>
13 #include <vector>
14 
16 class FpgaUtility {
17 
18 public:
19 
21  static double roundInt(double value);
24  static double arbToDouble(std::string in, int inRadix);
26  static std::string doubleToArb(double in, int outRadix, int numberOfDigits = -1);
28  static std::string arbToArb(const std::string& in, int inRadix, int outRadix, int numberOfDigits = -1);
30  static std::string signedToTwosComplement(std::string in, int numberOfDigits);
32  static std::string twosComplementToSigned(std::string in);
35  static void writeSignals(std::string outFilePath, std::map<std::string, std::vector<signed long long> >& data);
37  static void multipleWriteCoe(int lutInBitsize, std::map<std::string, std::vector<signed long long> >& data,
38  const std::string& fileDirectory);
40  static void writeCoe(std::string outFilePath, int lutInBitsize, std::vector<signed long long>& data);
42  static void readCoe(std::string inFilePath, std::vector<signed long long>& data, bool twoscomplement = 0);
43 
44 };
45 
46 #endif
A class that holds FPGA related functions.
Definition: FpgaUtility.h:16
static std::string doubleToArb(double in, int outRadix, int numberOfDigits=-1)
Change octal to string.
Definition: FpgaUtility.cc:82
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.
Definition: FpgaUtility.cc:229
static double arbToDouble(std::string in, int inRadix)
Radix changing functions.
Definition: FpgaUtility.cc:60
static void writeSignals(std::string outFilePath, std::map< std::string, std::vector< signed long long > > &data)
COE file functions.
Definition: FpgaUtility.cc:202
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.
Definition: FpgaUtility.cc:114
static std::string twosComplementToSigned(std::string in)
Changes string two complements to string signed binary(-sign).
Definition: FpgaUtility.cc:163
static double roundInt(double value)
Round double value.
Definition: FpgaUtility.cc:38
static std::string signedToTwosComplement(std::string in, int numberOfDigits)
Changes string signed binary(-sign) to two complements.
Definition: FpgaUtility.cc:120
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.
Definition: FpgaUtility.cc:220
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.
Definition: FpgaUtility.cc:251