CMS 3D CMS Logo

Public Member Functions | Protected Attributes | Friends

Signal Class Reference

#include <vlib.h>

Inheritance diagram for Signal:
parameter

List of all members.

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 (int, int, const char *)
void init (const char *rname)
void init (Signal *shost, int h, int l, const char *rname)
void initreg (int, int, const char *)
void inout (int, int, const char *)
void inout (const char *rname)
void input (int, int, const char *)
void input (const char *rname)
void makemask ()
Signal operator! ()
Signal operator!= (Signal)
Signal operator% (Signal)
Signal operator& (Signal)
Signaloperator& ()
Signal operator&& (Signal)
Signal operator() (Signal, Signal)
Signal operator() (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 (int, int, const char *)
void output (const char *rname, module *parent)
void output (int high, int low, const char *rname, module *parent)
void output (const char *rname)
void reg (int, int, const char *)
void reg (const char *rname)
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 (int bits, rval value)
 Signal (unsigned int)
 Signal (const char *)
 Signal (int)
 Signal (rval)
void wire (int, int, const char *, int)
void wire (int, int, const char *)
void wire (const char *rname)

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

Definition at line 40 of file vlib.h.


Constructor & Destructor Documentation

Signal::Signal ( )

Definition at line 43 of file vlib.cc.

References create().

{
        create();
}
Signal::Signal ( rval  n)

Definition at line 184 of file vlib.cc.

References create(), init(), inited, mnum, mode, n, r, rc, and Sizeofrval.

{
        create();
        mode = mnum;
#ifdef VGEN
        ostringstream ln;
        ln << dec << n;
        init (8*Sizeofrval - 1, 0, ln.str().c_str());
#else
        init (8*Sizeofrval - 1, 0, "");
#endif
        inited = 0;
        rc = n;
        r = n;
}
Signal::Signal ( int  n)

Definition at line 200 of file vlib.cc.

References create(), init(), inited, mnum, mode, n, r, rc, and Sizeofrval.

{
        create();
        mode = mnum;
#ifdef VGEN
        ostringstream ln;
        ln << dec << n;
        init (Sizeofrval * 8 - 1, 0, ln.str().c_str());
#else
        init (Sizeofrval * 8 - 1, 0, "");
#endif
        inited = 0;
        r = (rval)n;
        rc = r;
}
Signal::Signal ( unsigned int  n)

Definition at line 216 of file vlib.cc.

References create(), init(), inited, mnum, mode, n, r, rc, and Sizeofrval.

{
        create();
        mode = mnum;
#ifdef VGEN
        ostringstream ln;
        ln << dec << n;
        init (Sizeofrval * 8 - 1, 0, ln.str().c_str());
#else
        init (Sizeofrval * 8 - 1, 0, "");
#endif
        inited = 0;
        r = (rval)n;
        rc = r;
}
Signal::Signal ( const char *  sval)

Definition at line 61 of file vlib.cc.

References bits, create(), i, init(), mask, mnum, mode, r, rc, and relativeConstraints::value.

{
        create();
        mode = mnum;
        std::string val = sval;
        int bits;
        unsigned int i;
        char radix;
        rval value = 0;
        int dig;

        sscanf(val.c_str(), "%d'%c", &bits, &radix);
        switch (radix)
        {
        case 'h':
        case 'H': 
//              sscanf (val.c_str(), "%d'%c%x", &bits, &radix, &value);
                for (i = 0; val[i] != 'h' && val[i] != 'H'; ++i);
                for (; i < val.length(); ++i)
                {
                        switch (val[i])
                        {
                        case '0':
                        case '1':
                        case '2':
                        case '3':
                        case '4':
                        case '5':
                        case '6':
                        case '7':
                        case '8':
                        case '9':
                                dig = val[i] - '0';
                                break;
                        case 'a':
                        case 'b':
                        case 'c':
                        case 'd':
                        case 'e':
                        case 'f':
                                dig = val[i] - 'a' + 10;
                                break;
                        case 'A':
                        case 'B':
                        case 'C':
                        case 'D':
                        case 'E':
                        case 'F':
                                dig = val[i] - 'A' + 10;
                                break;
                        default: 
                                dig = -1;
                                break;
                        }
                        if (dig >= 0)
                        {
                                value = value << 4;
                                value = value | dig;
                        }
                }


                break;
        case 'd':
        case 'D': 
                sscanf (val.c_str(), "%d'%c%d", &bits, &radix, reinterpret_cast<int *>(&value));
                break;
        case 'o': 
        case 'O': 
//              sscanf (val.c_str(), "%d'%c%o", &bits, &radix, &value);
                for (i = 0; val[i] != 'o' && val[i] != 'O'; ++i);
                for (; i < val.length(); ++i)
                {
                        switch (val[i])
                        {
                        case '0':
                        case '1':
                        case '2':
                        case '3':
                        case '4':
                        case '5':
                        case '6':
                        case '7':
                                dig = val[i] - '0';
                                break;
                        default: 
                                dig = -1;
                                break;
                        }
                        if (dig >= 0)
                        {
                                value = value << 3;
                                value = value | dig;
                        }
                }

                break;

        case 'b': 
        case 'B': 
                
                for (i = 0; val[i] != 'b' && val[i] != 'B'; ++i);
                for (; i < val.length(); ++i)
                {
                        switch (val[i])
                        {
                        case '0':
                                value = value << 1;
                                break;
                        case '1':
                                value = value << 1;
                                value = value | 1;
                                break;
                        }
                }
                break;
        }
        Signal::init(bits - 1, 0, val.c_str());
        rc = value & mask;
        r = rc;

}
Signal::Signal ( int  bits,
rval  value 
)

Definition at line 48 of file vlib.cc.

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

{
        create();
#ifdef VGEN     
        ostringstream sval;
        sval << dec << bits << "'d" << value;
        Signal::init(bits - 1, 0, sval.str().c_str());
#else
        Signal::init(bits - 1, 0, "");
#endif
        r = rc = value & mask;
}

Member Function Documentation

Signal Signal::asgn ( Signal  )
void Signal::clock ( const char *  rname)
void Signal::create ( void  )

Definition at line 25 of file vlib.cc.

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

Referenced by Signal().

{
#ifdef VGEN
        name = "";
        orname = "";
        obname = "";
        lb = "(";
        rb = ")";
#endif

        outhost = host = outreg = ca1 = ca2 = NULL;
        inited = printable = r = rc = l = pedge = nedge = change = alwaysn = mode = 0;
        h = 8*Sizeofrval - 1;
        mask = (rval)(- 1);
        hostl = -1;

}
int Signal::getalwaysn ( ) [inline]

Definition at line 79 of file vlib.h.

References alwaysn.

{return alwaysn;};
bool Signal::getbool ( ) [inline]

Definition at line 71 of file vlib.h.

References getval().

{return (getval() != 0);};
int Signal::getchange ( ) [inline]

Definition at line 74 of file vlib.h.

References change.

{return change;};
int Signal::geth ( ) [inline]

Definition at line 65 of file vlib.h.

References h.

{return h;};
int Signal::getint ( ) [inline]

Definition at line 63 of file vlib.h.

References r.

{return (unsigned int)r;};
int Signal::getl ( ) [inline]

Definition at line 64 of file vlib.h.

References l.

Referenced by init().

{return l;};
rval Signal::getmask ( ) [inline]

Definition at line 66 of file vlib.h.

References mask.

{return mask;};
int Signal::getnegedge ( ) [inline]

Definition at line 73 of file vlib.h.

References nedge.

{return nedge;};
int Signal::getposedge ( ) [inline]

Definition at line 72 of file vlib.h.

References pedge.

{return pedge;};
rval Signal::getr ( ) [inline]

Definition at line 62 of file vlib.h.

References r.

Referenced by init().

{return r;};
rval Signal::getval ( )

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

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

Definition at line 258 of file vlib.cc.

References change, getl(), getr(), h, host, l, makemask(), mask, mergeVDriftHistosByStation::name, nedge, pedge, r, rc, and source.

{
        host = shost; 
#ifdef VGEN
        name = rname;
        orname = rname;
        lb = "";
        rb = "";
#endif
        h = high;
        l = low;
        makemask();
        source = this;
        if (host) 
        {
                rc = (host->getr() >> (l - host->getl())) & mask;
                r = rc;
        }
        change = pedge = nedge = 0;
}
void Signal::init ( int  high,
int  low,
const char *  rname 
)

Reimplemented in parameter.

Definition at line 239 of file vlib.cc.

References h, inited, l, makemask(), mergeVDriftHistosByStation::name, and source.

Referenced by binop(), operator,(), and Signal().

{
        
#ifdef VGEN
        name = rname;
        orname = rname;
        lb = "";
        rb = "";
#endif
        if (!inited)
        {
                h = high;
                l = low;
                makemask();
                inited = 1;
        }
        source = this;
}
void Signal::init ( const char *  rname) [inline]

Definition at line 51 of file vlib.h.

References init().

Referenced by init().

{init(0, 0, rname);};
void Signal::initreg ( int  ,
int  ,
const char *   
)
void Signal::inout ( const char *  rname) [inline]

Definition at line 137 of file vlib.h.

References inout().

Referenced by inout().

{inout(0, 0, rname);};
void Signal::inout ( int  ,
int  ,
const char *   
)
void Signal::input ( int  ,
int  ,
const char *   
)
void Signal::input ( const char *  rname) [inline]

Definition at line 128 of file vlib.h.

References input().

Referenced by input().

{input(0, 0, rname);};
void Signal::makemask ( )

Definition at line 232 of file vlib.cc.

References h, l, and mask.

Referenced by init().

{
        mask = (1LL << (h - l + 1)) - 1LL;
        if (mask == 0LL) mask = ~mask;
}
Signal Signal::operator! ( )
Signal Signal::operator!= ( Signal  )
Signal Signal::operator% ( Signal  )
Signal Signal::operator& ( Signal  )
Signal * Signal::operator& ( )

Definition at line 316 of file vlib.cc.

{
#ifdef VGEN
        printable = 0;
#endif
        return this;
}
Signal Signal::operator&& ( Signal  )
Signal Signal::operator() ( Signal  ,
Signal   
)
Signal Signal::operator() ( Signal  )
Signal Signal::operator* ( Signal  )
Signal Signal::operator+ ( Signal  )
Signal Signal::operator++ ( void  ) [inline]

Definition at line 110 of file vlib.h.

{return *this = *this + 1;};
Signal Signal::operator++ ( int  ) [inline]

Definition at line 112 of file vlib.h.

{return *this = *this + 1;};            // postfix operators require some work (different names for operations and assignment printing?)
Signal Signal::operator, ( Signal  arg)

Definition at line 379 of file vlib.cc.

References ca1, ca2, getval(), h, init(), l, mask, mergeVDriftHistosByStation::name, printable, r, source, and matplotRender::t.

{
        Signal t;
#ifdef VGEN
        t.name = name + ", " + arg.name;
        t.lb = "{";
        t.rb = "}";
        printable = arg.printable = 0;
#else
        t.ca1 = this;
        t.ca2 = arg.source;
        t.init(h - l + arg.h - arg.l + 1, 0, "");
#endif
        t.r = (((getval() << (arg.h - arg.l + 1)) & (~(arg.mask))) | arg.getval()) & t.mask;
        return t;
}
Signal Signal::operator- ( Signal  )
Signal Signal::operator-- ( int  ) [inline]

Definition at line 113 of file vlib.h.

{return *this = *this - 1;};
Signal Signal::operator-- ( ) [inline]

Definition at line 111 of file vlib.h.

{return *this = *this - 1;};
Signal Signal::operator/ ( Signal  )
Signal Signal::operator< ( Signal  )
Signal Signal::operator<< ( Signal  )
Signal Signal::operator<= ( Signal  )
Signal Signal::operator= ( Signal  )

Reimplemented in parameter.

Signal Signal::operator== ( Signal  )
Signal Signal::operator> ( Signal  )
Signal Signal::operator>= ( Signal  )
Signal Signal::operator>> ( Signal  )
Signal Signal::operator^ ( Signal  )
Signal Signal::operator| ( Signal  )
Signal Signal::operator|| ( Signal  )
Signal Signal::operator~ ( )
void Signal::output ( const char *  rname,
module parent 
)
void Signal::output ( int  high,
int  low,
const char *  rname,
module parent 
)
void Signal::output ( int  ,
int  ,
const char *   
)
void Signal::output ( const char *  rname) [inline]

Definition at line 132 of file vlib.h.

References output().

Referenced by output().

{output(0, 0, rname);};
void Signal::reg ( const char *  rname) [inline]

Definition at line 141 of file vlib.h.

References reg().

Referenced by reg().

{reg(0, 0, rname);};
void Signal::reg ( int  ,
int  ,
const char *   
)
Signal Signal::set ( Signal  )
void Signal::setalwaysn ( int  n) [inline]

Definition at line 78 of file vlib.h.

References alwaysn.

{alwaysn = (n == -1) ? 0 : n;};
void Signal::setchange ( int  ch) [inline]

Definition at line 75 of file vlib.h.

References change.

{change = ch;};
void Signal::sethlmask ( int  high,
int  low,
rval  imask 
) [inline]

Definition at line 69 of file vlib.h.

References h, l, and mask.

{h = high; l = low; mask = imask;};
void Signal::setnegedge ( int  ch) [inline]

Definition at line 77 of file vlib.h.

References nedge.

{nedge = ch;};
void Signal::setposedge ( int  ch) [inline]

Definition at line 76 of file vlib.h.

References pedge.

{pedge = ch;};
void Signal::setprintable ( int  p) [inline]

Definition at line 80 of file vlib.h.

References L1TEmulatorMonitor_cff::p, and printable.

{printable = p;};
void Signal::setr ( rval  rv) [inline]

Definition at line 67 of file vlib.h.

References mask, and r.

{r = rv & mask;};
void Signal::setrc ( rval  rv) [inline]

Definition at line 68 of file vlib.h.

References mask, and rc.

{rc = rv & mask;};
void Signal::wire ( int  ,
int  ,
const char *  ,
int   
)
void Signal::wire ( const char *  rname) [inline]

Definition at line 145 of file vlib.h.

References wire().

Referenced by wire().

{wire(0, 0, rname);};
void Signal::wire ( int  ,
int  ,
const char *   
)

Friends And Related Function Documentation

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

Member Data Documentation

int Signal::alwaysn [protected]

Definition at line 168 of file vlib.h.

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

Signal* Signal::ca1 [protected]

Definition at line 162 of file vlib.h.

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

Signal* Signal::ca2 [protected]

Definition at line 163 of file vlib.h.

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

int Signal::change [protected]

Definition at line 164 of file vlib.h.

Referenced by binop(), create(), getchange(), init(), and setchange().

int Signal::h [protected]

Definition at line 151 of file vlib.h.

Referenced by create(), geth(), init(), makemask(), operator,(), and sethlmask().

Signal* Signal::host [protected]

Definition at line 161 of file vlib.h.

Referenced by create(), and init().

int Signal::hostl [protected]

Definition at line 152 of file vlib.h.

Referenced by create().

int Signal::inited [protected]

Definition at line 169 of file vlib.h.

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

int Signal::l [protected]

Definition at line 151 of file vlib.h.

Referenced by create(), getl(), init(), makemask(), operator,(), and sethlmask().

rval Signal::mask [protected]

Definition at line 153 of file vlib.h.

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

int Signal::mode [protected]

Definition at line 171 of file vlib.h.

Referenced by create(), and Signal().

int Signal::nedge [protected]

Definition at line 164 of file vlib.h.

Referenced by create(), getnegedge(), init(), and setnegedge().

Signal* Signal::outhost [protected]

Definition at line 166 of file vlib.h.

Referenced by create().

Signal* Signal::outreg [protected]

Definition at line 167 of file vlib.h.

Referenced by create().

int Signal::pedge [protected]

Definition at line 164 of file vlib.h.

Referenced by create(), getposedge(), init(), and setposedge().

int Signal::printable [protected]

Definition at line 170 of file vlib.h.

Referenced by binop(), create(), operator,(), and setprintable().

rval Signal::r [protected]

Definition at line 145 of file vlib.h.

Referenced by binop(), create(), getint(), getr(), init(), parameter::operator int(), operator,(), setr(), and Signal().

rval Signal::rc [protected]

Definition at line 150 of file vlib.h.

Referenced by create(), init(), setrc(), and Signal().

Signal* Signal::source [protected]

Definition at line 165 of file vlib.h.

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