CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Friends
Signal Class Reference

#include <FWCore/ServiceRegistry/interface/Signal.h>

Inheritance diagram for Signal:
parameter

Public Member Functions

Signal asgn (Signal)
 
void clock (const char *rname)
 
void create ()
 
int getalwaysn ()
 
bool getbool ()
 
int getchange ()
 
int geth ()
 
int getint ()
 
int getl ()
 
rval getmask ()
 
int getnegedge ()
 
int getposedge ()
 
rval getr ()
 
rval getval ()
 
void init (const char *rname)
 
void init (int, int, const char *)
 
void init (Signal *shost, int h, int l, const char *rname)
 
void initreg (int, int, const char *)
 
void inout (const char *rname)
 
void inout (int, int, const char *)
 
void input (const char *rname)
 
void input (int, int, const char *)
 
void makemask ()
 
Signal operator! ()
 
Signal operator!= (Signal)
 
Signal operator% (Signal)
 
Signaloperator& ()
 
Signal operator& (Signal)
 
Signal operator&& (Signal)
 
Signal operator() (Signal)
 
Signal operator() (Signal, Signal)
 
Signal operator* (Signal)
 
Signal operator+ (Signal)
 
Signal operator++ ()
 
Signal operator++ (int)
 
Signal operator, (Signal)
 
Signal operator- (Signal)
 
Signal operator-- ()
 
Signal operator-- (int)
 
Signal operator/ (Signal)
 
Signal operator< (Signal)
 
Signal operator<< (Signal)
 
Signal operator<= (Signal)
 
Signal operator= (Signal)
 
Signal operator== (Signal)
 
Signal operator> (Signal)
 
Signal operator>= (Signal)
 
Signal operator>> (Signal)
 
Signal operator^ (Signal)
 
Signal operator| (Signal)
 
Signal operator|| (Signal)
 
Signal operator~ ()
 
void output (const char *rname)
 
void output (const char *rname, module *parent)
 
void output (int high, int low, const char *rname, module *parent)
 
void output (int, int, const char *)
 
void reg (const char *rname)
 
void reg (int, int, const char *)
 
Signal set (Signal)
 
void setalwaysn (int n)
 
void setchange (int ch)
 
void sethlmask (int high, int low, rval imask)
 
void setnegedge (int ch)
 
void setposedge (int ch)
 
void setprintable (int p)
 
void setr (rval rv)
 
void setrc (rval rv)
 
 Signal ()
 
 Signal (const char *)
 
 Signal (int bits, rval value)
 
 Signal (int)
 
 Signal (rval)
 
 Signal (unsigned int)
 
void wire (const char *rname)
 
void wire (int, int, const char *)
 
void wire (int, int, const char *, int)
 

Protected Attributes

int alwaysn
 
Signalca1
 
Signalca2
 
int change
 
int h
 
Signalhost
 
int hostl
 
int inited
 
int l
 
rval mask
 
int mode
 
int nedge
 
Signalouthost
 
Signaloutreg
 
int pedge
 
int printable
 
rval r
 
rval rc
 
Signalsource
 

Friends

std::ostream & operator<< (std::ostream &stream, Signal s)
 
Signal rand (Signal)
 
Signal ror (Signal)
 
Signal rxor (Signal)
 

Detailed Description

Description: A simple implementation of the signal/slot pattern

Usage: This is a simple version of the signal/slot pattern and is used by the Framework. It is safe to call 'emit' from multiple threads simultaneously. Assumptions: -The attached slots have a life-time greater than the last 'emit' call issued from the Signal. -'connect' is not called simultaneously with any other methods of the class.

Definition at line 28 of file vlib.h.

Constructor & Destructor Documentation

◆ Signal() [1/6]

Signal::Signal ( )

Definition at line 29 of file vlib.cc.

29 { create(); }

References create().

◆ Signal() [2/6]

Signal::Signal ( rval  n)

Definition at line 157 of file vlib.cc.

157  {
158  create();
159  mode = mnum;
160 #ifdef VGEN
161  ostringstream ln;
162  ln << dec << n;
163  init(8 * Sizeofrval - 1, 0, ln.str().c_str());
164 #else
165  init(8 * Sizeofrval - 1, 0, "");
166 #endif
167  inited = 0;
168  rc = n;
169  r = n;
170 }

References create(), TauDecayModes::dec, init(), inited, mnum, mode, dqmiodumpmetadata::n, r, rc, and Sizeofrval.

◆ Signal() [3/6]

Signal::Signal ( int  n)

Definition at line 172 of file vlib.cc.

172  {
173  create();
174  mode = mnum;
175 #ifdef VGEN
176  ostringstream ln;
177  ln << dec << n;
178  init(Sizeofrval * 8 - 1, 0, ln.str().c_str());
179 #else
180  init(Sizeofrval * 8 - 1, 0, "");
181 #endif
182  inited = 0;
183  r = (rval)n;
184  rc = r;
185 }

References create(), TauDecayModes::dec, init(), inited, mnum, mode, dqmiodumpmetadata::n, r, rc, and Sizeofrval.

◆ Signal() [4/6]

Signal::Signal ( unsigned int  n)

Definition at line 187 of file vlib.cc.

187  {
188  create();
189  mode = mnum;
190 #ifdef VGEN
191  ostringstream ln;
192  ln << dec << n;
193  init(Sizeofrval * 8 - 1, 0, ln.str().c_str());
194 #else
195  init(Sizeofrval * 8 - 1, 0, "");
196 #endif
197  inited = 0;
198  r = (rval)n;
199  rc = r;
200 }

References create(), TauDecayModes::dec, init(), inited, mnum, mode, dqmiodumpmetadata::n, r, rc, and Sizeofrval.

◆ Signal() [5/6]

Signal::Signal ( const char *  sval)

Definition at line 43 of file vlib.cc.

