![]() |
Belle II Software development
|
A class to use Signals for TRGCDC 3D tracker. More...
#include <JSignal.h>
Public Member Functions | |
TRGCDCJSignal () | |
Constructor. | |
TRGCDCJSignal (TRGCDCJSignalData *) | |
Copy constructor. | |
TRGCDCJSignal (int const &bitwidth, double const &value, double const &min, double const &max, int const &clock, TRGCDCJSignalData *) | |
Actual to integer constructor with clock. | |
TRGCDCJSignal (int const &bitwidth, double const &value, double const &min, double const &max, TRGCDCJSignalData *) | |
Actual to integer constructor with clock set to 0. | |
TRGCDCJSignal (signed long long const &intValue, double const &toReal, signed long long const &minInt, signed long long const &maxInt, double const &actual, double const &minActual, double const &maxActual, int const &finishClock, TRGCDCJSignalData *, bool b_slv=0) | |
Integer constructor. | |
TRGCDCJSignal (double const &value, double const &toReal, TRGCDCJSignalData *) | |
Constant constructor. | |
TRGCDCJSignal (std::vector< bool > const &slvValue, int const &finishClock, TRGCDCJSignalData *) | |
Slv constructor. | |
~TRGCDCJSignal () | |
Destructor. | |
TRGCDCJSignal & | assignTo (TRGCDCJSignal const &rhs, int targetClock, std::string &finalCode) |
Assign operator with setting target clock with outputting final code. | |
TRGCDCJSignal & | assignTo (TRGCDCJSignal const &rhs, int targetClock) |
Assign operator with setting target clock. | |
TRGCDCJSignal & | operator<= (TRGCDCJSignal const &rhs) |
Assign operator. | |
TRGCDCJSignal const | operator- () const |
Unary operator. | |
TRGCDCJSignal const | operator+ (TRGCDCJSignal const &rhs) const |
Arithmetic add operator. | |
TRGCDCJSignal const | operator- (TRGCDCJSignal const &rhs) const |
Arithmetic minus operator. | |
TRGCDCJSignal const | operator* (TRGCDCJSignal const &rhs) const |
Arithmetic multiply operator. | |
void | dump () const |
Methods. | |
TRGCDCJSignal const | shift (int nBits, int operate=1) const |
Shift signal. Shift direction is right. operate=0 to change m_toReal(unit). | |
TRGCDCJSignal const | offset (TRGCDCJSignal const &valueMin) const |
Outputs an offset signal which is an unsigned signal. | |
TRGCDCJSignal const | invOffset (TRGCDCJSignal const &valueMin) const |
Outputs a signal that is not offset. | |
TRGCDCJSignal const | limit (signed long long minInt, signed long long maxInt, double minActual, double maxActual) const |
Limits min and max values using specific integers. Use only for ifElse. Doesn't check overflow, underflow to be used in ifElse. | |
TRGCDCJSignal const | limit (TRGCDCJSignal const &min, TRGCDCJSignal const &max) const |
Limits min and max values using JSignal. Use only for ifElse. Doesn't check overflow, underflow to be used in ifElse. | |
TRGCDCJSignal const | resize (int bitwidth) const |
Resizes signal. | |
void | setName (const std::string &name) |
Setters, Getters Sets name of signal. | |
void | setInt (signed long long value) |
Sets integer value of signal. | |
void | setActual (double value) |
Sets float value of signal. | |
void | setToReal (double value) |
Sets toReal factor of signal. | |
void | setType (int type) |
Sets type of signal. | |
void | setBitsize (int bitsize) |
Sets bitwidth of signal. | |
void | setFinishClock (int finishClock) |
Sets finish clock of signal. | |
void | setDebug (bool debug) |
Sets debug flag for signal. | |
void | setPrintVhdl (bool printVhdl) |
Sets print flag for signal. | |
void | setVhdlOutputFile (const std::string &filename) |
Sets output VHDL filename. | |
void | setCommonData (TRGCDCJSignalData *) |
Sets JSignalData to signal. | |
std::string | getName () const |
Get name of signal. | |
int | getType () const |
Get type of signal. | |
double | getBitsize () const |
Get bitwidth of signal. | |
signed long long | getInt () const |
Get integer value of signal. | |
signed long long | getMinInt () const |
Get minimum integer value of signal. | |
signed long long | getMaxInt () const |
Get maximum integer value of signal. | |
double | getActual () const |
Get float value of signal. | |
double | getMinActual () const |
Get minimum float value of signal. | |
double | getMaxActual () const |
Get maximum float value of signal. | |
double | getRealInt () const |
Get converted float value of integer. | |
double | getRealMinInt () const |
Get converted float value of minimum integer. | |
double | getRealMaxInt () const |
Get converted float value of maximum integer. | |
double | getToReal () const |
Get toReal value of signal. | |
int | getFinishClock () const |
Gets clock tick where signal is make. | |
std::vector< std::pair< std::string, std::vector< int > > > const | getArgumentSignals () const |
Gets the signal names and values that made this signal. | |
TRGCDCJSignalData * | getCommonData () const |
Get the sharged JSignalData. | |
int | calType () const |
Calculated what type the signal is. | |
int | calType (double minValue) const |
Calculated the type using the argument. | |
int | calBitwidth () const |
Calculates the bit width. | |
int | calBitwidth (int type, signed long long minInt, signed long long maxInt) |
Calculates the bit width using the arguments. | |
int | calFinishClock () const |
Calculates the clock tick where the signal is valid. | |
std::string | getVhdlCode () const |
Gets the vhdl code for the signal. | |
bool | getPrintVhdl () const |
Gets the print vhdl flag from common JSignalData class. | |
std::string | getVhdlOutputFile () const |
Gets the vhdl output file name. | |
void | matchUnit (TRGCDCJSignal &first, TRGCDCJSignal &second) const |
Utilities. | |
void | swap (TRGCDCJSignal &first, TRGCDCJSignal &second) const |
Swaps the TRGCDCJSignals. | |
bool | orderLargestBitsize (TRGCDCJSignal &large, TRGCDCJSignal &small) const |
Orders the TRGCDCJSignals by bitsize. Next priority is unsigned, signed, minus unsigned. 1: was swapped. 0: was not swapped. | |
signed long long | calMaxInteger () const |
Calculate max value for a binary number. | |
signed long long | calMinInteger () const |
Calculate min value for a binary number. | |
void | initArgumentSignals () |
Initializes the argument signals for the signal. | |
void | initVhdlCode () |
Initializes the vhdl code. | |
void | toSignedVhdlCode () |
Changes signal type to signed type in VHDL. | |
void | toUnsignedVhdlCode () |
Changes signal type to unsigned type in VHDL. | |
void | printVhdl (const std::string &vhdlCode) const |
Prints vhdl code. | |
void | checkInt (const std::string &name) const |
Checks underflow or overflow for TRGCDCJSignal. | |
Static Public Member Functions | |
static void | choose (TRGCDCJSignal &target, TRGCDCJSignal const &targetMin, TRGCDCJSignal const &targetMax, TRGCDCJSignal const &reference, std::vector< std::vector< TRGCDCJSignal > > data, int targetClock) |
Case method. | |
static void | choose (TRGCDCJSignal &target, TRGCDCJSignal const &targetMin, TRGCDCJSignal const &targetMax, TRGCDCJSignal const &reference, const std::vector< std::vector< TRGCDCJSignal > > &data) |
Chooes method. Also has input for target min and target max signal. | |
static void | choose (TRGCDCJSignal &target, TRGCDCJSignal const &reference, const std::vector< std::vector< TRGCDCJSignal > > &data, int targetClock) |
Choose with target clock. | |
static void | choose (TRGCDCJSignal &target, TRGCDCJSignal const &reference, const std::vector< std::vector< TRGCDCJSignal > > &data) |
Choose method. | |
static void | ifElse (std::vector< std::pair< TRGCDCJSignal, std::vector< std::pair< TRGCDCJSignal *, TRGCDCJSignal > > > > &data, int targetClock) |
If else implementation with target clock. | |
static void | ifElse (std::vector< std::pair< TRGCDCJSignal, std::vector< std::pair< TRGCDCJSignal *, TRGCDCJSignal > > > > &data) |
If else implementation. | |
static TRGCDCJSignal const | toSlv (TRGCDCJSignal const &in, int test) |
Change signal to std_logic_vector using vector<bool>. (Will be deprecated.) | |
static TRGCDCJSignal const | toSlv (TRGCDCJSignal const &) |
Change signal to std_logic_vector. | |
static TRGCDCJSignal const | slvToSigned (TRGCDCJSignal const &in, double const &toReal, signed long long const &minInt, signed long long const &maxInt, double const &actual, double const &minActual, double const &maxActual, int const &finishClock) |
Change slv to signed with target clock. | |
static TRGCDCJSignal const | slvToSigned (TRGCDCJSignal const &in) |
Change slv to signed. | |
static TRGCDCJSignal const | slvToUnsigned (TRGCDCJSignal const &in, double const &toReal, signed long long const &minInt, signed long long const &maxInt, double const &actual, double const &minActual, double const &maxActual, int const &finishClock) |
Change slv to unsigned with target clock. | |
static TRGCDCJSignal const | slvToUnsigned (TRGCDCJSignal const &in) |
Change slv to unsigned with target clock. | |
static TRGCDCJSignal const | signedToSlv (TRGCDCJSignal const &in) |
Change signed to slv. | |
static TRGCDCJSignal const | unsignedToSlv (TRGCDCJSignal const &in) |
Change unsigned to slv. | |
static TRGCDCJSignal | comp (TRGCDCJSignal const &lhs, const std::string &operate, TRGCDCJSignal const &rhs) |
Compare two signals. | |
static TRGCDCJSignal const | absolute (TRGCDCJSignal const &first) |
Absolute TRGCDCJSignal. Removes 1 bit if signed or minus unsigned. | |
static signed long long | calInt (double value, TRGCDCJSignal const &mother) |
Calculates integer value with unit of a TRGCDCJSignal. | |
static void | calVhdlTypeBitwidth (TRGCDCJSignal const &first, const std::string &operation, TRGCDCJSignal const &second, int &type, int &bitwidth) |
Calculates vhdl bitwidth and type for operation. | |
static void | combineArguments (TRGCDCJSignal const &first, TRGCDCJSignal const &second, TRGCDCJSignal &result) |
Combines arguments of signals. | |
static void | vhdlCode (TRGCDCJSignal const &first, const std::string &operation, TRGCDCJSignal const &second, TRGCDCJSignal const &result, std::string &targtVhdlCode) |
Writes vhdl code using two signals. | |
static void | vhdlCode (const std::string &operation, TRGCDCJSignal const &first, TRGCDCJSignal const &result, std::string &targetVhdlCode) |
Writes vhdl code using one signal. | |
static std::string | replaceWithSignalNames (std::string const &fromVhdlCode, std::vector< std::pair< std::string, std::vector< int > > > const &fromVhdlSignals, int const &finishClock, std::map< std::string, std::vector< int > > &buffers) |
Writes final vhdl code. | |
static std::string | assignVhdlCode (TRGCDCJSignal const &target, TRGCDCJSignal const &from) |
Writes the assign vhdl code. | |
static std::string | chooseVhdlCode (TRGCDCJSignal const &target, TRGCDCJSignal const &reference, std::vector< std::vector< TRGCDCJSignal > > const &data) |
Writes the choose vhdl code. | |
static std::string | ifElseVhdlCode (std::vector< std::pair< TRGCDCJSignal, std::vector< std::pair< TRGCDCJSignal *, TRGCDCJSignal > > > > const &data) |
Writes the ifElse vhdl code. | |
static bool | isSameSignal (TRGCDCJSignal const &lhs, TRGCDCJSignal const &rhs) |
Checks if signal is same signal. | |
static void | valuesToMapSignals (std::vector< std::tuple< std::string, double, int, double, double, int > > const &inValues, Belle2::TRGCDCJSignalData *inCommonData, std::map< std::string, Belle2::TRGCDCJSignal > &outMap) |
Values => [name, value, bitwidth, min, max, clock] Changes values to signals. | |
static void | mapSignalsToValues (std::map< std::string, Belle2::TRGCDCJSignal >const &inMap, std::vector< std::pair< std::string, int > > const &inChoose, std::vector< std::tuple< std::string, double, int, double, double, int > > &outValues) |
Choose => [signalName, FpgaEffects(=1)/NoFpgaEffects(=0)] Values => [name, value, bitwidth, min, max, clock] Changes signals to values. | |
Private Attributes | |
std::string | m_name |
Members. | |
int | m_type |
Type of signal. | |
int | m_bitsize |
+1: unsigned. | |
signed long long | m_int |
integer value of signal. | |
std::vector< bool > | m_slv |
storage for std_logic_vector. (Will be deprecated.) | |
signed long long | m_minInt |
The minimum integer value. | |
signed long long | m_maxInt |
The maximum integer value. | |
double | m_actual |
The float value. | |
double | m_minActual |
The minimum float value. | |
double | m_maxActual |
The maximum float value. | |
double | m_toReal |
The toReal value. | |
bool | m_debug |
The debug flag. | |
std::string | m_vhdlCode |
Holds the vhdl code. | |
std::vector< std::pair< std::string, std::vector< int > > > | m_argumentSignals |
vector<int> is {type, bitwidth, clock} Holds the arguments that made the signal. | |
int | m_finishClock |
Holds the clock tick when the signal is valid. | |
TRGCDCJSignalData * | m_commonData |
The common JSignalData. | |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |