76 static int bufferSize;
116 int HasZ(
void ) {
return (~aval & bval) != 0; }
121 int HasX(
void ) {
return (aval & bval) != 0; }
127 {
return _signed && ((aval>>(width-1)) & 1) != 0 && !
HasXZ(); }
149 void Sized(
int sized ) { this->sized = sized; }
161 void Based(
int based ) { this->based = based; }
173 void Unbased(
int unbased ) { this->unbased = unbased; }
183 void Signed(
int _signed ) { this->_signed = _signed; }
236 int LoadHex(
const char*
string );
347 aval = (
unsigned int)v;
432 int IsWidthConstant() {
return TRUE; }
433 int IsWidthVolatile() {
return FALSE; }
434 int IsWidthEvaluateable() {
return TRUE; }
435 CNode* GetWidthExp();
439 void GrowBuffer(
int bytes )
441 if( bytes <= bufferSize ) {
444 if( buffer != NULL ) {
447 bufferSize = bytes * 2;
460 void*
operator new(
size_t size,
CObstack* heap) {
461 return heap->Alloc( size );
473 inline void Le(
CVector* r,
double* a,
double* b )
484 inline void Lt(
CVector* r,
double* a,
double* b )
495 inline void Ge(
CVector* r,
double* a,
double* b )
506 inline void Gt(
CVector* r,
double* a,
double* b )
518 inline void Ne(
CVector* r,
double* a,
double* b )
528 inline void Eq(
CVector* r,
double* a,
double* b )
538 inline void Cne(
CVector*,
double*,
double* )
540 fatal( NULL,
"!== illegal for reals" );
548 inline void Ceq(
CVector*,
double*,
double* )
550 fatal( NULL,
"=== illegal for reals" );
567 inline void Hook(
double* r,
CVector* c,
double* a,
double* b )
570 LogicalValue( &cond, c );
573 }
else if( cond == 0) {
580 inline void Cat(
double*,
double*,
double* )
582 fatal( NULL,
"=== illegal for reals" );
588 #endif // CVECTOR_HPP void * shell_xmalloc(int s)
Definition: main.cc:369
Infinite precision unsigned arithmetic class Storage within object will be used whenever possible...
Definition: cuint.h:50
void Unbased(int unbased)
Set unbased attribute.
Definition: cvector.h:173
void Add(double *r, double *a, double *b)
Definition: cnode.h:682
void fatal(struct Coord_t *location, const char *format,...)
This routine should not be used by plugins.
void SetPreferredBase(int base)
Set preferred base for printing value.
Definition: cvector.h:132
int Overflowed()
Determine if conversion from ascii overflowed the give vector width.
Definition: cvector.h:189
void Neg(double *r, double *a)
Definition: cnode.h:702
void SetToX()
Set vector value to X.
int HasX(void)
Determine if any bit is a x.
Definition: cvector.h:121
char * GetDecimal(void)
Convert vector to decimal string.
void SetWidth(INT32 newWidth)
Set width of vector in bits.
void shell_xfree(void *p, int s)
Definition: main.cc:365
long INT32
Short cut for signed 32 bit integer.
Definition: glue.h:38
int operator!=(CVector &v)
Inequality operator.
Definition: cvector.h:302
void Signed(int _signed)
set signed attribute.
Definition: cvector.h:183
static CVector * AllocFromHeap(CObstack *aHeap, int width)
Create vector allocating all storage from given heap.
Definition: cvector.h:85
void Bval(const CUInt &v)
set bval part of this vector.
Definition: cvector.h:385
signed long long INT64
Short cut for signed 64 bit integer.
Definition: glue.h:51
unsigned Hash()
Calculate a hash for vector value.
void Based(int based)
Set based attribute.
Definition: cvector.h:161
int HasXZ()
Determine if any bit is either x or z.
Definition: cvector.h:111
void Sized(int sized)
Set sized attribute.
Definition: cvector.h:149
int Based()
Get based attribute.
Definition: cvector.h:155
int HasZ(void)
Determine if any bit is a z.
Definition: cvector.h:116
Bulk object allocation object.
Definition: cobstack.h:46
void LoadReal(double d)
Load vector with integer part of real value.
int operator!=(UINT32 i)
Inequality operator.
Definition: cvector.h:308
void Aval(const CUInt &v)
set aval part of this vector.
Definition: cvector.h:378
Primary data structure representing parse tree nodes.
Definition: cnode.h:197
const CUInt & Aval()
return aval part of this vector.
Definition: cvector.h:364
INT32 GetINT32(void)
Get value as a 32 bit integer.
Definition: cvector.h:314
int Unbased()
Get unbased attribute.
Definition: cvector.h:167
void Pow(double *r, double *a, double *b)
Definition: cnode.h:712
char * GetString(void)
Convert vector to ascii string.
int LoadDecimal(const char *string)
Load decimal value from string.
char * GetBinary(void)
Convert vector to binary string.
void Div(double *r, double *a, double *b)
Definition: cnode.h:697
void SetHeap(CObstack *aHeap)
Set heap to be used for storage allocation.
Definition: cuint.h:119
int IsNegative()
Determine if value is negative.
Definition: cvector.h:126
void Sub(double *r, double *a, double *b)
Definition: cnode.h:687
const CUInt & Bval()
return bval part of this vector.
Definition: cvector.h:371
int Sized()
Get sized attribute.
Definition: cvector.h:143
char * GetOctal(void)
Convert vector to octal string.
double GetReal()
Get vector value as a real.
CVector(INT32 aWidth)
Create bit vector of given width.
Bit vector class for implementing 4 state verilog signed and unsigned arithmetic. ...
Definition: cvector.h:58
void LoadINT32(INT32 v)
Load vector with integer value.
Definition: cvector.h:345
INT64 GetINT64(void)
Get value as a 64 bit integer.
Definition: cvector.h:330
unsigned long UINT32
Short cut for unsigned 32 bit integer.
Definition: glue.h:47
void Mul(double *r, double *a, double *b)
Definition: cnode.h:692
int LoadOctal(const char *string)
Load octal value from string.
int GetPreferredBase()
Get preferred base for printing value.
Definition: cvector.h:137
void Plus(double *r, double *a)
Definition: cnode.h:707
INT32 GetWidth(void)
Get vector bit width.
char * GetVString(void)
Convert vector to string using preferred base.
int LoadString(const char *string)
Load string value from string.
~CVector()
Destroy vector freeing storage if possible.
NodeType_t
Expression node type.
Definition: cdatatype.h:101
int Signed() const
Get signed attribute.
Definition: cvector.h:178
char * GetHex(void)
Convert vector to hex string.
const CVector & operator=(const CVector &v)
Assignment operator.
int operator==(CVector &v)
Equality operator.
int LoadHex(const char *string)
Load hex value from string.
int LoadBinary(const char *string)
Load binary value from string.