43  {
44  create();
45  mode = mnum;
46  std::string val = sval;
47  int bits;
48  unsigned int i;
49  char radix;
50  rval value = 0;
51  int dig;
52 
53  sscanf(val.c_str(), "%d'%c", &bits, &radix);
54  switch (radix) {
55  case 'h':
56  case 'H':
57  // sscanf (val.c_str(), "%d'%c%x", &bits, &radix, &value);
58  for (i = 0; val[i] != 'h' && val[i] != 'H'; ++i)
59  ;
60  for (; i < val.length(); ++i) {
61  switch (val[i]) {
62  case '0':
63  case '1':
64  case '2':
65  case '3':
66  case '4':
67  case '5':
68  case '6':
69  case '7':
70  case '8':
71  case '9':
72  dig = val[i] - '0';
73  break;
74  case 'a':
75  case 'b':
76  case 'c':
77  case 'd':
78  case 'e':
79  case 'f':
80  dig = val[i] - 'a' + 10;
81  break;
82  case 'A':
83  case 'B':
84  case 'C':
85  case 'D':
86  case 'E':
87  case 'F':
88  dig = val[i] - 'A' + 10;
89  break;
90  default:
91  dig = -1;
92  break;
93  }
94  if (dig >= 0) {
95  value = value << 4;
96  value = value | dig;
97  }
98  }
99 
100  break;
101  case 'd':
102  case 'D':
103  sscanf(val.c_str(), "%d'%c%d", &bits, &radix, reinterpret_cast<int*>(&value));
104  break;
105  case 'o':
106  case 'O':
107  // sscanf (val.c_str(), "%d'%c%o", &bits, &radix, &value);
108  for (i = 0; val[i] != 'o' && val[i] != 'O'; ++i)
109  ;
110  for (; i < val.length(); ++i) {
111  switch (val[i]) {
112  case '0':
113  case '1':
114  case '2':
115  case '3':
116  case '4':
117  case '5':
118  case '6':
119  case '7':
120  dig = val[i] - '0';
121  break;
122  default:
123  dig = -1;
124  break;
125  }
126  if (dig >= 0) {
127  value = value << 3;
128  value = value | dig;
129  }
130  }
131 
132  break;
133 
134  case 'b':
135  case 'B':
136 
137  for (i = 0; val[i] != 'b' && val[i] != 'B'; ++i)
138  ;
139  for (; i < val.length(); ++i) {
140  switch (val[i]) {
141  case '0':
142  value = value << 1;
143  break;
144  case '1':
145  value = value << 1;
146  value = value | 1;
147  break;
148  }
149  }
150  break;
151  }
152  Signal::init(bits - 1, 0, val.c_str());
153  rc = value & mask;
154  r = rc;
155 }

References bits, create(), mps_fire::i, init(), mask, mnum, mode, r, rc, AlCaHLTBitMon_QueryRunRegistry::string, and heppy_batch::val.

◆ Signal() [6/6]

Signal::Signal ( int  bits,
rval  value 
)

Definition at line 31 of file vlib.cc.

31  {
32  create();
33 #ifdef VGEN
34  ostringstream sval;
35  sval << dec << bits << "'d" << value;
36  Signal::init(bits - 1, 0, sval.str().c_str());
37 #else
38  Signal::init(bits - 1, 0, "");
39 #endif
40  r = rc = value & mask;
41 }

References bits, create(), TauDecayModes::dec, init(), mask, r, rc, and relativeConstraints::value.

Member Function Documentation

◆ asgn()

Signal Signal::asgn ( Signal  other)

Definition at line 459 of file vlib.cc.

459  {
460  Signal t;
461 
462 #ifdef VGEN
463  t.name = lb + name + rb + " = " + other.getcatname();
464  if (glc.printassign())
465  std::cout << glc.getmargin() << t.name << ";\n" << flush;
466 #endif
467  rval hr, portionr, portionmask, otr;
468  int shn;
469 
470  otr = other.getval() & mask;
471 
472  if (otr != r) {
474  glc.setchange(1);
475  }
476 
477  rc = otr;
478  if (host) // is this a portion of the other register?
479  {
480  hr = host->rc;
481  if (hostl > 0)
482  shn = (hostl - host->getl());
483  else
484  shn = (l - host->getl());
485  portionr = rc << shn;
486  portionmask = mask << shn;
487  host->set((hr & (~portionmask)) | portionr);
488  }
489 
490  if (ca1 != nullptr && ca2 != nullptr) // is this a concatenation of the two registers?
491  {
492  ca2->set(other);
493  ca1->set(other >> (ca2->h - ca2->l + 1));
494  }
495  if (outhost != nullptr && outhost != this && (mode == moutput || mode == minout)) {
496  outhost->set(other);
497  }
498  if (outreg) {
499  outreg->set(other);
500  }
501 
502  t.h = h;
503  t.l = l;
504  t.mask = mask;
505  t.pedge = pedge;
506  t.nedge = nedge;
507  t.change = change;
508  t.r = rc;
509 #ifdef VGEN
510  glc.setprintassign(1);
511 #endif
512  return t;
513 }

References ca1, ca2, change, gather_cfg::cout, globcontrol::getalwaysn(), getl(), glc, h, host, hostl, l, mask, minout, mode, moutput, Skims_PA_cff::name, nedge, trackingPlots::other, outhost, outreg, pedge, r, rc, set(), setalwaysn(), globcontrol::setchange(), and OrderedSet::t.

Referenced by operator=(), and set().

◆ clock()

void Signal::clock ( const char *  rname)

Definition at line 603 of file vlib.cc.

