CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes
trklet::VarBase Class Reference

#include <imath.h>

Inheritance diagram for trklet::VarBase:
trklet::VarAdd trklet::VarAdjustK trklet::VarAdjustKR trklet::VarCut trklet::VarDef trklet::VarDSPPostadd trklet::VarFlag trklet::VarInv trklet::VarMult trklet::VarNeg trklet::VarNounits trklet::VarParam trklet::VarShift trklet::VarShiftround trklet::VarSubtract trklet::VarTimesC

Classes

struct  HLS
 
struct  Verilog
 

Public Member Functions

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 (int debug_level)
 
bool calculate ()
 
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
 
virtual void local_calculate ()
 
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 ()
 
virtual void print (std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0)
 
virtual void print (std::ofstream &fs, HLS, int l1=0, int l2=0, int l3=0)
 
void print_all (std::ofstream &fs, Verilog)
 
void print_all (std::ofstream &fs, HLS)
 
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_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_step (int step, std::ofstream &fs, Verilog)
 
void print_step (int step, std::ofstream &fs, HLS)
 
void print_truncation (std::string &t, const std::string &o1, const int ps, Verilog) const
 
void print_truncation (std::string &t, const std::string &o1, const int ps, HLS) 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 ()
 

Static Public Member Functions

static void design_print (const std::vector< VarBase * > &v, std::ofstream &fs, Verilog)
 
static void design_print (const std::vector< VarBase * > &v, std::ofstream &fs, HLS)
 
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

static struct trklet::VarBase::HLS hls
 
static struct
trklet::VarBase::Verilog 
verilog
 

Protected Attributes

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_
 

Detailed Description

Definition at line 159 of file imath.h.

Constructor & Destructor Documentation

trklet::VarBase::VarBase ( imathGlobals globals,
std::string  name,
VarBase p1,
VarBase p2,
VarBase p3,
int  l 
)
inline

Definition at line 161 of file imath.h.

References cut_var_, cuts_, globals_, Kmap_, cmsLHEtoEOSManager::l, latency(), latency_, SiStripPI::max, maxval_, minval_, name(), name_, p1(), p1_, p2(), p2_, p3(), p3_, pipe_counter_, pipe_delays_, readytoanalyze_, readytoprint_, step(), step_, and usedasinput_.

161  {
162  globals_ = globals;
163  p1_ = p1;
164  p2_ = p2;
165  p3_ = p3;
166  name_ = name;
167  latency_ = l;
168  int step1 = (p1) ? p1->step() + p1->latency() : 0;
169  int step2 = (p2) ? p2->step() + p2->latency() : 0;
170  step_ = std::max(step1, step2);
171 
172  cuts_.clear();
173  cut_var_ = nullptr;
174 
175  pipe_counter_ = 0;
176  pipe_delays_.clear();
177 
180  readytoprint_ = true;
181  readytoanalyze_ = true;
182  usedasinput_ = false;
183  Kmap_.clear();
184  Kmap_["2"] = 0; // initially, zero shift
185 #ifdef IMATH_ROOT
186  h_ = 0;
187  h_nbins_ = 1024;
188  h_precision_ = 0.02;
189 #endif
190  }
int step() const
Definition: imath.h:250
int latency_
Definition: imath.h:301
VarBase * p1_
Definition: imath.h:297
VarBase * cut_var_
Definition: imath.h:309
imathGlobals * globals_
Definition: imath.h:295
VarBase * p2_
Definition: imath.h:298
std::vector< int > pipe_delays_
Definition: imath.h:316
VarBase * p3_
Definition: imath.h:299
VarBase * p1() const
Definition: imath.h:209
VarBase * p2() const
Definition: imath.h:210
int latency() const
Definition: imath.h:251
double minval_
Definition: imath.h:322
bool readytoprint_
Definition: imath.h:319
VarBase * p3() const
Definition: imath.h:211
int pipe_counter_
Definition: imath.h:315
std::string name() const
Definition: imath.h:207
std::vector< VarBase * > cuts_
Definition: imath.h:308
std::string name_
Definition: imath.h:296
std::map< std::string, int > Kmap_
Definition: imath.h:313
double maxval_
Definition: imath.h:323
bool readytoanalyze_
Definition: imath.h:318
bool usedasinput_
Definition: imath.h:320
virtual trklet::VarBase::~VarBase ( )
inlinevirtual

Definition at line 191 of file imath.h.

References globals_.

191  {
192 #ifdef IMATH_ROOT
193  if (globals_->h_file_) {
194  globals_->h_file_->ls();
195  globals_->h_file_->Close();
196  globals_->h_file_ = 0;
197  }
198 #endif
199  }
imathGlobals * globals_
Definition: imath.h:295

Member Function Documentation

void VarBase::add_cut ( VarCut cut,
const bool  call_set_cut_var = true 
)

Definition at line 359 of file imath.cc.

References cuts_, and trklet::VarCut::set_cut_var().

Referenced by trklet::IMATH_TrackletCalculator::IMATH_TrackletCalculator(), and trklet::VarCut::set_cut_var().

359  {
360  cuts_.push_back(cut);
361  if (call_set_cut_var)
362  cut->set_cut_var(this, false);
363 }
void set_cut_var(VarBase *cut_var, const bool call_add_cut=true)
Definition: imath.cc:365
std::vector< VarBase * > cuts_
Definition: imath.h:308
void trklet::VarBase::add_delay ( int  i)
inline

Definition at line 272 of file imath.h.

References pipe_delays_.

Referenced by pipe_delay().

272 { pipe_delays_.push_back(i); }
std::vector< int > pipe_delays_
Definition: imath.h:316
void trklet::VarBase::add_latency ( unsigned int  l)
inline

Definition at line 252 of file imath.h.

References cmsLHEtoEOSManager::l, and latency_.

252 { latency_ += l; } //only call before using the variable in calculation!
int latency_
Definition: imath.h:301
void VarBase::analyze ( )

Definition at line 29 of file imath.cc.

References analyze(), c, globals_, maxval_, minval_, name_, p1_, p2_, range(), and readytoanalyze_.

Referenced by analyze().

