CMS 3D CMS Logo

List of all members | Public Member Functions
trklet::VarNeg Class Reference

#include <imath.h>

Inheritance diagram for trklet::VarNeg:
trklet::VarBase

Public Member Functions

void local_calculate () override
 
void print (std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
 
void print (std::ofstream &fs, HLS, int l1=0, int l2=0, int l3=0) override
 
 VarNeg (imathGlobals *globals, std::string name, VarBase *p1)
 
 ~VarNeg () 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 ()
 
void calcDebug (int debug_level, long int ival_prev, bool &all_ok)
 
bool calculate (int debug_level=0)
 
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, 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 ()
 

Additional Inherited Members

- Static Public Member Functions inherited from trklet::VarBase
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 inherited from trklet::VarBase
static struct trklet::VarBase::HLS hls
 
static struct trklet::VarBase::Verilog verilog
 
- 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_
 

Detailed Description

Definition at line 756 of file imath.h.

Constructor & Destructor Documentation

◆ VarNeg()

trklet::VarNeg::VarNeg ( imathGlobals globals,
std::string  name,
VarBase p1 
)
inline

Definition at line 758 of file imath.h.

References trklet::VarBase::K(), trklet::VarBase::K_, trklet::VarBase::Kmap(), trklet::VarBase::Kmap_, trklet::VarBase::nbits(), trklet::VarBase::nbits_, trklet::VarBase::op_, and trklet::VarBase::p1().

758  : VarBase(globals, name, p1, nullptr, nullptr, 1) {
759  op_ = "neg";
760  nbits_ = p1->nbits();
761  Kmap_ = p1->Kmap();
762  K_ = p1->K();
763  }
std::string name() const
Definition: imath.h:208
int nbits() const
Definition: imath.h:244
VarBase(imathGlobals *globals, std::string name, VarBase *p1, VarBase *p2, VarBase *p3, int l)
Definition: imath.h:162
std::string op_
Definition: imath.h:301
VarBase * p1() const
Definition: imath.h:210
std::map< std::string, int > Kmap() const
Definition: imath.h:245
double K() const
Definition: imath.h:247
std::map< std::string, int > Kmap_
Definition: imath.h:314
double K_
Definition: imath.h:313

◆ ~VarNeg()

trklet::VarNeg::~VarNeg ( )
overridedefault

Member Function Documentation

◆ local_calculate()

void VarNeg::local_calculate ( )
overridevirtual

Reimplemented from trklet::VarBase.

Definition at line 156 of file imath_calculate.cc.

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

156  {
157  fval_ = -p1_->fval();
158  ival_ = -p1_->ival();
159 }
double fval() const
Definition: imath.h:213
VarBase * p1_
Definition: imath.h:298
long int ival_
Definition: imath.h:306
long int ival() const
Definition: imath.h:214
double fval_
Definition: imath.h:305

◆ print() [1/2]

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

Reimplemented from trklet::VarBase.

Definition at line 219 of file imath_Verilog.cc.

References cms::cuda::assert(), make_classfiles::fs, trklet::VarBase::itos(), trklet::VarBase::K_, trklet::VarBase::kstring(), trklet::VarBase::name(), trklet::VarBase::name_, trklet::VarBase::nbits_, trklet::VarBase::p1_, AlCaHLTBitMon_QueryRunRegistry::string, and submitPVValidationJobs::t.

219  {
220  assert(p1_);
221  assert(l2 == 0);
222  assert(l3 == 0);
223  std::string n1 = p1_->name();
224  if (l1 > 0)
225  n1 = n1 + "_delay" + itos(l1);
226 
227  std::string t = "reg signed [" + itos(nbits_ - 1) + ":0]" + name_ + ";\n";
228  t += "always @(posedge clk) " + name_ + " <= - " + n1;
229  fs << "// " << nbits_ << " bits \t " << kstring() << "\t" << K_ << "\n" << t << ";\n";
230 }
std::string name() const
Definition: imath.h:208
VarBase * p1_
Definition: imath.h:298
std::string kstring() const
Definition: imath.cc:18
assert(be >=bs)
static std::string itos(int i)
Definition: imath.cc:16
std::string name_
Definition: imath.h:297
double K_
Definition: imath.h:313

◆ print() [2/2]

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

Reimplemented from trklet::VarBase.

Definition at line 200 of file imath_HLS.cc.

References cms::cuda::assert(), make_classfiles::fs, trklet::VarBase::itos(), trklet::VarBase::K_, trklet::VarBase::kstring(), trklet::VarBase::name(), trklet::VarBase::name_, trklet::VarBase::nbits_, trklet::VarBase::p1_, AlCaHLTBitMon_QueryRunRegistry::string, and submitPVValidationJobs::t.

200  {
201  assert(p1_);
202  assert(l1 == 0);
203  assert(l2 == 0);
204  assert(l3 == 0);
205  std::string n1 = p1_->name();
206 
207  std::string t = "const ap_int<" + itos(nbits_) + "> " + name_ + " = -" + n1 + ";\n";
208  fs << "// " << nbits_ << " bits \t " << kstring() << "\t" << K_ << "\n" << t << ";\n";
209 }
std::string name() const
Definition: imath.h:208
VarBase * p1_
Definition: imath.h:298
std::string kstring() const
Definition: imath.cc:18
assert(be >=bs)
static std::string itos(int i)
Definition: imath.cc:16
std::string name_
Definition: imath.h:297
double K_
Definition: imath.h:313