603  {
604 #ifdef VGEN
605  if (lb == "{")
606  glc.AddIO(lb + name + rb);
607  else
608  glc.AddIO(name);
609 #else
610 #ifdef _VDEBUG
611  if (h - l != 0 &&
612  inited) // inited is analysed in case the passed parameter is a temp var. Actually, every operator should return temp with the proper mask,h,l inherited from operands
613  {
614  dbgmsg("Different port length for clock argument: declared [" << 0 << ":" << 0 << "], passed: [" << h << ":" << l
615  << "]. ");
616  }
617 #endif
618 #endif
619  Signal::init(0, 0, rname);
620  h = l = 0;
621  mode = minput;
622 #ifdef VGEN
623  obname = obnames[mode];
624  ostringstream ln;
625  glc.AddParameter(name);
626  if (h == l)
627  ln << obname << name << ";\n";
628  else
629  ln << obname << "[" << dec << h << ":" << l << "] " << name << ";\n";
630  glc.AddDeclarator(ln.str());
631  printable = 0;
632 #else
633  outreg = glc.getparent()->AddOutReg((Signal)(*this));
634  if (rc != r) {
635  change = 1;
636  glc.getparent()->setchange(1);
637  if (rc == 1 && r == 0)
638  pedge = 1;
639  else
640  pedge = 0;
641  if (rc == 0 && r == 1)
642  nedge = 1;
643  else
644  nedge = 0;
645  } else
646  change = pedge = nedge = 0;
647  outreg->setr(r);
648  outreg->setrc(r);
649  outhost = host = nullptr;
650 #endif
651 }

References module::AddOutReg(), change, dbgmsg, TauDecayModes::dec, globcontrol::getparent(), glc, host, init(), inited, l, minput, mode, Skims_PA_cff::name, nedge, obnames, outhost, outreg, pedge, printable, r, rc, rname, module::setchange(), setr(), and setrc().

◆ create()

void Signal::create ( )

Definition at line 13 of file vlib.cc.

13  {
14 #ifdef VGEN
15  name = "";
16  orname = "";
17  obname = "";
18  lb = "(";
19  rb = ")";
20 #endif
21 
22  outhost = host = outreg = ca1 = ca2 = nullptr;
23  inited = printable = r = rc = l = pedge = nedge = change = alwaysn = mode = 0;
24  h = 8 * Sizeofrval - 1;
25  mask = (rval)(-1);
26  hostl = -1;
27 }

References alwaysn, ca1, ca2, change, host, hostl, inited, l, mask, mode, Skims_PA_cff::name, nedge, outhost, outreg, pedge, printable, r, rc, and Sizeofrval.

Referenced by Signal().

◆ getalwaysn()

int Signal::getalwaysn ( )
inline

Definition at line 73 of file vlib.h.

73 { return alwaysn; };

References alwaysn.

Referenced by getval().

◆ getbool()

bool Signal::getbool ( )
inline

Definition at line 65 of file vlib.h.

65 { return (getval() != 0); };

References getval().

◆ getchange()

int Signal::getchange ( )
inline

Definition at line 68 of file vlib.h.

68 { return change; };

References change.

Referenced by output().

◆ geth()

int Signal::geth ( )
inline

Definition at line 55 of file vlib.h.

55 { return h; };

References h.

◆ getint()

int Signal::getint ( )
inline

Definition at line 53 of file vlib.h.

53 { return (unsigned int)r; };

References r.

◆ getl()

int Signal::getl ( )
inline

Definition at line 54 of file vlib.h.

54 { return l; };

References l.

Referenced by asgn(), and init().

◆ getmask()

rval Signal::getmask ( )
inline

Definition at line 56 of file vlib.h.

56 { return mask; };

References mask.

Referenced by input().

◆ getnegedge()

int Signal::getnegedge ( )
inline

Definition at line 67 of file vlib.h.

67 { return nedge; };

References nedge.

Referenced by output().

◆ getposedge()

int Signal::getposedge ( )
inline

Definition at line 66 of file vlib.h.

66 { return pedge; };

References pedge.

Referenced by output().

◆ getr()

rval Signal::getr ( )
inline

Definition at line 52 of file vlib.h.

52 { return r; };

References r.

Referenced by init(), input(), output(), and function::vendfunction().

◆ getval()

rval Signal::getval ( )

Definition at line 415 of file vlib.cc.

415 { return (getalwaysn() == glc.getalwaysn()) ? rc : r; }

References getalwaysn(), globcontrol::getalwaysn(), glc, r, and rc.

Referenced by getbool(), operator()(), and operator,().

◆ init() [1/3]

void Signal::init ( const char *  rname)
inline

Definition at line 38 of file vlib.h.

38 { init(0, 0, rname); };

References init(), and rname.

Referenced by init().

◆ init() [2/3]

void Signal::init ( int  high,
int  low,
const char *  rname 
)

Definition at line 208 of file vlib.cc.

208  {
209 #ifdef VGEN
210  name = rname;
211  orname = rname;
212  lb = "";
213  rb = "";
214 #endif
215  if (!inited) {
216  h = high;
217  l = low;
218  makemask();
219  inited = 1;
220  }
221  source = this;
222 }

References LaserClient_cfi::high, inited, l, LaserClient_cfi::low, makemask(), Skims_PA_cff::name, rname, and source.

Referenced by clock(), parameter::init(), initreg(), inout(), input(), output(), Signal(), and wire().

◆ init() [3/3]

void Signal::init ( Signal shost,
int  h,
int  l,
const char *  rname 
)

Definition at line 224 of file vlib.cc.

224  {
225  host = shost;
226 #ifdef VGEN
227  name = rname;
228  orname = rname;
229  lb = "";
230  rb = "";
231 #endif
232  h = high;
233  l = low;
234  makemask();
235  source = this;
236  if (host) {
237  rc = (host->getr() >> (l - host->getl())) & mask;
238  r = rc;
239  }
240  change = pedge = nedge = 0;
241 }

References change, getl(), getr(), LaserClient_cfi::high, host, l, LaserClient_cfi::low, makemask(), mask, Skims_PA_cff::name, nedge, pedge, r, rc, rname, and source.

◆ initreg()

void Signal::initreg ( int  high,
int  low,
const char *  rname 
)