29  {
30  if (!readytoanalyze_)
31  return;
32 
33  double u = maxval_;
34  if (u < -minval_)
35  u = -minval_;
36 
37  int iu = log2(range() / u);
38  if (iu > 1) {
39  char slog[1024];
40  sprintf(slog,
41  "analyzing %s: range %g is much larger then %g. suggest cutting by a factor of 2^%i",
42  name_.c_str(),
43  range(),
44  u,
45  iu);
46  edm::LogVerbatim("Tracklet") << slog;
47  }
48 #ifdef IMATH_ROOT
49  char slog[100];
50  if (h_) {
51  double eff = h_->Integral() / h_->GetEntries();
52  if (eff < 0.99) {
53  sprintf(slog, "analyzing %s: range is too small, contains %f", name_.c_str(), eff);
54  edm::LogVerbatim("Tracklet") << slog;
55  h_->Print();
56  }
57  globals_->h_file_->cd();
58  TCanvas *c = new TCanvas();
59  c->cd();
60  h_->Draw("colz");
61  h_->Write();
62  } else {
63  if (globals_->use_root) {
64  sprintf(slog, "analyzing %s: no histogram!\n", name_.c_str());
65  edm::LogVerbatim("Tracklet") << slog;
66  }
67  }
68 #endif
69 
70  if (p1_)
71  p1_->analyze();
72  if (p2_)
73  p2_->analyze();
74 
75  readytoanalyze_ = false;
76 }
Log< level::Info, true > LogVerbatim
const edm::EventSetup & c
void analyze()
Definition: imath.cc:29
VarBase * p1_
Definition: imath.h:297
imathGlobals * globals_
Definition: imath.h:295
VarBase * p2_
Definition: imath.h:298
double range() const
Definition: imath.h:245
double minval_
Definition: imath.h:322
std::string name_
Definition: imath.h:296
double maxval_
Definition: imath.h:323
bool readytoanalyze_
Definition: imath.h:318
bool VarBase::calculate ( int  debug_level)

Definition at line 6 of file imath_calculate.cc.

References funct::abs(), calculate(), HLT_FULL_cff::debug_level, dump(), fval_, globals_, ival_, K_, local_calculate(), maxval_, minval_, name_, nbits_, op_, p1_, p2_, p3_, range(), AlCaHLTBitMon_QueryRunRegistry::string, tolerance, and val_.

Referenced by trklet::TrackletCalculatorBase::barrelSeeding(), calculate(), trklet::TrackletCalculatorBase::diskSeeding(), and trklet::TrackletCalculatorBase::overlapSeeding().

6  {
7  bool ok1 = true;
8  bool ok2 = true;
9  bool ok3 = true;
10 
11  if (p1_)
12  ok1 = p1_->calculate(debug_level);
13  if (p2_)
14  ok2 = p2_->calculate(debug_level);
15  if (p3_)
16  ok3 = p3_->calculate(debug_level);
17 
18  long int ival_prev = ival_;
20 
21  bool all_ok = ok1 && ok2 && ok3 && debug_level;
22 
23  if (fval_ > maxval_)
24  maxval_ = fval_;
25  if (fval_ < minval_)
26  minval_ = fval_;
27 #ifdef IMATH_ROOT
28  if (globals_->use_root) {
29  if (h_ == 0) {
30  globals_->h_file_->cd();
31  std::string hname = "h_" + name_;
32  h_ = (TH2F *)globals_->h_file_->Get(hname.c_str());
33  if (h_ == 0) {
34  h_precision_ = 0.5 * h_nbins_ * K_;
35  std::string st = name_ + ";fval;fval-ival*K";
36  h_ = new TH2F(hname.c_str(), name_.c_str(), h_nbins_, -range(), range(), h_nbins_, -h_precision_, h_precision_);
37  if (debug_level == 3)
38  edm::LogVerbatim("Tracklet") << " booking histogram " << hname;
39  }
40  }
41  if (ival_ != ival_prev || op_ == "def" || op_ == "const")
42  h_->Fill(fval_, K_ * ival_ - fval_);
43  }
44 #endif
45 
46  bool todump = false;
47  int nmax = sizeof(long int) * 8;
48  int ns = nmax - nbits_;
49  long int itest = ival_;
50  itest = itest << ns;
51  itest = itest >> ns;
52  if (itest != ival_) {
53  if (debug_level == 3 || (ival_ != ival_prev && all_ok)) {
54  edm::LogVerbatim("Tracklet") << "imath: truncated value mismatch!! " << ival_ << " != " << itest;
55  todump = true;
56  }
57  all_ok = false;
58  }
59 
60  val_ = ival_ * K_;
61  float ftest = val_;
62  float tolerance = 0.1 * std::abs(fval_);
63  if (tolerance < 2 * K_)
64  tolerance = 2 * K_;
65  if (std::abs(ftest - fval_) > tolerance) {
66  if (debug_level == 3 || (ival_ != ival_prev && (all_ok && (op_ != "inv" || debug_level >= 2)))) {
67  edm::LogVerbatim("Tracklet") << "imath: **GROSS** value mismatch!! " << fval_ << " != " << ftest;
68  if (op_ == "inv")
69  edm::LogVerbatim("Tracklet") << p1_->dump() << "\n-----------------------------------";
70  todump = true;
71  }
72  all_ok = false;
73  }
74 
75  if (todump)
76  edm::LogVerbatim("Tracklet") << dump();
77 
78  return all_ok;
79 }
Log< level::Info, true > LogVerbatim
double val_
Definition: imath.h:306
const double tolerance
VarBase * p1_
Definition: imath.h:297
bool calculate(int debug_level)
imathGlobals * globals_
Definition: imath.h:295
VarBase * p2_
Definition: imath.h:298
VarBase * p3_
Definition: imath.h:299
std::string op_
Definition: imath.h:300
virtual void local_calculate()
Definition: imath.h:255
double range() const
Definition: imath.h:245
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
long int ival_
Definition: imath.h:305
double minval_
Definition: imath.h:322
std::string name_
Definition: imath.h:296
double maxval_
Definition: imath.h:323
double K_
Definition: imath.h:312
std::string dump()
Definition: imath.cc:78
double fval_
Definition: imath.h:304
bool trklet::VarBase::calculate ( )
inline

Definition at line 254 of file imath.h.

References calculate().

Referenced by calculate().

254 { return calculate(0); }
bool calculate()
Definition: imath.h:254
VarBase * VarBase::cut_var ( )

Definition at line 388 of file imath.cc.

References cut_var_, and op_.

Referenced by trklet::VarFlag::passes(), trklet::VarFlag::print(), and trklet::VarCut::set_cut_var().

