CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
trklet::VarTimesC Class Reference

#include <imath.h>

Inheritance diagram for trklet::VarTimesC:
trklet::VarBase

Public Member Functions

void local_calculate () override
 
void print (std::ofstream &fs, HLS, int l1=0, int l2=0, int l3=0) override
 
void print (std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
 
 VarTimesC (imathGlobals *globals, std::string name, VarBase *p1, double cF, int ps=17)
 
 ~VarTimesC () override=default
 
- Public Member Functions inherited from trklet::VarBase
void add_cut (VarCut *cut, const bool call_set_cut_var=true)
 
void add_delay (int i)
 
void add_latency (unsigned int l)
 
void analyze ()
 
bool calculate ()
 
bool calculate (int debug_level)
 
VarBasecut_var ()
 
std::string dump ()
 
void dump_msg ()
 
double fval () const
 
bool has_delay (int i)
 
void inputs (std::vector< VarBase * > *vd)
 
long int ival () const
 
double K () const
 
std::map< std::string, int > Kmap () const
 
std::string kstring () const
 
int latency () const
 
bool local_passes () const
 
void makeready ()
 
double maxval () const
 
double minval () const
 
std::string name () const
 
int nbits () const
 
std::string op () const
 
VarBasep1 () const
 
VarBasep2 () const
 
VarBasep3 () const
 
void passes (std::map< const VarBase *, std::vector< bool > > &passes, const std::map< const VarBase *, std::vector< bool > > *const previous_passes=nullptr) const
 
int pipe_counter ()
 
std::string pipe_delays (const int step)
 
void pipe_increment ()
 
void print_all (std::ofstream &fs, HLS)
 
void print_all (std::ofstream &fs, Verilog)
 
void print_cuts (std::map< const VarBase *, std::set< std::string > > &cut_strings, const int step, HLS, const std::map< const VarBase *, std::set< std::string > > *const previous_cut_strings=nullptr) const
 
void print_cuts (std::map< const VarBase *, std::set< std::string > > &cut_strings, const int step, Verilog, const std::map< const VarBase *, std::set< std::string > > *const previous_cut_strings=nullptr) const
 
void print_step (int step, std::ofstream &fs, HLS)
 
void print_step (int step, std::ofstream &fs, Verilog)
 
void print_truncation (std::string &t, const std::string &o1, const int ps, HLS) const
 
void print_truncation (std::string &t, const std::string &o1, const int ps, Verilog) const
 
double range () const
 
void reset ()
 
int shift () const
 
int step () const
 
 VarBase (imathGlobals *globals, std::string name, VarBase *p1, VarBase *p2, VarBase *p3, int l)
 
virtual ~VarBase ()
 

Protected Attributes

double cF_
 
int cI_
 
int ps_
 
- Protected Attributes inherited from trklet::VarBase
VarBasecut_var_
 
std::vector< VarBase * > cuts_
 
double fval_
 
imathGlobalsglobals_
 
long int ival_
 
double K_
 
std::map< std::string, int > Kmap_
 
int latency_
 
double maxval_
 
double minval_
 
std::string name_
 
int nbits_
 
std::string op_
 
VarBasep1_
 
VarBasep2_
 
VarBasep3_
 
int pipe_counter_
 
std::vector< int > pipe_delays_
 
bool readytoanalyze_
 
bool readytoprint_
 
int step_
 
bool usedasinput_
 
double val_
 

Additional Inherited Members

- Static Public Member Functions inherited from trklet::VarBase
static void design_print (const std::vector< VarBase * > &v, std::ofstream &fs, HLS)
 
static void design_print (const std::vector< VarBase * > &v, std::ofstream &fs, Verilog)
 
static void hls_print (const std::vector< VarBase * > &v, std::ofstream &fs)
 
static std::string itos (int i)
 
static std::string pipe_delay (VarBase *v, int nbits, int delay)
 
static std::string pipe_delay_wire (VarBase *v, std::string name_delayed, int nbits, int delay)
 
static void verilog_print (const std::vector< VarBase * > &v, std::ofstream &fs)
 
- Static Public Attributes inherited from trklet::VarBase
static struct trklet::VarBase::HLS hls
 
static struct trklet::VarBase::Verilog verilog
 

Detailed Description

Definition at line 769 of file imath.h.

Constructor & Destructor Documentation

◆ VarTimesC()

trklet::VarTimesC::VarTimesC ( imathGlobals globals,
std::string  name,
VarBase p1,
double  cF,
int  ps = 17 
)
inline

Definition at line 771 of file imath.h.

772  : VarBase(globals, name, p1, nullptr, nullptr, MULT_LATENCY) {
773  op_ = "timesC";
774  cF_ = cF;
775  ps_ = ps;
776 
777  nbits_ = p1->nbits();
778  Kmap_ = p1->Kmap();
779  K_ = p1->K();
780 
781  int s1 = Kmap_["2"];
782  double l = log2(std::abs(cF));
783  if (l > 0)
784  l += 0.999999;
785  int m = l;
786 
787  cI_ = cF * pow(2, ps - m);
788  K_ = K_ * pow(2, m);
789  Kmap_["2"] = s1 + m;
790  }

References funct::abs(), cF_, cI_, trklet::VarBase::K(), trklet::VarBase::K_, trklet::VarBase::Kmap(), trklet::VarBase::Kmap_, cmsLHEtoEOSManager::l, visualization-live-secondInstance_cfg::m, trklet::VarBase::nbits(), trklet::VarBase::nbits_, trklet::VarBase::op_, trklet::VarBase::p1(), funct::pow(), and ps_.

◆ ~VarTimesC()

trklet::VarTimesC::~VarTimesC ( )
overridedefault

Member Function Documentation

◆ local_calculate()

void VarTimesC::local_calculate ( )
overridevirtual

Reimplemented from trklet::VarBase.

Definition at line 145 of file imath_calculate.cc.

145  {
146  fval_ = p1_->fval() * cF_;
147  ival_ = (p1_->ival() * cI_) >> ps_;
148 }

References cF_, cI_, trklet::VarBase::fval(), trklet::VarBase::fval_, trklet::VarBase::ival(), trklet::VarBase::ival_, trklet::VarBase::p1_, and ps_.

◆ print() [1/2]

void VarTimesC::print ( std::ofstream &  fs,
HLS  ,
int  l1 = 0,
int  l2 = 0,
int  l3 = 0 
)
overridevirtual

Reimplemented from trklet::VarBase.

Definition at line 187 of file imath_HLS.cc.

187  {
188  assert(p1_);
189  assert(l1 == 0);
190  assert(l2 == 0);
191  assert(l3 == 0);
192  std::string n1 = p1_->name();
193  std::string o1 = "(" + n1 + " * " + itos(cI_) + ")";
194 
195  std::string t = "";
197  fs << "// " << nbits_ << " bits \t " << kstring() << "\t" << K_ << "\n" << t;
198 }

References cms::cuda::assert(), cI_, trklet::VarBase::hls, trklet::VarBase::itos(), trklet::VarBase::K_, trklet::VarBase::kstring(), trklet::VarBase::name(), trklet::VarBase::nbits_, CastorDigiReco::o1, trklet::VarBase::p1_, trklet::VarBase::print_truncation(), ps_, AlCaHLTBitMon_QueryRunRegistry::string, and submitPVValidationJobs::t.

◆ print() [2/2]

void VarTimesC::print ( std::ofstream &  fs,
Verilog  ,
int  l1 = 0,
int  l2 = 0,
int  l3 = 0 
)
overridevirtual

Reimplemented from trklet::VarBase.

Definition at line 205 of file imath_Verilog.cc.

205  {
206  assert(p1_);
207  assert(l2 == 0);
208  assert(l3 == 0);
209  std::string n1 = p1_->name();
210  if (l1 > 0)
211  n1 = n1 + "_delay" + itos(l1);
212  std::string o1 = "(" + n1 + " * " + itos(cI_) + ")";
213 
214  std::string t = "";
216  fs << "// " << nbits_ << " bits \t " << kstring() << "\t" << K_ << "\n" << t;
217 }

References cms::cuda::assert(), cI_, trklet::VarBase::itos(), trklet::VarBase::K_, trklet::VarBase::kstring(), trklet::VarBase::name(), trklet::VarBase::nbits_, CastorDigiReco::o1, trklet::VarBase::p1_, trklet::VarBase::print_truncation(), ps_, AlCaHLTBitMon_QueryRunRegistry::string, submitPVValidationJobs::t, and trklet::VarBase::verilog.

Member Data Documentation

◆ cF_

double trklet::VarTimesC::cF_
protected

Definition at line 799 of file imath.h.

Referenced by local_calculate(), and VarTimesC().

◆ cI_

int trklet::VarTimesC::cI_
protected

Definition at line 798 of file imath.h.

Referenced by local_calculate(), print(), and VarTimesC().

◆ ps_

int trklet::VarTimesC::ps_
protected

Definition at line 797 of file imath.h.

Referenced by local_calculate(), print(), and VarTimesC().

trklet::VarBase::fval
double fval() const
Definition: imath.h:212
trklet::VarTimesC::ps_
int ps_
Definition: imath.h:797
trklet::VarBase::name
std::string name() const
Definition: imath.h:207
trklet::VarTimesC::cF_
double cF_
Definition: imath.h:799
cms::cuda::assert
assert(be >=bs)
trklet::VarBase::kstring
std::string kstring() const
Definition: imath.cc:18
trklet::VarBase::nbits
int nbits() const
Definition: imath.h:243
trklet::VarBase::p1_
VarBase * p1_
Definition: imath.h:297
trklet::VarTimesC::cI_
int cI_
Definition: imath.h:798
trklet::VarBase::verilog
static struct trklet::VarBase::Verilog verilog
trklet::VarBase::VarBase
VarBase(imathGlobals *globals, std::string name, VarBase *p1, VarBase *p2, VarBase *p3, int l)
Definition: imath.h:161
trklet::VarBase::p1
VarBase * p1() const
Definition: imath.h:209
trklet::VarBase::op_
std::string op_
Definition: imath.h:300
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
trklet::VarBase::Kmap
std::map< std::string, int > Kmap() const
Definition: imath.h:244
CastorDigiReco.o1
o1
Definition: CastorDigiReco.py:84
trklet::VarBase::itos
static std::string itos(int i)
Definition: imath.cc:16
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
trklet::VarBase::ival_
long int ival_
Definition: imath.h:305
trklet::VarBase::K
double K() const
Definition: imath.h:246
trklet::VarBase::ival
long int ival() const
Definition: imath.h:213
trklet::VarBase::Kmap_
std::map< std::string, int > Kmap_
Definition: imath.h:313
trklet::VarBase::hls
static struct trklet::VarBase::HLS hls
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
trklet::VarBase::print_truncation
void print_truncation(std::string &t, const std::string &o1, const int ps, Verilog) const
Definition: imath_Verilog.cc:10
trklet::VarBase::K_
double K_
Definition: imath.h:312
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
trklet::VarBase::nbits_
int nbits_
Definition: imath.h:311
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
MULT_LATENCY
#define MULT_LATENCY
Definition: imath.h:139
trklet::VarBase::fval_
double fval_
Definition: imath.h:304