CMS 3D CMS Logo

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

#include <vlib.h>

Inheritance diagram for module:
function

Public Member Functions

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 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 198 of file vlib.h.

Constructor & Destructor Documentation

◆ module()

module::module ( )

◆ ~module()

module::~module ( )
virtual

Definition at line 915 of file vlib.cc.

915  {
916  for (unsigned int i = 0; i < sizeof(outreg) / sizeof(Signal*); ++i) {
917  if (outreg[i] != nullptr)
918  delete outreg[i];
919  }
920 }

References mps_fire::i, and outreg.

Member Function Documentation

◆ AddOutReg()

Signal * module::AddOutReg ( Signal  arg)

Definition at line 1034 of file vlib.cc.

1034  {
1035  if (outreg[outregn] == nullptr) {
1036  outreg[outregn] = new Signal;
1037  outreg[outregn]->setr(0);
1038  }
1039  outreg[outregn]->reg(arg.geth(), arg.getl(), "");
1040  outregn++;
1041  return outreg[outregn - 1];
1042 }

References outreg, outregn, Signal::reg(), Signal::setr(), and muonRPCDigis_cfi::Signal.

Referenced by Signal::clock(), and Signal::input().

◆ create()

void module::create ( )

Definition at line 906 of file vlib.cc.

906  {
907  for (unsigned int i = 0; i < sizeof(outreg) / sizeof(Signal*); ++i)
908  outreg[i] = nullptr;
909  outregn = 0;
910  runperiod = nullptr;
911 }

References mps_fire::i, outreg, outregn, and runperiod.

Referenced by module().

◆ getchange()

int module::getchange ( )
inline

Definition at line 222 of file vlib.h.

222 { return change; }

References change.

◆ getswitch()

Signal module::getswitch ( )
inline

Definition at line 217 of file vlib.h.

217 { return switcharg[switchn - 1]; };

References switcharg, and switchn.

◆ ifelse()

Signal module::ifelse ( Signal  condition,
Signal  iftrue,
Signal  iffalse 
)

Definition at line 1044 of file vlib.cc.

1044  {
1045 #ifdef VGEN
1046  Signal t;
1047  string ln;
1048  ln = "(" + condition.getname() + ") ? " + iftrue.getname() + " : " + iffalse.getname();
1049  t.setname(ln);
1050  return t;
1051 #else
1052  if (condition.getbool())
1053  return iftrue;
1054  else
1055  return iffalse;
1056 #endif
1057 }

References goodZToMuMu_cfi::condition, and OrderedSet::t.

◆ init() [1/3]

void module::init ( const char *  mname,
const char *  iname 
)

Definition at line 922 of file vlib.cc.

922  {
923 #ifdef VGEN
924  name = mname;
925  instname = iname;
926 #endif
927 }

References instname, and Skims_PA_cff::name.

◆ init() [2/3]

void module::init ( const char *  mname,
const char *  iname,
int  index 
)

Definition at line 937 of file vlib.cc.

937  {
938 #ifdef VGEN
939  name = mname;
940  ostringstream instnamestream;
941  instnamestream << iname << dec << index;
942  instname = instnamestream.str().c_str();
943 #endif
944 }

References TauDecayModes::dec, instname, and Skims_PA_cff::name.

◆ init() [3/3]

void module::init ( const char *  mname,
const char *  iname,
module fixt 
)

Definition at line 929 of file vlib.cc.

929  {
930 #ifdef VGEN
931  name = mname;
932  instname = iname;
933 #endif
934  tfixt = fixt;
935 }

References instname, Skims_PA_cff::name, and tfixt.

◆ negedge()

Signal module::negedge ( Signal  arg)

Definition at line 1019 of file vlib.cc.

1019  {
1020  Signal t;
1021 #ifdef VGEN
1022  string ln = "";
1023  ln = "negedge " + arg.getname();
1024  t.init(NULL, 0, 0, ln.c_str());
1025 #else
1026  t.init(nullptr, 0, 0, "");
1027 #endif
1028  if (arg.getnegedge())
1029  glc.setce(0);
1030  t.setchange(arg.getnegedge());
1031  return t;
1032 }

References glc, NULL, globcontrol::setce(), and OrderedSet::t.

◆ operator()()

virtual void module::operator() ( )
inlinevirtual

Definition at line 206 of file vlib.h.

206 {};

◆ popswitch()

void module::popswitch ( )
inline

Definition at line 218 of file vlib.h.

218 { switchn--; }

References switchn.

◆ posedge()

Signal module::posedge ( Signal  arg)

Definition at line 1004 of file vlib.cc.

1004  {
1005  Signal t;
1006 #ifdef VGEN
1007  string ln = "";
1008  ln = "posedge " + arg.getname();
1009  t.init(NULL, 0, 0, ln.c_str());
1010 #else
1011  t.init(nullptr, 0, 0, "");
1012 #endif
1013  if (arg.getposedge())
1014  glc.setce(0);
1015  t.setchange(arg.getposedge());
1016  return t;
1017 }

References glc, NULL, globcontrol::setce(), and OrderedSet::t.

◆ pushswitch()

void module::pushswitch ( Signal  arg)
inline

Definition at line 213 of file vlib.h.

213  {
214  switcharg[switchn] = arg;
215  switchn++;
216  };

References switcharg, and switchn.

◆ setchange()

