CMS 3D CMS Logo

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

#include <vlib.h>

Inheritance diagram for function:
module

Public Member Functions

 function ()
 
void init (int, int, const char *)
 
void makemask (int hpar, int lpar)
 
void vbeginfunction ()
 
void vendfunction ()
 
- Public Member Functions inherited from module
SignalAddOutReg (Signal arg)
 
void create ()
 
int getchange ()
 
Signal getswitch ()
 
Signal ifelse (Signal, Signal, Signal)
 
void init (const char *, const char *)
 
void init (const char *, const char *, int)
 
void init (const char *, const char *, module *fixt)
 
 module ()
 
Signal negedge (Signal)
 
virtual void operator() ()
 
void popswitch ()
 
Signal posedge (Signal)
 
void pushswitch (Signal arg)
 
void setchange (int c)
 
void vbeginmodule ()
 
void vendmodule ()
 
virtual ~module ()
 

Protected Attributes

int h
 
int l
 
rval mask
 
int OldChange
 
Signal result
 
- Protected Attributes inherited from module
int change
 
std::string instname
 
int itern
 
int oldenmarg
 
int OuterIndPos
 
Signaloutreg [1000]
 
int outregn
 
rval passn
 
void(* runperiod )()
 
Signal switcharg [10]
 
int switchn
 
moduletfixt
 

Detailed Description

Definition at line 246 of file vlib.h.

Constructor & Destructor Documentation

◆ function()

function::function ( )
inline

Definition at line 248 of file vlib.h.

248 {};

Member Function Documentation

◆ init()

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

Definition at line 1071 of file vlib.cc.

1071  {
1072 #ifdef VGEN
1073  name = rname;
1074  cout << "`include " << '"' << name << ".v" << '"' << "\n" << flush;
1075 #endif
1076  if (high >= low) {
1077  h = high;
1078  l = low;
1079  } else {
1080  h = low;
1081  l = high;
1082  }
1083  makemask(h, l);
1084 }

References gather_cfg::cout, LaserClient_cfi::high, l, LaserClient_cfi::low, makemask(), Skims_PA_cff::name, and rname.

◆ makemask()

void function::makemask ( int  hpar,
int  lpar 
)

Definition at line 1061 of file vlib.cc.

1061  {
1062  //int i;
1063  unsigned int lng = hpar - lpar + 1;
1064 
1065  if (lng < Sizeofrval * 8)
1066  mask = (1LL << lng) - 1;
1067  else
1068  mask = (rval)(-1);
1069 }

References L1DTConfigBti_cff::LL, mask, and Sizeofrval.

Referenced by init().

◆ vbeginfunction()

void function::vbeginfunction ( )

Definition at line 1086 of file vlib.cc.

1086  {
1087 #ifdef VGEN
1088  string filename = name + ".v";
1089  retname = name + "(" + glc.PrintIO(false) + ")";
1090  vfile.open(filename.c_str());
1091  outbuf = std::cout.rdbuf(vfile.rdbuf());
1092  OuterIndPos = glc.getpos();
1093  oldenmarg = glc.getenablemargin();
1094  glc.enablemargin(1);
1095  glc.setpos(0);
1096  PrintHeader();
1097  cout << glc.getmargin() << "function [" << dec << h << ":" << l << "] " << name << ";\n" << flush;
1098  glc.setfunction(1);
1099  glc.Print();
1100  glc.setFileOpen(1);
1101  result.setname(name);
1102  result.setbrackets("", "");
1103 #endif
1104  switchn = 0;
1105  OldChange = glc.getchange();
1106 }

References gather_cfg::cout, TauDecayModes::dec, corrVsCorr::filename, globcontrol::getchange(), glc, l, Skims_PA_cff::name, OldChange, module::oldenmarg, module::OuterIndPos, result, globcontrol::setfunction(), and module::switchn.

◆ vendfunction()

void function::vendfunction ( )

Definition at line 1108 of file vlib.cc.

1108  {
1109  result.sethlmask(h, l, mask);
1110  result.setr(result.getr() & mask);
1112 #ifdef VGEN
1113  glc.Outdent();
1114  cout << glc.getmargin() << "endfunction\n" << flush;
1115  glc.setpos(OuterIndPos);
1116  cout.rdbuf(outbuf);
1117  result.setname(retname);
1118  result.setbrackets("", "");
1119  vfile.close();
1120  glc.enablemargin(oldenmarg);
1121 #endif
1122  outregn = 0;
1123 }

References gather_cfg::cout, Signal::getr(), glc, l, mask, OldChange, module::oldenmarg, module::OuterIndPos, module::outregn, result, globcontrol::setchange(), Signal::sethlmask(), and Signal::setr().

Member Data Documentation

◆ h

int function::h
protected

Definition at line 258 of file vlib.h.

◆ l

int function::l
protected

Definition at line 258 of file vlib.h.

Referenced by init(), vbeginfunction(), and vendfunction().

◆ mask

rval function::mask
protected

Definition at line 259 of file vlib.h.

Referenced by makemask(), and vendfunction().

◆ OldChange

int function::OldChange
protected

Definition at line 260 of file vlib.h.

Referenced by vbeginfunction(), and vendfunction().

◆ result

Signal function::result
protected

Definition at line 261 of file vlib.h.

Referenced by vbeginfunction(), and vendfunction().

Signal::setr
void setr(rval rv)
Definition: vlib.h:57
function::result
Signal result
Definition: vlib.h:261
function::OldChange
int OldChange
Definition: vlib.h:260
gather_cfg.cout
cout
Definition: gather_cfg.py:144
Signal::sethlmask
void sethlmask(int high, int low, rval imask)
Definition: vlib.h:59
module::outregn
int outregn
Definition: vlib.h:238
rval
unsigned long long int rval
Definition: vlib.h:21
function::mask
rval mask
Definition: vlib.h:259
globcontrol::getchange
int getchange()
Definition: vlib.h:331
function::l
int l
Definition: vlib.h:258
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
h
globcontrol::setfunction
void setfunction(int i)
Definition: vlib.h:334
globcontrol::setchange
void setchange(int i)
Definition: vlib.cc:1206
rname
const G4String rname[NREG]
Definition: ParametrisedEMPhysics.cc:46
glc
globcontrol glc
Definition: vlib.cc:5
module::OuterIndPos
int OuterIndPos
Definition: vlib.h:233
Signal::getr
rval getr()
Definition: vlib.h:52
L1DTConfigBti_cff.LL
LL
Definition: L1DTConfigBti_cff.py:25
function::makemask
void makemask(int hpar, int lpar)
Definition: vlib.cc:1061
Sizeofrval
#define Sizeofrval
Definition: vlib.h:22
LaserClient_cfi.high
high
Definition: LaserClient_cfi.py:50
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
LaserClient_cfi.low
low
Definition: LaserClient_cfi.py:52
module::switchn
int switchn
Definition: vlib.h:235
module::oldenmarg
int oldenmarg
Definition: vlib.h:236