388  {
389  if (op_ == "cut")
390  return cut_var_;
391  else
392  return this;
393 }
VarBase * cut_var_
Definition: imath.h:309
std::string op_
Definition: imath.h:300
void VarBase::design_print ( const std::vector< VarBase * > &  v,
std::ofstream &  fs,
Verilog   
)
static

Definition at line 466 of file imath_Verilog.cc.

References mps_fire::i, inputs(), dqmiodumpmetadata::n, name(), nbits(), pipe_delay_wire(), print_all(), step(), AlCaHLTBitMon_QueryRunRegistry::string, and verilog.

Referenced by hls_print(), and verilog_print().

466  {
467  //step at which all the outputs should be valid
468  int maxstep = 0;
469 
470  //header of the module
471 
472  //inputs
473  std::vector<VarBase*> vd;
474  vd.clear();
475  int imax = v.size();
476  for (int i = 0; i < imax; ++i) {
477  (v[i])->inputs(&vd);
478  int step = v[i]->step() + v[i]->latency();
479  if (step > maxstep)
480  maxstep = step;
481  }
482 
483  //print header
484  fs << "module \n";
485  fs << "(\n";
486  fs << " input clk,\n";
487  fs << " input reset,\n\n";
488 
489  imax = vd.size();
490  for (int i = 0; i < imax; ++i)
491  fs << " input [" << (vd[i])->nbits() - 1 << ":0] " << (vd[i])->name() << "_wire,\n";
492  fs << "\n";
493 
494  imax = v.size() - 1;
495  for (int i = 0; i < imax; ++i)
496  if (v[i]->nbits() > 1)
497  fs << " output [" << (v[i])->nbits() - 1 << ":0] " << (v[i])->name() << "_wire,\n";
498  else
499  fs << " output " << (v[i])->name() << "_wire,\n";
500  if (imax >= 0) {
501  if (v[imax]->nbits() > 1)
502  fs << " output [" << (v[imax])->nbits() - 1 << ":0] " << (v[imax])->name() << "_wire\n";
503  else
504  fs << " output " << (v[imax])->name() << "_wire\n";
505  }
506  fs << ");\n\n";
507 
508  //body of the module
509  imax = v.size();
510  for (int i = 0; i < imax; ++i) {
511  fs << "\n//\n";
512  fs << "// calculating " << (v[i])->name() << "\n";
513  fs << "//\n";
514  (v[i])->print_all(fs, verilog);
515  }
516  fs << "\n";
517 
518  //trailer
519  fs << "\n";
520  fs << "\n//\n";
521  fs << "// wiring the outputs \n";
522  fs << "// latency = " << maxstep << "\n";
523  fs << "//\n";
524  for (int i = 0; i < imax; ++i) {
525  std::string n = v[i]->name() + "_wire";
526  int delay = maxstep - v[i]->step() - v[i]->latency();
527  if (delay == 0)
528  fs << "assign " << n << " = " << (v[i])->name() << ";\n";
529  else
530  fs << pipe_delay_wire(v[i], n, v[i]->nbits(), delay);
531  }
532 
533  fs << "endmodule\n";
534 }
int step() const
Definition: imath.h:250
void inputs(std::vector< VarBase * > *vd)
Definition: imath.cc:205
void print_all(std::ofstream &fs, Verilog)
static struct trklet::VarBase::Verilog verilog
int nbits() const
Definition: imath.h:243
std::vector< DeviationSensor2D * > vd
static std::string pipe_delay_wire(VarBase *v, std::string name_delayed, int nbits, int delay)
Definition: imath.cc:196
std::string name() const
Definition: imath.h:207
step
Definition: StallMonitor.cc:98
void VarBase::design_print ( const std::vector< VarBase * > &  v,
std::ofstream &  fs,
HLS   
)
static

Definition at line 355 of file imath_HLS.cc.

References hls, mps_fire::i, dqmiodumpmetadata::n, name(), nbits(), print_all(), and AlCaHLTBitMon_QueryRunRegistry::string.

355  {
356  //header of the module
357 
358  //inputs
359  std::vector<VarBase*> vd;
360  vd.clear();
361  int imax = v.size();
362  for (int i = 0; i < imax; ++i)
363  (v[i])->inputs(&vd);
364 
365  //print header
366  fs << "#include \"ap_int.h\"\n\n";
367  fs << "void XXX (\n";
368 
369  imax = vd.size();
370  for (int i = 0; i < imax; ++i)
371  fs << " const ap_int<" << (vd[i])->nbits() << "> " << (vd[i])->name() << "_wire,\n";
372  fs << "\n";
373 
374  imax = v.size() - 1;
375  for (int i = 0; i < imax; ++i)
376  fs << " ap_int<" << (v[i])->nbits() << "> * const " << (v[i])->name() << "_wire,\n";
377  if (imax >= 0)
378  fs << " ap_int<" << (v[imax])->nbits() << "> * const " << (v[imax])->name() << "_wire\n";
379  fs << ")\n{\n";
380  fs << "#pragma HLS pipeline II=1\n";
381  fs << "#pragma HLS latency max=25\n";
382 
383  //body of the module
384  imax = v.size();
385  for (int i = 0; i < imax; ++i) {
386  fs << "\n//\n";
387  fs << "// calculating " << (v[i])->name() << "\n";
388  fs << "//\n";
389  (v[i])->print_all(fs, hls);
390  }
391  fs << "\n";
392 
393  //trailer
394  fs << "\n";
395  fs << "\n//\n";
396  fs << "// wiring the outputs \n";
397  fs << "//\n";
398  for (int i = 0; i < imax; ++i) {
399  std::string n = v[i]->name() + "_wire";
400  fs << "*" << n << " = " << (v[i])->name() << ";\n";
401  }
402 
403  fs << "}\n";
404 }
void print_all(std::ofstream &fs, Verilog)
int nbits() const
Definition: imath.h:243
std::vector< DeviationSensor2D * > vd
static struct trklet::VarBase::HLS hls
std::string name() const
Definition: imath.h:207
std::string VarBase::dump ( void  )

Definition at line 78 of file imath.cc.

References fval_, ival_, K_, kstring(), name_, nbits_, op_, range(), alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and submitPVValidationJobs::t.

Referenced by calculate().

