#include <const.h>
Inheritance diagram for vhdl_const:
Public Member Functions | |
vhdl_const (void) | |
void * | operator new (unsigned int num_bytes) |
Disallow the default new operator. | |
void * | operator new (unsigned int num_bytes, pool *mem_pool) |
Overloaded new. | |
virtual const uint | get_cn_kind (void) |
shared virtual functions | |
virtual void | set_val (int i) |
const_range_signed | |
virtual const int | get_val (void) |
virtual void | set_uval (uint u) |
const_range_unsigned | |
virtual const uint | get_uval (void) |
virtual void | set_real (float f) |
const_real | |
virtual const float | get_real (void) |
virtual void | set_agg_ty (pType ty) |
virtual const pType | get_agg_ty (void) |
virtual void | set_tree (NODE *tree) |
virtual const NODE * | get_tree (void) |
Like types in VHDL, constants come in two flavors: named and anonymous.
Named constants are created by:
The value of a declared constant may be deferred until the design is elaborated. However, after elaboration the values of all named constants must be known.
The classes in this file define anonymous constants. If the object is a named constant, an anonymous constant will be allocated and it will be used to initialize a sym_const object.
There are five kinds of constant:
Note that an enumeration value is a named constant. So it will have a symbol and an associated const_range object giving the enumeration value.
Ranges are limited to bounds that can be represented in 32-bits. Note that "x" and "z" are not scalar values. In VHDL "x" and "z" are enumeration values defined as part of packages like std_logic.
Array and record constants are aggragates, whose type is defined by their context. Depending on where they are used (e.g., in a process or in a function) an aggragate will be implemented by static initialized data or via generated code. The choice also depends on the aggragate itself. Even in cases where an aggragate could be created in static initialized data, it may be more efficient to generate code for it.
The choice of what to do with an aggragate is made after the QT trees have been constructed. So initially all aggragate constants have a pointer to a QT tree that represents the aggragate. This also allows aggragates to be composed of sub-aggragates. Later these can all be "flattened".
Definition at line 105 of file const.h.
|
Definition at line 107 of file const.h.
00107 { } |
|
Reimplemented in const_agg. Definition at line 169 of file const.h. References NULL.
00170 { 00171 return NULL; 00172 } |
|
shared virtual functions
Reimplemented in const_range_signed, const_range_unsigned, const_real, and const_agg. Definition at line 125 of file const.h. References bad_constant, and uint.
00125 { return bad_constant; } |
|
Reimplemented in const_real. Definition at line 157 of file const.h. References FALSE.
00158 { 00159 assert( FALSE ); 00160 return (float)0.0; 00161 } |
|
Reimplemented in const_agg. Definition at line 180 of file const.h. References NULL.
00181 { 00182 return NULL; 00183 } |
|
Reimplemented in const_range_unsigned. Definition at line 146 of file const.h.
00147 {
00148 assert( FALSE );
00149 return 0;
00150 }
|
|
Reimplemented in const_range_signed. Definition at line 135 of file const.h. References FALSE.
00136 {
00137 assert( FALSE );
00138 return 0;
00139 }
|
|
Overloaded new.
Definition at line 119 of file const.h. References pool::GetMem().
00120 { 00121 return mem_pool->GetMem( num_bytes ); 00122 } |
|
Disallow the default new operator.
Definition at line 110 of file const.h.
00111 { 00112 assert( FALSE ); 00113 return NULL; 00114 } |
|
Reimplemented in const_agg. Definition at line 165 of file const.h. References FALSE.
00166 { 00167 assert( FALSE ); 00168 } |
|
Reimplemented in const_real. Definition at line 153 of file const.h. References FALSE.
00154 { 00155 assert( FALSE ); 00156 } |
|
Reimplemented in const_agg. Definition at line 176 of file const.h. References FALSE.
00177 { 00178 assert( FALSE ); 00179 } |
|
Reimplemented in const_range_unsigned. Definition at line 142 of file const.h. References FALSE.
00143 { 00144 assert( FALSE ); 00145 } |
|
Reimplemented in const_range_signed. Definition at line 131 of file const.h. References FALSE.
00132 { 00133 assert( FALSE ); 00134 } |