Belle II Software development
TRGCDCJSignal Class Reference

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.
 
TRGCDCJSignalassignTo (TRGCDCJSignal const &rhs, int targetClock, std::string &finalCode)
 Assign operator with setting target clock with outputing final code.
 
TRGCDCJSignalassignTo (TRGCDCJSignal const &rhs, int targetClock)
 Assign operator with setting target clock.
 
TRGCDCJSignaloperator<= (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 ouptut 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.
 
TRGCDCJSignalDatagetCommonData () 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
 Claculates 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 singal 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
 Memebers.
 
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.
 
TRGCDCJSignalDatam_commonData
 The common JSignalData.
 

Detailed Description

A class to use Signals for TRGCDC 3D tracker.

Definition at line 35 of file JSignal.h.

Constructor & Destructor Documentation

◆ ~TRGCDCJSignal()

~TRGCDCJSignal ( )
inline

Destructor.

Definition at line 57 of file JSignal.h.

57{}

Member Data Documentation

◆ m_actual

double m_actual
private

The float value.

Definition at line 290 of file JSignal.h.

◆ m_argumentSignals

std::vector<std::pair<std::string, std::vector<int> > > m_argumentSignals
private

vector<int> is {type, bitwidth, clock} Holds the arguments that made the signal.

Definition at line 303 of file JSignal.h.

◆ m_bitsize

int m_bitsize
private

+1: unsigned.

-1: unsigned. Bitwidth of signal.

Definition at line 280 of file JSignal.h.

◆ m_commonData

TRGCDCJSignalData* m_commonData
private

The common JSignalData.

Definition at line 308 of file JSignal.h.

◆ m_debug

bool m_debug
private

The debug flag.

Definition at line 298 of file JSignal.h.

◆ m_finishClock

int m_finishClock
private

Holds the clock tick when the signal is valid.

Definition at line 305 of file JSignal.h.

◆ m_int

signed long long m_int
private

integer value of signal.

Definition at line 282 of file JSignal.h.

◆ m_maxActual

double m_maxActual
private

The maximum float value.

Definition at line 294 of file JSignal.h.

◆ m_maxInt

signed long long m_maxInt
private

The maximum integer value.

Definition at line 288 of file JSignal.h.

◆ m_minActual

double m_minActual
private

The minimum float value.

Definition at line 292 of file JSignal.h.

◆ m_minInt

signed long long m_minInt
private

The minimum integer value.

Definition at line 286 of file JSignal.h.

◆ m_name

std::string m_name
private

Memebers.

Name of signal

Definition at line 276 of file JSignal.h.

◆ m_slv

std::vector<bool> m_slv
private

storage for std_logic_vector. (Will be deprecated.)

Definition at line 284 of file JSignal.h.

◆ m_toReal

double m_toReal
private

The toReal value.

Definition at line 296 of file JSignal.h.

◆ m_type

int m_type
private

Type of signal.

Definition at line 278 of file JSignal.h.

◆ m_vhdlCode

std::string m_vhdlCode
private

Holds the vhdl code.

Definition at line 300 of file JSignal.h.


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