78  {
79  char s[1024];
80  std::string u = kstring();
81  sprintf(
82  s,
83  "Name = %s \t Op = %s \t nbits = %i \n ival = %li \t fval = %g \t K = %g Range = %f\n units = %s\n",
84  name_.c_str(),
85  op_.c_str(),
86  nbits_,
87  ival_,
88  fval_,
89  K_,
90  range(),
91  u.c_str());
92  std::string t(s);
93  return t;
94 }
std::string kstring() const
Definition: imath.cc:18
std::string op_
Definition: imath.h:300
double range() const
Definition: imath.h:245
long int ival_
Definition: imath.h:305
std::string name_
Definition: imath.h:296
double K_
Definition: imath.h:312
double fval_
Definition: imath.h:304
void VarBase::dump_msg ( )

Definition at line 96 of file imath.cc.

References dump_msg(), fval_, ival_, K_, kstring(), latency_, name_, nbits_, op_, p1_, p2_, range(), alignCSCRings::s, step_, AlCaHLTBitMon_QueryRunRegistry::string, and submitPVValidationJobs::t.

Referenced by dump_msg(), print_step(), trklet::VarAdd::VarAdd(), trklet::VarDSPPostadd::VarDSPPostadd(), and trklet::VarSubtract::VarSubtract().

96  {
97  char s[2048];
98  std::string u = kstring();
99  sprintf(s,
100  "Name = %s \t Op = %s \t nbits = %i \n ival = %li \t fval = %g \t K = %g Range = %f\n units = "
101  "%s\n step = %i, latency = %i\n",
102  name_.c_str(),
103  op_.c_str(),
104  nbits_,
105  ival_,
106  fval_,
107  K_,
108  range(),
109  u.c_str(),
110  step_,
111  latency_);
112  std::string t(s);
113  edm::LogVerbatim("Tracklet") << t;
114  if (p1_)
115  p1_->dump_msg();
116  if (p2_)
117  p2_->dump_msg();
118 }
Log< level::Info, true > LogVerbatim
int latency_
Definition: imath.h:301
VarBase * p1_
Definition: imath.h:297
std::string kstring() const
Definition: imath.cc:18
VarBase * p2_
Definition: imath.h:298
std::string op_
Definition: imath.h:300
double range() const
Definition: imath.h:245
void dump_msg()
Definition: imath.cc:96
long int ival_
Definition: imath.h:305
std::string name_
Definition: imath.h:296
double K_
Definition: imath.h:312
double fval_
Definition: imath.h:304
double trklet::VarBase::fval ( ) const
inline
bool VarBase::has_delay ( int  i)

Definition at line 165 of file imath.cc.

References pipe_delay(), and pipe_delays_.

Referenced by pipe_delay().

165  {
166  //dumb sequential search
167  for (int pipe_delay : pipe_delays_)
168  if (pipe_delay == i)
169  return true;
170  return false;
171 }
std::vector< int > pipe_delays_
Definition: imath.h:316
static std::string pipe_delay(VarBase *v, int nbits, int delay)
Definition: imath.cc:173
static void trklet::VarBase::hls_print ( const std::vector< VarBase * > &  v,
std::ofstream &  fs 
)
inlinestatic

Definition at line 275 of file imath.h.

References design_print(), and hls.

Referenced by trklet::TrackletCalculator::TrackletCalculator().

275 { design_print(v, fs, hls); }
static struct trklet::VarBase::HLS hls
static void design_print(const std::vector< VarBase * > &v, std::ofstream &fs, Verilog)
void VarBase::inputs ( std::vector< VarBase * > *  vd)

Definition at line 205 of file imath.cc.

References inputs(), op_, p1_, p2_, p3_, and usedasinput_.

Referenced by design_print(), and inputs().

205  {
206  if (op_ == "def" && !usedasinput_) {
207  usedasinput_ = true;
208  vd->push_back(this);
209  } else {
210  if (p1_)
211  p1_->inputs(vd);
212  if (p2_)
213  p2_->inputs(vd);
214  if (p3_)
215  p3_->inputs(vd);
216  }
217 }
void inputs(std::vector< VarBase * > *vd)
Definition: imath.cc:205
VarBase * p1_
Definition: imath.h:297
VarBase * p2_
Definition: imath.h:298
VarBase * p3_
Definition: imath.h:299
std::string op_
Definition: imath.h:300
std::vector< DeviationSensor2D * > vd
bool usedasinput_
Definition: imath.h:320
std::string VarBase::itos ( int  i)
static
long int trklet::VarBase::ival ( ) const
inline
double trklet::VarBase::K ( ) const
inline
std::map<std::string, int> trklet::VarBase::Kmap ( ) const
inline
std::string VarBase::kstring ( ) const
int trklet::VarBase::latency ( ) const
inline

Definition at line 251 of file imath.h.

References latency_.

Referenced by trklet::VarCut::print(), print_step(), and VarBase().

251 { return latency_; }
int latency_
Definition: imath.h:301
virtual void trklet::VarBase::local_calculate ( )
inlinevirtual
bool VarBase::local_passes ( ) const

Definition at line 315 of file imath.cc.

References GOODCOLL_filter_cfg::cut, cuts_, globals_, ival_, K_, trklet::VarCut::lower_cut(), name_, passes(), trklet::imathGlobals::printCutInfo_, and trklet::VarCut::upper_cut().

Referenced by trklet::TrackletCalculatorBase::barrelSeeding(), trklet::TrackletCalculatorBase::diskSeeding(), trklet::TrackletCalculatorBase::overlapSeeding(), and trklet::VarFlag::passes().

315  {
316  bool passes = false;
317  for (const auto &cut : cuts_) {
318  const VarCut *const cast_cut = (VarCut *)cut;
319  const int lower_cut = cast_cut->lower_cut() / K_;
320  const int upper_cut = cast_cut->upper_cut() / K_;
321  passes = passes || (ival_ > lower_cut && ival_ < upper_cut);
322  if (globals_->printCutInfo_) {
323  edm::LogVerbatim("Tracklet") << " " << name_ << " "
324  << ((ival_ > lower_cut && ival_ < upper_cut) ? "PASSES" : "FAILS")
325  << " (required: " << lower_cut * K_ << " < " << ival_ * K_ << " < " << upper_cut * K_
326  << ")";
327  }
328  }
329  return passes;
330 }
Log< level::Info, true > LogVerbatim
imathGlobals * globals_
Definition: imath.h:295
long int ival_
Definition: imath.h:305
double upper_cut() const
Definition: imath.h:1071
std::vector< VarBase * > cuts_
Definition: imath.h:308
std::string name_
Definition: imath.h:296
void passes(std::map< const VarBase *, std::vector< bool > > &passes, const std::map< const VarBase *, std::vector< bool > > *const previous_passes=nullptr) const
Definition: imath.cc:332
double K_
Definition: imath.h:312
double lower_cut() const
Definition: imath.h:1070
void VarBase::makeready ( )

