CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 *, module *fixt)
 
void init (const char *, const char *, int)
 
 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 257 of file vlib.h.

Constructor & Destructor Documentation

function::function ( )
inline

Definition at line 260 of file vlib.h.

260 {};

Member Function Documentation

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

Definition at line 1169 of file vlib.cc.

References gather_cfg::cout, h, l, makemask(), and mergeVDriftHistosByStation::name.

1170 {
1171 #ifdef VGEN
1172  name = rname;
1173  cout << "`include " << '"' <<name << ".v" << '"' << "\n" << flush;
1174 #endif
1175  if (high >= low)
1176  {
1177  h = high;
1178  l = low;
1179  }
1180  else
1181  {
1182  h = low;
1183  l = high;
1184  }
1185  makemask(h, l);
1186 }
int l
Definition: vlib.h:269
void makemask(int hpar, int lpar)
Definition: vlib.cc:1158
int h
Definition: vlib.h:269
tuple cout
Definition: gather_cfg.py:121
void function::makemask ( int  hpar,
int  lpar 
)

Definition at line 1158 of file vlib.cc.

References mask, and Sizeofrval.

Referenced by init().

1159 {
1160  //int i;
1161  unsigned int lng = hpar - lpar + 1;
1162 
1163  if (lng < Sizeofrval * 8)
1164  mask = (1LL << lng) - 1;
1165  else
1166  mask = (rval)(-1);
1167 }
rval mask
Definition: vlib.h:270
#define Sizeofrval
Definition: vlib.h:24
unsigned long long int rval
Definition: vlib.h:23
void function::vbeginfunction ( )

Definition at line 1188 of file vlib.cc.

References gather_cfg::cout, lut2db_cfg::filename, globcontrol::getchange(), h, l, mergeVDriftHistosByStation::name, OldChange, module::oldenmarg, module::OuterIndPos, result, globcontrol::setfunction(), and module::switchn.

1189 {
1190 #ifdef VGEN
1191  string filename = name + ".v";
1192  retname = name + "(" + glc.PrintIO(false) + ")";
1193  vfile.open (filename.c_str());
1194  outbuf = std::cout.rdbuf(vfile.rdbuf());
1195  OuterIndPos = glc.getpos();
1196  oldenmarg = glc.getenablemargin();
1197  glc.enablemargin(1);
1198  glc.setpos(0);
1199  PrintHeader();
1200  cout << glc.getmargin() << "function [" << dec << h << ":" << l << "] " << name << ";\n" << flush;
1201  glc.setfunction(1);
1202  glc.Print();
1203  glc.setFileOpen(1);
1204  result.setname(name);
1205  result.setbrackets("", "");
1206 #endif
1207  switchn = 0;
1208  OldChange = glc.getchange();
1209 }
int l
Definition: vlib.h:269
Signal result
Definition: vlib.h:272
int h
Definition: vlib.h:269
int switchn
Definition: vlib.h:244
int oldenmarg
Definition: vlib.h:245
int OldChange
Definition: vlib.h:271
int getchange()
Definition: vlib.h:307
globcontrol glc
Definition: vlib.cc:6
int OuterIndPos
Definition: vlib.h:242
void setfunction(int i)
Definition: vlib.h:310
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
void function::vendfunction ( )

Definition at line 1211 of file vlib.cc.

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

1212 {
1213 
1214  result.sethlmask(h, l, mask);
1215  result.setr(result.getr() & mask);
1217 #ifdef VGEN
1218  glc.Outdent();
1219  cout << glc.getmargin() << "endfunction\n" << flush;
1220  glc.setpos(OuterIndPos);
1221  cout.rdbuf(outbuf);
1222  result.setname(retname);
1223  result.setbrackets("", "");
1224  vfile.close();
1225  glc.enablemargin(oldenmarg);
1226 #endif
1227  outregn = 0;
1228 }
int l
Definition: vlib.h:269
void setr(rval rv)
Definition: vlib.h:67
void sethlmask(int high, int low, rval imask)
Definition: vlib.h:69
Signal result
Definition: vlib.h:272
int h
Definition: vlib.h:269
rval getr()
Definition: vlib.h:62
int oldenmarg
Definition: vlib.h:245
rval mask
Definition: vlib.h:270
int OldChange
Definition: vlib.h:271
void setchange(int i)
Definition: vlib.cc:1324
globcontrol glc
Definition: vlib.cc:6
int OuterIndPos
Definition: vlib.h:242
int outregn
Definition: vlib.h:247
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

int function::h
protected

Definition at line 269 of file vlib.h.

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

int function::l
protected
rval function::mask
protected

Definition at line 270 of file vlib.h.

Referenced by makemask(), and vendfunction().

int function::OldChange
protected

Definition at line 271 of file vlib.h.

Referenced by vbeginfunction(), and vendfunction().

Signal function::result
protected

Definition at line 272 of file vlib.h.

Referenced by vbeginfunction(), and vendfunction().