Definition at line 766 of file vlib.cc.

766  {
768  mode = mreg;
769 #ifdef VGEN
770  obname = obnames[mode];
771 #endif
772  change = (r != rc);
773  if (change)
774  glc.getparent()->setchange(1);
775  pedge = (rc == 1 && r == 0);
776  nedge = (rc == 0 && r == 1);
777  r = rc;
778 }

References change, globcontrol::getparent(), glc, LaserClient_cfi::high, init(), LaserClient_cfi::low, mode, mreg, nedge, obnames, pedge, r, rc, rname, and module::setchange().

Referenced by reg(), and memory::reg().

◆ inout() [1/2]

void Signal::inout ( const char *  rname)
inline

Definition at line 132 of file vlib.h.

132 { inout(0, 0, rname); };

References inout(), and rname.

Referenced by inout().

◆ inout() [2/2]

void Signal::inout ( int  high,
int  low,
const char *  rname 
)

Definition at line 717 of file vlib.cc.

717  {
718 #ifdef VGEN
719  if (lb == "{")
720  glc.AddIO(lb + name + rb);
721  else
722  glc.AddIO(name);
723 #else
724 #ifdef _VDEBUG
725  if (h - l != high - low) {
726  dbgmsg("Different port length for inout argument: declared [" << high << ":" << low << "], passed: [" << h << ":"
727  << l << "]. ");
728  }
729 #endif
730 #endif
731  hostl = l;
733  if (high >= low) {
734  h = high;
735  l = low;
736  } else {
737  h = low;
738  l = high;
739  }
740  mode = minout;
741 #ifdef VGEN
742  obname = obnames[mode];
743  ostringstream ln;
744  glc.AddParameter(name);
745  if (h == l)
746  ln << obname << name << ";\n";
747  else
748  ln << obname << "[" << dec << h << ":" << l << "] " << name << ";\n";
749  glc.AddDeclarator(ln.str());
750  printable = 0;
751 #endif
752 }

References dbgmsg, TauDecayModes::dec, glc, LaserClient_cfi::high, hostl, init(), l, LaserClient_cfi::low, minout, mode, Skims_PA_cff::name, obnames, printable, and rname.

◆ input() [1/2]

void Signal::input ( const char *  rname)
inline

Definition at line 123 of file vlib.h.

123 { input(0, 0, rname); };

References input(), and rname.

Referenced by input().

◆ input() [2/2]

void Signal::input ( int  high,
int  low,
const char *  rname 
)

Definition at line 545 of file vlib.cc.

545  {
546 #ifdef VGEN
547  if (lb == "{")
548  glc.AddIO(lb + name + rb);
549  else
550  glc.AddIO(name);
551 #else
552 #ifdef _VDEBUG
553  if (h - l != high - low &&
554  inited) // inited is analysed in case the passed parameter is a temp var. Actually, every operator should return temp with the proper mask,h,l inherited from operands
555  {
556  dbgmsg("Different port length for input argument: declared [" << high << ":" << low << "], passed: [" << h << ":"
557  << l << "]. ");
558  }
559 #endif
560 #endif
562  if (high >= low) {
563  h = high;
564  l = low;
565  } else {
566  h = low;
567  l = high;
568  }
569  mode = minput;
570 #ifdef VGEN
571  obname = obnames[mode];
572  ostringstream ln;
573  glc.AddParameter(name);
574  if (h == l)
575  ln << obname << name << ";\n";
576  else
577  ln << obname << "[" << dec << h << ":" << l << "] " << name << ";\n";
578  glc.AddDeclarator(ln.str());
579  printable = 0;
580 #else
581  outreg = glc.getparent()->AddOutReg((Signal)(*this));
582  r = r & outreg->getmask();
583  if (outreg->getr() != r) {
584  change = 1;
585  glc.getparent()->setchange(1);
586  if (r == 1 && outreg->getr() == 0)
587  pedge = 1;
588  else
589  pedge = 0;
590  if (r == 0 && outreg->getr() == 1)
591  nedge = 1;
592  else
593  nedge = 0;
594  } else
595  change = pedge = nedge = 0;
596  outreg->setr(r);
597  outreg->setrc(r);
598  outhost = host = nullptr;
599 #endif
600 }

References module::AddOutReg(), change, dbgmsg, TauDecayModes::dec, getmask(), globcontrol::getparent(), getr(), glc, LaserClient_cfi::high, host, init(), inited, l, LaserClient_cfi::low, minput, mode, Skims_PA_cff::name, nedge, obnames, outhost, outreg, pedge, printable, r, rname, module::setchange(), setr(), and setrc().

◆ makemask()

void Signal::makemask ( )

Definition at line 202 of file vlib.cc.

202  {
203  mask = (1LL << (h - l + 1)) - 1LL;
204  if (mask == 0LL)
205  mask = ~mask;
206 }

References l, L1DTConfigFromDB_cfi::LL, and mask.

Referenced by init().

◆ operator!()

Signal Signal::operator! ( )

Definition at line 274 of file vlib.cc.

◆ operator!=()

Definition at line 362 of file vlib.cc.