Definition at line 151 of file imath.cc.

References makeready(), p1_, p2_, p3_, pipe_counter_, pipe_delays_, readytoanalyze_, readytoprint_, and usedasinput_.

Referenced by makeready().

151  {
152  pipe_counter_ = 0;
153  pipe_delays_.clear();
154  readytoprint_ = true;
155  readytoanalyze_ = true;
156  usedasinput_ = false;
157  if (p1_)
158  p1_->makeready();
159  if (p2_)
160  p2_->makeready();
161  if (p3_)
162  p3_->makeready();
163 }
VarBase * p1_
Definition: imath.h:297
VarBase * p2_
Definition: imath.h:298
std::vector< int > pipe_delays_
Definition: imath.h:316
VarBase * p3_
Definition: imath.h:299
bool readytoprint_
Definition: imath.h:319
int pipe_counter_
Definition: imath.h:315
void makeready()
Definition: imath.cc:151
bool readytoanalyze_
Definition: imath.h:318
bool usedasinput_
Definition: imath.h:320
double trklet::VarBase::maxval ( ) const
inline

Definition at line 230 of file imath.h.

References maxval_.

230 { return maxval_; }
double maxval_
Definition: imath.h:323
double trklet::VarBase::minval ( ) const
inline

Definition at line 229 of file imath.h.

References minval_.

229 { return minval_; }
double minval_
Definition: imath.h:322
std::string trklet::VarBase::name ( void  ) const
inline
int trklet::VarBase::nbits ( ) const
inline
std::string trklet::VarBase::op ( ) const
inline

Definition at line 208 of file imath.h.

References op_.

Referenced by trklet::VarFlag::add_cut(), and print_step().

208 { return op_; }
std::string op_
Definition: imath.h:300
VarBase* trklet::VarBase::p1 ( ) const
inline

Definition at line 209 of file imath.h.

References p1_.

Referenced by VarBase().

209 { return p1_; }
VarBase * p1_
Definition: imath.h:297
VarBase* trklet::VarBase::p2 ( ) const
inline

Definition at line 210 of file imath.h.

References p2_.

Referenced by VarBase().

210 { return p2_; }
VarBase * p2_
Definition: imath.h:298
VarBase* trklet::VarBase::p3 ( ) const
inline

Definition at line 211 of file imath.h.

References p3_.

Referenced by VarBase().

211 { return p3_; }
VarBase * p3_
Definition: imath.h:299
void VarBase::passes ( std::map< const VarBase *, std::vector< bool > > &  passes,
const std::map< const VarBase *, std::vector< bool > > *const  previous_passes = nullptr 
) const

Definition at line 332 of file imath.cc.

References GOODCOLL_filter_cfg::cut, cuts_, globals_, ival_, K_, trklet::VarCut::lower_cut(), name_, p1_, p2_, p3_, passes(), trklet::imathGlobals::printCutInfo_, and trklet::VarCut::upper_cut().

Referenced by local_passes(), trklet::VarCut::local_passes(), and passes().

333  {
334  if (p1_)
335  p1_->passes(passes, previous_passes);
336  if (p2_)
337  p2_->passes(passes, previous_passes);
338  if (p3_)
339  p3_->passes(passes, previous_passes);
340 
341  for (const auto &cut : cuts_) {
342  const VarCut *const cast_cut = (VarCut *)cut;
343  const int lower_cut = cast_cut->lower_cut() / K_;
344  const int upper_cut = cast_cut->upper_cut() / K_;
345  if (!previous_passes || (previous_passes && !previous_passes->count(this))) {
346  if (!passes.count(this))
347  passes[this];
348  passes.at(this).push_back(ival_ > lower_cut && ival_ < upper_cut);
349  if (globals_->printCutInfo_) {
350  edm::LogVerbatim("Tracklet") << " " << name_ << " "
351  << ((ival_ > lower_cut && ival_ < upper_cut) ? "PASSES" : "FAILS")
352  << " (required: " << lower_cut * K_ << " < " << ival_ * K_ << " < "
353  << upper_cut * K_ << ")";
354  }
355  }
356  }
357 }
Log< level::Info, true > LogVerbatim
VarBase * p1_
Definition: imath.h:297
imathGlobals * globals_
Definition: imath.h:295
VarBase * p2_
Definition: imath.h:298
VarBase * p3_
Definition: imath.h:299
long int ival_
Definition: imath.h:305
double upper_cut() const
Definition: imath.h:1071
std::vector< VarBase * > cuts_
Definition: imath.h:308
std::string name_
Definition: imath.h:296
void passes(std::map< const VarBase *, std::vector< bool > > &passes, const std::map< const VarBase *, std::vector< bool > > *const previous_passes=nullptr) const
Definition: imath.cc:332
double K_
Definition: imath.h:312
double lower_cut() const
Definition: imath.h:1070
int trklet::VarBase::pipe_counter ( )
inline

Definition at line 270 of file imath.h.

References pipe_counter_.

Referenced by pipe_delay_wire().

270 { return pipe_counter_; }
int pipe_counter_
Definition: imath.h:315
std::string VarBase::pipe_delay ( VarBase v,
int  nbits,
int  delay 
)
static

Definition at line 173 of file imath.cc.