void module::setchange ( int  c)
inline

Definition at line 221 of file vlib.h.

221 { change = c; }

References HltBtagPostValidation_cff::c, and change.

Referenced by Signal::clock(), Signal::initreg(), Signal::input(), and Signal::wire().

◆ vbeginmodule()

void module::vbeginmodule ( )

Definition at line 971 of file vlib.cc.

971  {
972  switchn = 0;
973 #ifdef VGEN
974  string filename = name + ".v";
975  cout << glc.getmargin() << name << " " << instname << std::endl << flush;
976  cout << glc.getmargin() << "(" << glc.PrintIO(true).c_str() << std::endl << flush;
977  cout << glc.getmargin() << ");\n" << flush;
978  vfile.open(filename.c_str());
979  outbuf = std::cout.rdbuf(vfile.rdbuf());
980  OuterIndPos = glc.getpos();
981  oldenmarg = glc.getenablemargin();
982  glc.enablemargin(1);
983  glc.setpos(0);
984  PrintHeader();
985  cout << glc.getmargin() << "module " << name << std::endl << glc.getmargin() << "(" << flush;
986  glc.setfunction(0);
987  glc.Print();
988  glc.setFileOpen(1);
989 #endif
990 }

References gather_cfg::cout, corrVsCorr::filename, glc, instname, Skims_PA_cff::name, oldenmarg, OuterIndPos, globcontrol::setfunction(), and switchn.

◆ vendmodule()

void module::vendmodule ( )

Definition at line 992 of file vlib.cc.

992  {
993 #ifdef VGEN
994  glc.Outdent();
995  cout << glc.getmargin() << "endmodule\n" << flush;
996  glc.setpos(OuterIndPos);
997  cout.rdbuf(outbuf);
998  vfile.close();
999  glc.enablemargin(oldenmarg);
1000 #endif
1001  outregn = 0;
1002 }

References gather_cfg::cout, glc, oldenmarg, OuterIndPos, and outregn.

Member Data Documentation

◆ change

int module::change
protected

Definition at line 241 of file vlib.h.

Referenced by getchange(), and setchange().

◆ instname

std::string module::instname
protected

Definition at line 232 of file vlib.h.

Referenced by init(), and vbeginmodule().

◆ itern

int module::itern
protected

Definition at line 242 of file vlib.h.

◆ oldenmarg

int module::oldenmarg
protected

Definition at line 236 of file vlib.h.

Referenced by function::vbeginfunction(), vbeginmodule(), function::vendfunction(), and vendmodule().

◆ OuterIndPos

int module::OuterIndPos
protected

Definition at line 233 of file vlib.h.

Referenced by function::vbeginfunction(), vbeginmodule(), function::vendfunction(), and vendmodule().

◆ outreg

Signal* module::outreg[1000]
protected

Definition at line 237 of file vlib.h.

Referenced by AddOutReg(), create(), and ~module().

◆ outregn

int module::outregn
protected

Definition at line 238 of file vlib.h.

Referenced by AddOutReg(), create(), function::vendfunction(), and vendmodule().

◆ passn

rval module::passn
protected

Definition at line 243 of file vlib.h.

◆ runperiod

void(* module::runperiod) ()
protected

Definition at line 239 of file vlib.h.

Referenced by create().

◆ switcharg

Signal module::switcharg[10]
protected

Definition at line 234 of file vlib.h.

Referenced by getswitch(), and pushswitch().

◆ switchn

int module::switchn
protected

Definition at line 235 of file vlib.h.

Referenced by getswitch(), popswitch(), pushswitch(), function::vbeginfunction(), and vbeginmodule().

◆ tfixt

module* module::tfixt
protected

Definition at line 240 of file vlib.h.

Referenced by init().

module::switcharg
Signal switcharg[10]
Definition: vlib.h:234
mps_fire.i
i
Definition: mps_fire.py:355
muonRPCDigis_cfi.Signal
Signal
Definition: muonRPCDigis_cfi.py:29
Signal::setr
void setr(rval rv)
Definition: vlib.h:57
gather_cfg.cout
cout
Definition: gather_cfg.py:144
Signal
Definition: vlib.h:28
module::outreg
Signal * outreg[1000]
Definition: vlib.h:237
Signal::reg
void reg(int, int, const char *)
Definition: vlib.cc:756
module::outregn
int outregn
Definition: vlib.h:238
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
OrderedSet.t
t
Definition: OrderedSet.py:90
globcontrol::setfunction
void setfunction(int i)
Definition: vlib.h:334
module::tfixt
module * tfixt
Definition: vlib.h:240
glc
globcontrol glc
Definition: vlib.cc:5
module::OuterIndPos
int OuterIndPos
Definition: vlib.h:233
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
goodZToMuMu_cfi.condition
condition
Definition: goodZToMuMu_cfi.py:37
NULL
#define NULL
Definition: scimark2.h:8
module::change
int change
Definition: vlib.h:241
module::runperiod
void(* runperiod)()
Definition: vlib.h:239
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
funct::arg
A arg
Definition: Factorize.h:36
module::create
void create()
Definition: vlib.cc:906
module::instname
std::string instname
Definition: vlib.h:232
globcontrol::setce
int setce(int c)
Definition: vlib.h:341
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
module::switchn
int switchn
Definition: vlib.h:235
module::oldenmarg
int oldenmarg
Definition: vlib.h:236