365 {

◆ operator%()

Signal Signal::operator% ( Signal  arg)

Definition at line 305 of file vlib.cc.

◆ operator&() [1/2]

Signal * Signal::operator& ( )

Definition at line 276 of file vlib.cc.

276  {
277 #ifdef VGEN
278  printable = 0;
279 #endif
280  return this;
281 }

◆ operator&() [2/2]

Signal Signal::operator& ( Signal  arg)

Definition at line 306 of file vlib.cc.

◆ operator&&()

Signal Signal::operator&& ( Signal  arg)

Definition at line 306 of file vlib.cc.

◆ operator()() [1/2]

Signal Signal::operator() ( Signal  n)

Definition at line 535 of file vlib.cc.

535 { return (*this)(n, n); }

References dqmiodumpmetadata::n.

◆ operator()() [2/2]

Signal Signal::operator() ( Signal  hn,
Signal  ln 
)

Definition at line 517 of file vlib.cc.

517  {
518  Signal t;
519 #ifdef VGEN
520  string bname;
521  if (hn.getname().compare(ln.getname()) != 0)
522  bname = name + "[" + hn.getname() + ":" + ln.getname() + "]";
523  else
524  bname = name + "[" + hn.getname() + "]";
525  hn.printable = ln.printable = 0;
526  t.init(this, 0, 0, bname.c_str());
527 #else
528  t.init(this, (unsigned)hn.getval(), (unsigned)ln.getval(), "");
529 #endif
530  t.rc = (getval() >> (t.l - l)) & t.mask;
531  t.r = t.rc;
532  return t;
533 }

References getval(), l, Skims_PA_cff::name, printable, and OrderedSet::t.

◆ operator*()

Signal Signal::operator* ( Signal  arg)

Definition at line 305 of file vlib.cc.

◆ operator+()

Signal Signal::operator+ ( Signal  arg)

Definition at line 305 of file vlib.cc.

◆ operator++() [1/2]

Signal Signal::operator++ ( void  )
inline

Definition at line 104 of file vlib.h.

104 { return *this = *this + 1; };

◆ operator++() [2/2]

Signal Signal::operator++ ( int  )
inline

Definition at line 106 of file vlib.h.

106  {
107  return *this = *this + 1;
108  }; // postfix operators require some work (different names for operations and assignment printing?)

◆ operator,()

Signal Signal::operator, ( Signal  arg)

Definition at line 324 of file vlib.cc.

324  {
325  Signal t;
326 #ifdef VGEN
327  t.name = name + ", " + arg.name;
328  t.lb = "{";
329  t.rb = "}";
330  printable = arg.printable = 0;
331 #else
332  t.ca1 = this;
333  t.ca2 = arg.source;
334  t.init(h - l + arg.h - arg.l + 1, 0, "");
335 #endif
336  t.r = (((getval() << (arg.h - arg.l + 1)) & (~(arg.mask))) | arg.getval()) & t.mask;
337  return t;
338 }

References getval(), l, Skims_PA_cff::name, printable, and OrderedSet::t.

◆ operator-()

Signal Signal::operator- ( Signal  arg)

Definition at line 305 of file vlib.cc.

◆ operator--() [1/2]

Signal Signal::operator-- ( )
inline

Definition at line 105 of file vlib.h.

105 { return *this = *this - 1; };

◆ operator--() [2/2]

Signal Signal::operator-- ( int  )
inline

Definition at line 109 of file vlib.h.

109 { return *this = *this - 1; };

◆ operator/()

Signal Signal::operator/ ( Signal  arg)

Definition at line 305 of file vlib.cc.

◆ operator<()

Signal Signal::operator< ( Signal  arg)

Definition at line 361 of file vlib.cc.

365 {

◆ operator<<()

Signal Signal::operator<< ( Signal  arg)

Definition at line 306 of file vlib.cc.

◆ operator<=()

Signal Signal::operator<= ( Signal  arg)

Definition at line 361 of file vlib.cc.

365 {

◆ operator=()

Signal Signal::operator= ( Signal  other)

Definition at line 417 of file vlib.cc.

417  {
418 #ifndef VGEN
419 #ifdef _VDEBUG
420  switch (mode) {
421  case moutput:
422  if (glc.getalwaysn() == -1 && outreg != NULL)
423  dbgmsg("Assigning output-reg outside always block.");
424  if (glc.getalwaysn() != -1 && outreg == NULL)
425  dbgmsg("Assigning non-reg output inside always block.");
426  break;
427 
428  case minout:
429  if (glc.getalwaysn() != -1)
430  dbgmsg("Assigning inout inside always block.");
431  break;
432 
433  case minput:
434  dbgmsg("Assigning to input is not allowed.");
435  return other;
436 
437  case mreg:
438  if (glc.getalwaysn() == -1)
439  dbgmsg("Assigning reg outside always block.");
440  break;
441 
442  case mwire:
443  if (glc.getalwaysn() != -1)
444  dbgmsg("Assigning wire inside always block.");
445  break;
446  }
447 #endif
448 #endif
449  return asgn(other);
450 }

References asgn(), dbgmsg, globcontrol::getalwaysn(), glc, minout, minput, mode, moutput, mreg, mwire, NULL, trackingPlots::other, and outreg.

◆ operator==()

Signal Signal::operator== ( Signal  arg)

Definition at line 361 of file vlib.cc.

365 {

◆ operator>()

Signal Signal::operator> ( Signal  arg)

Definition at line 361 of file vlib.cc.

365 {

◆ operator>=()

Signal Signal::operator>= ( Signal  arg)

Definition at line 361 of file vlib.cc.

365 {

◆ operator>>()

Signal Signal::operator>> ( Signal  arg)

Definition at line 306 of file vlib.cc.

◆ operator^()

Signal Signal::operator^ ( Signal  arg)

Definition at line 305 of file vlib.cc.

◆ operator|()

Signal Signal::operator| ( Signal  arg)

Definition at line 306 of file vlib.cc.

◆ operator||()

Signal Signal::operator|| ( Signal  arg)

Definition at line 308 of file vlib.cc.

308  {
309  Signal t;
310 #ifdef VGEN
311  t.name = lb + name + rb + " || " + arg.lb + arg.name + arg.rb;
312  t.orname = orname + " or " + arg.orname;
313  printable = arg.printable = 0;
314 #else
315  int ln = h - l;
316  int aln = arg.h - arg.l;
317  t.init((ln > aln) ? ln : aln, 0, "");
318 #endif
319  t.r = t.mask & (getval() || arg.getval());
320  t.change = change || arg.change;
321  return t;
322 }

References cmsLHEtoEOSManager::l, Skims_PA_cff::name, and OrderedSet::t.

◆ operator~()

Signal Signal::operator~ ( )

Definition at line 274 of file vlib.cc.

◆ output() [1/4]

void Signal::output ( const char *  rname)
inline

Definition at line 127 of file vlib.h.

127 { output(0, 0, rname); };

References output(), and rname.

Referenced by output().

◆ output() [2/4]

void Signal::output ( const char *  rname,
module parent 
)

Definition at line 713 of file vlib.cc.

713 { output(0, 0, rname, parent); }

References output(), class-composition::parent, and rname.

◆ output() [3/4]

void Signal::output ( int  high,
int  low,
const char *  rname,
module parent 
)

Definition at line 695 of file vlib.cc.

695  {
696  output(high, low, rname);
697 #ifdef VGEN
698  ostringstream ln;
699  if (h == l)
700  ln << "reg " << name << ";\n";
701  else
702  ln << "reg [" << dec << h << ":" << l << "] " << name << ";\n";
703  glc.AddDeclarator(ln.str());
704 #else
705  outreg = parent->AddOutReg((Signal)(*this));
706  setr(outreg->getr());
710 #endif
711 }

References TauDecayModes::dec, getchange(), getnegedge(), getposedge(), getr(), glc, LaserClient_cfi::high, l, LaserClient_cfi::low, Skims_PA_cff::name, output(), outreg, class-composition::parent, rname, setchange(), setnegedge(), setposedge(), and setr().

◆ output() [4/4]

void Signal::output ( int  high,
int  low,
const char *  rname 
)

Definition at line 655 of file vlib.cc.

655  {
656 #ifdef VGEN
657  if (lb == "{")
658  glc.AddIO(lb + name + rb);
659  else
660  glc.AddIO(name);
661 #else
662 #ifdef _VDEBUG
663  if (h - l != high - low) {
664  dbgmsg("Different port length for output argument: declared [" << high << ":" << low << "], passed: [" << h << ":"
665  << l << "]. ");
666  }
667  if (mode == mreg) {
668  dbgmsg("Using reg as output.");
669  }
670 #endif
671 #endif
672  hostl = l;
674  if (high >= low) {
675  h = high;
676  l = low;
677  } else {
678  h = low;
679  l = high;
680  }
681  mode = moutput;
682 #ifdef VGEN
683  obname = obnames[mode];
684  ostringstream ln;
685  glc.AddParameter(name);
686  if (h == l)
687  ln << obname << name << ";\n";
688  else
689  ln << obname << "[" << dec << h << ":" << l << "] " << name << ";\n";
690  glc.AddDeclarator(ln.str());
691  printable = 0;
692 #endif
693 }

References dbgmsg, TauDecayModes::dec, glc, LaserClient_cfi::high, hostl, init(), l, LaserClient_cfi::low, mode, moutput, mreg, Skims_PA_cff::name, obnames, printable, and rname.

Referenced by output().

◆ reg() [1/2]

void Signal::reg ( const char *  rname)
inline

Definition at line 136 of file vlib.h.

136 { reg(0, 0, rname); };

References reg(), and rname.

Referenced by reg().

◆ reg() [2/2]

void Signal::reg ( int  high,
int  low,
const char *  rname 
)

Definition at line 756 of file vlib.cc.

756  {
757  initreg(high, low, rname);
758 #ifdef VGEN
759  if (h == l)
760  cout << glc.getmargin() << obname << name << ";\n" << flush;
761  else
762  std::cout << glc.getmargin() << obname << "[" << dec << h << ":" << l << "] " << name << ";\n" << flush;
763 #endif
764 }

References gather_cfg::cout, TauDecayModes::dec, glc, LaserClient_cfi::high, initreg(), l, LaserClient_cfi::low, Skims_PA_cff::name, and rname.

Referenced by module::AddOutReg().

◆ set()

Signal Signal::set ( Signal  other)

Definition at line 452 of file vlib.cc.

452  {
453 #ifdef VGEN
454  glc.setprintassign(0);
455 #endif
456  return asgn(other);
457 }

References asgn(), glc, and trackingPlots::other.

Referenced by asgn().

◆ setalwaysn()

void Signal::setalwaysn ( int  n)
inline

Definition at line 72 of file vlib.h.

72 { alwaysn = (n == -1) ? 0 : n; };

References alwaysn, and dqmiodumpmetadata::n.

Referenced by asgn().

◆ setchange()

void Signal::setchange ( int  ch)
inline

Definition at line 69 of file vlib.h.

69 { change = ch; };

References change.

Referenced by output().

◆ sethlmask()

void Signal::sethlmask ( int  high,
int  low,
rval  imask 
)
inline

Definition at line 59 of file vlib.h.

59  {
60  h = high;
61  l = low;
62  mask = imask;
63  };

References LaserClient_cfi::high, l, LaserClient_cfi::low, and mask.

Referenced by function::vendfunction().

◆ setnegedge()

void Signal::setnegedge ( int  ch)
inline

Definition at line 71 of file vlib.h.

71 { nedge = ch; };

References nedge.

Referenced by output().

◆ setposedge()

void Signal::setposedge ( int  ch)
inline

Definition at line 70 of file vlib.h.

70 { pedge = ch; };

References pedge.

Referenced by output().

◆ setprintable()

void Signal::setprintable ( int  p)
inline

Definition at line 74 of file vlib.h.

74 { printable = p; };

References AlCaHLTBitMon_ParallelJobs::p, and printable.

◆ setr()

void Signal::setr ( rval  rv)
inline

Definition at line 57 of file vlib.h.

57 { r = rv & mask; };

References mask, and r.

Referenced by module::AddOutReg(), clock(), input(), output(), memory::reg(), and function::vendfunction().

◆ setrc()

void Signal::setrc ( rval  rv)
inline

Definition at line 58 of file vlib.h.

58 { rc = rv & mask; };

References mask, and rc.

Referenced by clock(), and input().

◆ wire() [1/3]

void Signal::wire ( const char *  rname)
inline

Definition at line 140 of file vlib.h.

140 { wire(0, 0, rname); };

References rname, and wire().

Referenced by wire().

◆ wire() [2/3]

void Signal::wire ( int  high,
int  low,
const char *  rname 
)

Definition at line 808 of file vlib.cc.

808  {
810  mode = mwire;
811  outhost = this;
812  change = (r != rc);
813  if (change && glc.getparent())
814  glc.getparent()->setchange(1);
815  pedge = (rc == 1 && r == 0);
816  nedge = (rc == 0 && r == 1);
817  r = rc;
818 #ifdef VGEN
819  obname = obnames[mode];
820  if (h == l)
821  cout << glc.getmargin() << obname << name << ";\n" << flush;
822  else
823  std::cout << glc.getmargin() << obname << "[" << dec << h << ":" << l << "] " << name << ";\n" << flush;
824 #endif
825 }

References change, gather_cfg::cout, TauDecayModes::dec, globcontrol::getparent(), glc, LaserClient_cfi::high, init(), l, LaserClient_cfi::low, mode, mwire, Skims_PA_cff::name, nedge, obnames, outhost, pedge, r, rc, rname, and module::setchange().

Referenced by wire().

◆ wire() [3/3]

void Signal::wire ( int  high,
int  low,
const char *  rname,
int  i 
)

Definition at line 827 of file vlib.cc.

827  {
828 #ifdef VGEN
829  ostringstream instnamestream;
830  instnamestream << rname << dec << i;
831  // init(high, low, instnamestream.str().c_str());
832  wire(high, low, instnamestream.str().c_str());
833 #else
834  wire(high, low, rname);
835 #endif
836 }

References TauDecayModes::dec, LaserClient_cfi::high, mps_fire::i, LaserClient_cfi::low, rname, and wire().

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
Signal  s 
)
friend

Definition at line 538 of file vlib.cc.

538  {
539  stream << s.getr();
540  s.setprintable(0);
541  return stream;
542 }

◆ rand

Signal rand ( Signal  arg)
friend

Definition at line 379 of file vlib.cc.

379  {
380  Signal t;
381  rval tr;
382 #ifdef VGEN
383  t.name = "&" + arg.lb + arg.name + arg.rb;
384  arg.printable = 0;
385 #else
386  t.init("");
387 #endif
388  tr = (arg.getval()) & arg.mask;
389  t.r = (tr == arg.mask) ? 1 : 0;
390  return t;
391 }

◆ ror

Signal ror ( Signal  arg)
friend

Definition at line 365 of file vlib.cc.

365  {
366  Signal t;
367  rval tr;
368 #ifdef VGEN
369  t.name = "|" + arg.lb + arg.name + arg.rb;
370  arg.printable = 0;
371 #else
372  t.init("");
373 #endif
374  tr = (arg.getval()) & arg.mask;
375  t.r = (tr != 0) ? 1 : 0;
376  return t;
377 }

◆ rxor

Signal rxor ( Signal  arg)
friend

Definition at line 393 of file vlib.cc.

393  {
394  Signal t;
395  rval tr;
396  int i;
397 #ifdef VGEN
398  t.name = "^" + arg.lb + arg.name + arg.rb;
399  arg.printable = 0;
400 #else
401  t.init("");
402 #endif
403  tr = (arg.getval()) & arg.mask;
404  t.r = 0;
405  for (i = 0; i < arg.h - arg.l + 1; ++i) {
406  t.r = ((tr & 1) != 0) ? !t.r : t.r;
407  tr = tr >> 1;
408  }
409  t.r = t.r & 1;
410  return t;
411 }

Member Data Documentation

◆ alwaysn

int Signal::alwaysn
protected

Definition at line 162 of file vlib.h.

Referenced by create(), getalwaysn(), and setalwaysn().

◆ ca1

Signal* Signal::ca1
protected

Definition at line 156 of file vlib.h.

Referenced by asgn(), and create().

◆ ca2

Signal* Signal::ca2
protected

Definition at line 157 of file vlib.h.

Referenced by asgn(), and create().

◆ change

int Signal::change
protected

Definition at line 158 of file vlib.h.

Referenced by asgn(), clock(), create(), getchange(), init(), parameter::init(), initreg(), input(), setchange(), and wire().

◆ h

int Signal::h
protected

Definition at line 145 of file vlib.h.

Referenced by asgn(), and geth().

◆ host

Signal* Signal::host
protected

Definition at line 155 of file vlib.h.

Referenced by asgn(), clock(), create(), init(), and input().

◆ hostl

int Signal::hostl
protected

Definition at line 146 of file vlib.h.

Referenced by asgn(), create(), inout(), and output().

◆ inited

int Signal::inited
protected

Definition at line 163 of file vlib.h.

Referenced by clock(), create(), init(), input(), and Signal().

◆ l

int Signal::l
protected

◆ mask

rval Signal::mask
protected

Definition at line 147 of file vlib.h.

Referenced by asgn(), create(), getmask(), init(), makemask(), sethlmask(), setr(), setrc(), and Signal().

◆ mode

int Signal::mode
protected

Definition at line 165 of file vlib.h.

Referenced by asgn(), clock(), create(), initreg(), inout(), input(), operator=(), output(), Signal(), and wire().

◆ nedge

int Signal::nedge
protected

Definition at line 158 of file vlib.h.

Referenced by asgn(), clock(), create(), getnegedge(), init(), parameter::init(), initreg(), input(), setnegedge(), and wire().

◆ outhost

Signal* Signal::outhost
protected

Definition at line 160 of file vlib.h.

Referenced by asgn(), clock(), create(), input(), and wire().

◆ outreg

Signal* Signal::outreg
protected

Definition at line 161 of file vlib.h.

Referenced by asgn(), clock(), create(), input(), operator=(), and output().

◆ pedge

int Signal::pedge
protected

Definition at line 158 of file vlib.h.

Referenced by asgn(), clock(), create(), getposedge(), init(), parameter::init(), initreg(), input(), setposedge(), and wire().

◆ printable

int Signal::printable
protected

Definition at line 164 of file vlib.h.

Referenced by clock(), create(), inout(), input(), operator()(), operator,(), output(), and setprintable().

◆ r

rval Signal::r
protected

◆ rc

rval Signal::rc
protected

Definition at line 144 of file vlib.h.

Referenced by asgn(), clock(), create(), getval(), init(), initreg(), setrc(), Signal(), and wire().

◆ source

Signal* Signal::source
protected

Definition at line 159 of file vlib.h.

Referenced by init().

Signal::pedge
int pedge
Definition: vlib.h:158
Signal::host
Signal * host
Definition: vlib.h:155
mps_fire.i
i
Definition: mps_fire.py:355
Signal::asgn
Signal asgn(Signal)
Definition: vlib.cc:459
Signal::setr
void setr(rval rv)
Definition: vlib.h:57
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
Signal::printable
int printable
Definition: vlib.h:164
Signal::inout
void inout(int, int, const char *)
Definition: vlib.cc:717
globcontrol::getalwaysn
int getalwaysn()
Definition: vlib.h:328
Signal::setalwaysn
void setalwaysn(int n)
Definition: vlib.h:72
Signal::outhost
Signal * outhost
Definition: vlib.h:160
Signal::input
void input(int, int, const char *)
Definition: vlib.cc:545
Signal::change
int change
Definition: vlib.h:158
Signal::create
void create()
Definition: vlib.cc:13
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
gather_cfg.cout
cout
Definition: gather_cfg.py:144
Signal::inited
int inited
Definition: vlib.h:163
Signal::getalwaysn
int getalwaysn()
Definition: vlib.h:73
mwire
Definition: vlib.h:26
Signal::alwaysn
int alwaysn
Definition: vlib.h:162
Signal::source
Signal * source
Definition: vlib.h:159
Signal::getnegedge
int getnegedge()
Definition: vlib.h:67
mnum
Definition: vlib.h:26
L1DTConfigFromDB_cfi.LL
LL
Definition: L1DTConfigFromDB_cfi.py:289
Signal
Definition: vlib.h:28
Signal::getposedge
int getposedge()
Definition: vlib.h:66
Signal::nedge
int nedge
Definition: vlib.h:158
Signal::reg
void reg(int, int, const char *)
Definition: vlib.cc:756
Signal::wire
void wire(int, int, const char *)
Definition: vlib.cc:808
Signal::set
Signal set(Signal)
Definition: vlib.cc:452
alignCSCRings.s
s
Definition: alignCSCRings.py:92
rval
unsigned long long int rval
Definition: vlib.h:21
module::setchange
void setchange(int c)
Definition: vlib.h:221
Signal::getl
int getl()
Definition: vlib.h:54
Signal::setposedge
void setposedge(int ch)
Definition: vlib.h:70
Signal::l
int l
Definition: vlib.h:145
Signal::output
void output(int, int, const char *)
Definition: vlib.cc:655
trackingPlots.other
other
Definition: trackingPlots.py:1465
h
OrderedSet.t
t
Definition: OrderedSet.py:90
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
mreg
Definition: vlib.h:26
globcontrol::setchange
void setchange(int i)
Definition: vlib.cc:1206
module::AddOutReg
Signal * AddOutReg(Signal arg)
Definition: vlib.cc:1034
obnames
char const * obnames[]
Definition: vlib.cc:7
Signal::getchange
int getchange()
Definition: vlib.h:68
Signal::ca2
Signal * ca2
Definition: vlib.h:157
rname
const G4String rname[NREG]
Definition: ParametrisedEMPhysics.cc:46
glc
globcontrol glc
Definition: vlib.cc:5
globcontrol::getparent
module * getparent()
Definition: vlib.h:333
value
Definition: value.py:1
Signal::initreg
void initreg(int, int, const char *)
Definition: vlib.cc:766
Signal::r
rval r
Definition: vlib.h:140
Signal::makemask
void makemask()
Definition: vlib.cc:202
Signal::hostl
int hostl
Definition: vlib.h:146
cms::cuda::for
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
Definition: HistoContainer.h:27
Signal::ca1
Signal * ca1
Definition: vlib.h:156
Signal::outreg
Signal * outreg
Definition: vlib.h:161
NULL
#define NULL
Definition: scimark2.h:8
Signal::getr
rval getr()
Definition: vlib.h:52
Signal::getval
rval getval()
Definition: vlib.cc:415
minput
Definition: vlib.h:26
bits
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
Definition: EventSelector-behavior.doc:35
Sizeofrval
#define Sizeofrval
Definition: vlib.h:22
LaserClient_cfi.high
high
Definition: LaserClient_cfi.py:50
heppy_batch.val
val
Definition: heppy_batch.py:351
Signal::mask
rval mask
Definition: vlib.h:147
Signal::setnegedge
void setnegedge(int ch)
Definition: vlib.h:71
Signal::setchange
void setchange(int ch)
Definition: vlib.h:69
Signal::mode
int mode
Definition: vlib.h:165
moutput
Definition: vlib.h:26
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Signal::getmask
rval getmask()
Definition: vlib.h:56
Signal::h
int h
Definition: vlib.h:145
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
Signal::init
void init(int, int, const char *)
Definition: vlib.cc:208
Signal::rc
rval rc
Definition: vlib.h:144
funct::arg
A arg
Definition: Factorize.h:36
minout
Definition: vlib.h:26
dbgmsg
#define dbgmsg(a)
Definition: vlib.cc:9
Signal::setrc
void setrc(rval rv)
Definition: vlib.h:58
class-composition.parent
parent
Definition: class-composition.py:88
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
LaserClient_cfi.low
low
Definition: LaserClient_cfi.py:52