References add_delay(), has_delay(), itos(), name(), submitPVResolutionJobs::out, pipe_delay_wire(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by has_delay(), pipe_delays(), and print_step().

173  {
174  //have we been delayed by this much already?
175  if (v->has_delay(delay))
176  return "";
177  v->add_delay(delay);
178  std::string name = v->name();
179  std::string name_delayed = name + "_delay" + itos(delay);
180  std::string out = "wire signed [" + itos(nbits - 1) + ":0] " + name_delayed + ";\n";
181  out = out + pipe_delay_wire(v, name_delayed, nbits, delay);
182  return out;
183 }
bool has_delay(int i)
Definition: imath.cc:165
int nbits() const
Definition: imath.h:243
static std::string itos(int i)
Definition: imath.cc:16
static std::string pipe_delay_wire(VarBase *v, std::string name_delayed, int nbits, int delay)
Definition: imath.cc:196
std::string name() const
Definition: imath.h:207
void add_delay(int i)
Definition: imath.h:272
std::string VarBase::pipe_delay_wire ( VarBase v,
std::string  name_delayed,
int  nbits,
int  delay 
)
static

Definition at line 196 of file imath.cc.

References itos(), name(), submitPVResolutionJobs::out, pipe_counter(), pipe_increment(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by design_print(), and pipe_delay().

196  {
197  std::string name = v->name();
198  std::string name_pipe = name + "_pipe" + itos(v->pipe_counter());
199  v->pipe_increment();
200  std::string out = "pipe_delay #(.STAGES(" + itos(delay) + "), .WIDTH(" + itos(nbits) + ")) " + name_pipe +
201  "(.clk(clk), .val_in(" + name + "), .val_out(" + name_delayed + "));\n";
202  return out;
203 }
void pipe_increment()
Definition: imath.h:271
int pipe_counter()
Definition: imath.h:270
int nbits() const
Definition: imath.h:243
static std::string itos(int i)
Definition: imath.cc:16
std::string name() const
Definition: imath.h:207
std::string VarBase::pipe_delays ( const int  step)

Definition at line 184 of file imath.cc.

References cmsLHEtoEOSManager::l, latency_, nbits(), submitPVResolutionJobs::out, p1_, p2_, p3_, pipe_delay(), pipe_delays(), step_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by pipe_delays().

184  {
185  std::string out = "";
186  if (p1_)
187  out += p1_->pipe_delays(step);
188  if (p2_)
189  out += p2_->pipe_delays(step);
190  if (p3_)
191  out += p3_->pipe_delays(step);
192 
193  int l = step - latency_ - step_;
194  return (out + pipe_delay(this, nbits(), l));
195 }
int latency_
Definition: imath.h:301
VarBase * p1_
Definition: imath.h:297
std::string pipe_delays(const int step)
Definition: imath.cc:184
VarBase * p2_
Definition: imath.h:298
VarBase * p3_
Definition: imath.h:299
int nbits() const
Definition: imath.h:243
static std::string pipe_delay(VarBase *v, int nbits, int delay)
Definition: imath.cc:173
step
Definition: StallMonitor.cc:98
void trklet::VarBase::pipe_increment ( )
inline

Definition at line 271 of file imath.h.

References pipe_counter_.

Referenced by pipe_delay_wire().

271 { pipe_counter_++; }
int pipe_counter_
Definition: imath.h:315
virtual void trklet::VarBase::print ( std::ofstream &  fs,
Verilog  ,
int  l1 = 0,
int  l2 = 0,
int  l3 = 0 
)
inlinevirtual

Reimplemented in trklet::VarFlag, trklet::VarInv, trklet::VarDSPPostadd, trklet::VarMult, trklet::VarTimesC, trklet::VarNeg, trklet::VarShift, trklet::VarShiftround, trklet::VarNounits, trklet::VarSubtract, trklet::VarAdd, trklet::VarDef, trklet::VarParam, trklet::VarAdjustKR, and trklet::VarAdjustK.

Definition at line 256 of file imath.h.

Referenced by print_step().

256  {
257  fs << "// VarBase here. Soemthing is wrong!! " << l1 << ", " << l2 << ", " << l3 << "\n";
258  }
virtual void trklet::VarBase::print ( std::ofstream &  fs,
HLS  ,
int  l1 = 0,
int  l2 = 0,
int  l3 = 0 
)
inlinevirtual

Reimplemented in trklet::VarFlag, trklet::VarInv, trklet::VarMult, trklet::VarTimesC, trklet::VarNeg, trklet::VarShift, trklet::VarShiftround, trklet::VarNounits, trklet::VarSubtract, trklet::VarAdd, trklet::VarDef, trklet::VarParam, trklet::VarAdjustKR, and trklet::VarAdjustK.

Definition at line 259 of file imath.h.

259  {
260  fs << "// VarBase here. Soemthing is wrong!! " << l1 << ", " << l2 << ", " << l3 << "\n";
261  }
void VarBase::print_all ( std::ofstream &  fs,
Verilog   
)

Definition at line 459 of file imath_Verilog.cc.

References mps_fire::i, print_step(), step_, and verilog.

Referenced by design_print().

459  {
460  for (int i = 0; i <= step_; ++i) {
461  fs << "//\n// STEP " << i << "\n\n";
462  print_step(i, fs, verilog);
463  }
464 }
void print_step(int step, std::ofstream &fs, Verilog)
static struct trklet::VarBase::Verilog verilog
void VarBase::print_all ( std::ofstream &  fs,
HLS   
)

Definition at line 348 of file imath_HLS.cc.

References hls, mps_fire::i, print_step(), and step_.

348  {
349  for (int i = 0; i <= step_; ++i) {
350  fs << "//\n// STEP " << i << "\n\n";
351  print_step(i, fs, hls);
352  }
353 }
void print_step(int step, std::ofstream &fs, Verilog)
static struct trklet::VarBase::HLS hls
void VarBase::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

Definition at line 44 of file imath_Verilog.cc.

References GOODCOLL_filter_cfg::cut, cuts_, itos(), K_, cmsLHEtoEOSManager::l, latency_, trklet::VarCut::lower_cut(), name(), name_, p1_, p2_, p3_, print_cuts(), step_, AlCaHLTBitMon_QueryRunRegistry::string, trklet::VarCut::upper_cut(), and verilog.

Referenced by print_cuts().

47  {
48  if (p1_)
49  p1_->print_cuts(cut_strings, step, verilog, previous_cut_strings);
50  if (p2_)
51  p2_->print_cuts(cut_strings, step, verilog, previous_cut_strings);
52  if (p3_)
53  p3_->print_cuts(cut_strings, step, verilog, previous_cut_strings);
54 
55  int l = step - latency_ - step_;
57  if (l > 0)
58  name += "_delay" + itos(l);
59 
60  for (const auto& cut : cuts_) {
61  const VarCut* const cast_cut = (VarCut*)cut;
62  const int lower_cut = cast_cut->lower_cut() / K_;
63  const int upper_cut = cast_cut->upper_cut() / K_;
64  if (!previous_cut_strings || (previous_cut_strings && !previous_cut_strings->count(this))) {
65  if (!cut_strings.count(this))
66  cut_strings[this];
67  cut_strings.at(this).insert(name + " > " + itos(lower_cut) + " && " + name + " < " + itos(upper_cut));
68  }
69  }
70 }
int latency_
Definition: imath.h:301
VarBase * p1_
Definition: imath.h:297
VarBase * p2_
Definition: imath.h:298
static struct trklet::VarBase::Verilog verilog
VarBase * p3_
Definition: imath.h:299
static std::string itos(int i)
Definition: imath.cc:16
double upper_cut() const
Definition: imath.h:1071
std::string name() const
Definition: imath.h:207
std::vector< VarBase * > cuts_
Definition: imath.h:308
std::string name_
Definition: imath.h:296
double K_
Definition: imath.h:312
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
step
Definition: StallMonitor.cc:98
double lower_cut() const
Definition: imath.h:1070
void VarBase::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

Definition at line 39 of file imath_HLS.cc.

References GOODCOLL_filter_cfg::cut, cuts_, hls, itos(), K_, trklet::VarCut::lower_cut(), name(), name_, p1_, p2_, p3_, print_cuts(), AlCaHLTBitMon_QueryRunRegistry::string, and trklet::VarCut::upper_cut().

42  {
43  if (p1_)
44  p1_->print_cuts(cut_strings, step, hls, previous_cut_strings);
45  if (p2_)
46  p2_->print_cuts(cut_strings, step, hls, previous_cut_strings);
47  if (p3_)
48  p3_->print_cuts(cut_strings, step, hls, previous_cut_strings);
49 
51 
52  for (const auto& cut : cuts_) {
53  const VarCut* const cast_cut = (VarCut*)cut;
54  const int lower_cut = cast_cut->lower_cut() / K_;
55  const int upper_cut = cast_cut->upper_cut() / K_;
56  if (!previous_cut_strings || (previous_cut_strings && !previous_cut_strings->count(this))) {
57  if (!cut_strings.count(this))
58  cut_strings[this];
59  cut_strings.at(this).insert(name + " > " + itos(lower_cut) + " && " + name + " < " + itos(upper_cut));
60  }
61  }
62 }
VarBase * p1_
Definition: imath.h:297
VarBase * p2_
Definition: imath.h:298
VarBase * p3_
Definition: imath.h:299
static std::string itos(int i)
Definition: imath.cc:16
static struct trklet::VarBase::HLS hls
double upper_cut() const
Definition: imath.h:1071
std::string name() const
Definition: imath.h:207
std::vector< VarBase * > cuts_
Definition: imath.h:308
std::string name_
Definition: imath.h:296
double K_
Definition: imath.h:312
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
step
Definition: StallMonitor.cc:98
double lower_cut() const
Definition: imath.h:1070
void VarBase::print_step ( int  step,
std::ofstream &  fs,
Verilog   
)

Definition at line 402 of file imath_Verilog.cc.

References cms::cuda::assert(), GOODCOLL_filter_cfg::cut, cuts_, dump_msg(), latency(), name_, nbits(), op(), op_, p1_, p2_, p3_, pipe_delay(), print(), print_step(), readytoprint_, step(), step_, and verilog.

Referenced by print_all(), and print_step().

402  {
403  if (!readytoprint_)
404  return;
405  if (step > step_)
406  return;
407  int l1 = 0;
408  int l2 = 0;
409  int l3 = 0;
410  if (p1_) {
412  l1 = step_ - p1_->latency() - p1_->step();
413  }
414  if (p2_) {
416  l2 = step_ - p2_->latency() - p2_->step();
417  }
418  if (p3_) {
420  l3 = step_ - p3_->latency() - p3_->step();
421  }
422  if (step == step_) {
423  if (l1 < 0 || l2 < 0 || l3 < 0 || (l1 > 0 && l2 > 0 && l3 > 0)) {
424  char slog[100];
425  sprintf(slog, "%s::print_step(%i): something wrong with latencies! %i %i %i\n", name_.c_str(), step, l1, l2, l3);
426  edm::LogVerbatim("Tracklet") << slog;
427  dump_msg();
428  assert(0);
429  }
430  if (l1 > 0) {
431  if (p1_->op() != "const")
432  fs << pipe_delay(p1_, p1_->nbits(), l1);
433  else
434  l1 = 0;
435  }
436  if (l2 > 0) {
437  if (p2_->op() != "const")
438  fs << pipe_delay(p2_, p2_->nbits(), l2);
439  else
440  l2 = 0;
441  }
442  if (l3 > 0) {
443  if (p3_->op() != "const")
444  fs << pipe_delay(p3_, p3_->nbits(), l3);
445  else
446  l3 = 0;
447  }
448 
449  if (op_ == "flag") {
450  for (const auto& cut : cuts_)
451  fs << cut->cut_var()->pipe_delays(step_);
452  }
453 
454  print(fs, verilog, l1, l2, l3);
455  readytoprint_ = false;
456  }
457 }
int step() const
Definition: imath.h:250
Log< level::Info, true > LogVerbatim
void print_step(int step, std::ofstream &fs, Verilog)
VarBase * p1_
Definition: imath.h:297
VarBase * p2_
Definition: imath.h:298
std::string op() const
Definition: imath.h:208
assert(be >=bs)
static struct trklet::VarBase::Verilog verilog
VarBase * p3_
Definition: imath.h:299
std::string op_
Definition: imath.h:300
int nbits() const
Definition: imath.h:243
void dump_msg()
Definition: imath.cc:96
int latency() const
Definition: imath.h:251
virtual void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0)
Definition: imath.h:256
bool readytoprint_
Definition: imath.h:319
std::vector< VarBase * > cuts_
Definition: imath.h:308
std::string name_
Definition: imath.h:296
static std::string pipe_delay(VarBase *v, int nbits, int delay)
Definition: imath.cc:173
step
Definition: StallMonitor.cc:98
void VarBase::print_step ( int  step,
std::ofstream &  fs,
HLS   
)

Definition at line 331 of file imath_HLS.cc.

References hls, p1_, p2_, p3_, print(), print_step(), readytoprint_, and step_.

331  {
332  if (!readytoprint_)
333  return;
334  if (step > step_)
335  return;
336  if (p1_)
337  p1_->print_step(step, fs, hls);
338  if (p2_)
339  p2_->print_step(step, fs, hls);
340  if (p3_)
341  p3_->print_step(step, fs, hls);
342  if (step == step_) {
343  print(fs, hls, 0, 0, 0);
344  readytoprint_ = false;
345  }
346 }
void print_step(int step, std::ofstream &fs, Verilog)
VarBase * p1_
Definition: imath.h:297
VarBase * p2_
Definition: imath.h:298
VarBase * p3_
Definition: imath.h:299
virtual void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0)
Definition: imath.h:256
static struct trklet::VarBase::HLS hls
bool readytoprint_
Definition: imath.h:319
step
Definition: StallMonitor.cc:98
void VarBase::print_truncation ( std::string &  t,
const std::string &  o1,
const int  ps,
Verilog   
) const

Definition at line 10 of file imath_Verilog.cc.

References itos(), name_, and nbits_.

Referenced by trklet::VarAdd::print(), trklet::VarSubtract::print(), trklet::VarNounits::print(), trklet::VarTimesC::print(), and trklet::VarMult::print().

10  {
11  if (ps > 0) {
12  t += "wire signed [" + itos(nbits_ - 1) + ":0]" + name_ + ";\n";
13  t += "reg signed [" + itos(nbits_ + ps - 1) + ":0]" + name_ + "_tmp;\n";
14  t += "always @(posedge clk) " + name_ + "_tmp <= " + o1 + ";\n";
15  t += "assign " + name_ + " = " + name_ + "_tmp[" + itos(nbits_ + ps - 1) + ":" + itos(ps) + "];\n";
16  } else {
17  t += "reg signed [" + itos(nbits_ - 1) + ":0]" + name_ + ";\n";
18  t += "always @(posedge clk) " + name_ + " <= " + o1 + ";\n";
19  }
20 }
static std::string itos(int i)
Definition: imath.cc:16
std::string name_
Definition: imath.h:296
void VarBase::print_truncation ( std::string &  t,
const std::string &  o1,
const int  ps,
HLS   
) const

Definition at line 11 of file imath_HLS.cc.

References itos(), name_, and nbits_.

11  {
12  if (ps > 0) {
13  t += "const ap_int<" + itos(nbits_ + ps) + "> " + name_ + "_tmp = " + o1 + ";\n";
14  t += "const ap_int<" + itos(nbits_) + "> " + name_ + " = " + name_ + "_tmp >> " + itos(ps) + ";\n";
15  } else
16  t += "const ap_int<" + itos(nbits_) + "> " + name_ + " = " + o1 + ";\n";
17 }
static std::string itos(int i)
Definition: imath.cc:16
std::string name_
Definition: imath.h:296
double trklet::VarBase::range ( ) const
inline

Definition at line 245 of file imath.h.

References K_, and nbits_.

Referenced by analyze(), calculate(), dump(), dump_msg(), trklet::VarAdd::VarAdd(), trklet::VarDSPPostadd::VarDSPPostadd(), trklet::VarMult::VarMult(), and trklet::VarSubtract::VarSubtract().

245 { return (1 << (nbits_ - 1)) * K_; } // everything is signed
double K_
Definition: imath.h:312
void trklet::VarBase::reset ( void  )
inline

Definition at line 235 of file imath.h.

References SiStripPI::max, maxval_, and minval_.

235  {
238 #ifdef IMATH_ROOT
239  h_->Clear();
240 #endif
241  }
double minval_
Definition: imath.h:322
double maxval_
Definition: imath.h:323
int trklet::VarBase::shift ( ) const
inline

Definition at line 247 of file imath.h.

References Kmap_.

Referenced by trklet::VarAdjustK::print(), trklet::VarInv::VarInv(), trklet::VarNounits::VarNounits(), trklet::VarShift::VarShift(), and trklet::VarShiftround::VarShiftround().

247 { return Kmap_.at("2"); }
std::map< std::string, int > Kmap_
Definition: imath.h:313
int trklet::VarBase::step ( ) const
inline

Definition at line 250 of file imath.h.

References step_.

Referenced by design_print(), trklet::VarCut::print(), print_step(), and VarBase().

250 { return step_; }
static void trklet::VarBase::verilog_print ( const std::vector< VarBase * > &  v,
std::ofstream &  fs 
)
inlinestatic

Definition at line 274 of file imath.h.

References design_print(), and verilog.

Referenced by trklet::TrackletCalculator::TrackletCalculator().

274 { design_print(v, fs, verilog); }
static struct trklet::VarBase::Verilog verilog
static void design_print(const std::vector< VarBase * > &v, std::ofstream &fs, Verilog)

Member Data Documentation

VarBase* trklet::VarBase::cut_var_
protected
std::vector<VarBase *> trklet::VarBase::cuts_
protected
double trklet::VarBase::fval_
protected
imathGlobals* trklet::VarBase::globals_
protected
struct trklet::VarBase::HLS trklet::VarBase::hls
static
long int trklet::VarBase::ival_
protected
double trklet::VarBase::K_
protected
std::map<std::string, int> trklet::VarBase::Kmap_
protected
int trklet::VarBase::latency_
protected

Definition at line 301 of file imath.h.

Referenced by add_latency(), dump_msg(), latency(), pipe_delays(), print_cuts(), and VarBase().

double trklet::VarBase::maxval_
protected

Definition at line 323 of file imath.h.

Referenced by analyze(), calculate(), maxval(), reset(), and VarBase().

double trklet::VarBase::minval_
protected

Definition at line 322 of file imath.h.

Referenced by analyze(), calculate(), minval(), reset(), and VarBase().

std::string trklet::VarBase::name_
protected
int trklet::VarBase::nbits_
protected
std::string trklet::VarBase::op_
protected
VarBase* trklet::VarBase::p1_
protected
VarBase* trklet::VarBase::p2_
protected
VarBase* trklet::VarBase::p3_
protected
int trklet::VarBase::pipe_counter_
protected

Definition at line 315 of file imath.h.

Referenced by makeready(), pipe_counter(), pipe_increment(), and VarBase().

std::vector<int> trklet::VarBase::pipe_delays_
protected

Definition at line 316 of file imath.h.

Referenced by add_delay(), has_delay(), makeready(), and VarBase().

bool trklet::VarBase::readytoanalyze_
protected

Definition at line 318 of file imath.h.

Referenced by analyze(), makeready(), and VarBase().

bool trklet::VarBase::readytoprint_
protected

Definition at line 319 of file imath.h.

Referenced by makeready(), print_step(), and VarBase().

int trklet::VarBase::step_
protected
bool trklet::VarBase::usedasinput_
protected

Definition at line 320 of file imath.h.

Referenced by inputs(), makeready(), and VarBase().

double trklet::VarBase::val_
protected
struct trklet::VarBase::Verilog trklet::VarBase::verilog
static