Beruflich Dokumente
Kultur Dokumente
Identifiers
Consists of sequence of one or more characters The legal characters are
Keywords
A set of reserved words in a language that have a special meaning E.g. (entity, is, port, architecture, of, begin, end, when, process, if, elsif, else, component, and, or, etc.)
Data Objects
A data object holds a value of a specified type A data object is created using an object declaration
E.g. signal a_bar : bit; This creates a data object called a_bar, which can hold bit values
Classes of Objects
Constant Variable Signal File
Constant
An object of constant class can hold a single value of a given type This value is assigned to the constant before the simulation starts The value of a constant object cannot change during the simulation A constant object is declared using the keyword constant For e.g.
Variable
An object of variable class can hold a single value of a given type A variable object can be assigned different values during simulation A variable object can be declared using the keyword variable For e.g.
Signal
Signals are used to model wires and flipflops in a circuit A signal object can be declared using the keyword signal For e.g.
File
An object of file class contains a sequence of values A file object is used to model a file in the host environment Values can be read or written to the file using read or write procedures A file object can be declared using the keyword file For e.g.
Declaring Objects
An object declaration is used to explicitly declare an object, its type, and its class. For e.g.
Not all objects are created using explicit object declarations. E.g.
A data type in VHDL is associated with a set of values & operations For e.g.
The declarations for the predefined types of VHDL are contained in package named STANDARD
Scalar Types
Values belonging to these types are ordered (e.g. 1,2,3) and.. Relational operators can be used on these types ( e.g. 1 < 2) Four different scalar types are
Enumeration types
define a set of user-defined values These values consist of identifiers and character literals Every value has a position number associated with it Example predefined enumeration types BIT, BOOLEAN, STD_ULOGIC Example object declaration
type BIT is (0, 1); type BOOLEAN is (TRUE, FALSE); type STD_ULOGIC is (
U, X, 0, 1, Z, W, L, H, - ); ---------uninitialized forcing unknown forcing 0 forcing 1 high impedence weak unknown weak 0 weak 1 dont care
Integer Type
Defines a type whose set of values fall within a specified integer range INTEGER is the only predefined integer type of VHDL The minimum range of values covered by INTEGER TYPE should be (2E31 1) to +(2E31 1) Example object declaration
Has a set of values in a given range of real numbers REAL is the only predefined floating point type of VHDL The minimum range of values covered by REAL type should be 1.0E38 to +1.0E38 Must provide at least six decimal digits of precision Example object declaration
Physical Type
Contains values that represent measurement of some physical quantity like time, voltage etc. Values of this type are expressed as integer multiples of a base unit TIME is the only predefined physical type in VHDL The range of TIME is same as integer i.e. (2E31 1) to +(2E31 1)
Composite Type
Represents a collection of values These are of two types
Array Record
Array is a collection of values of same type Record is a collection of values that may belong to different types
Creating objects of Array type signal address_bus : ADD_WORD; variable accumulator : DATA_WORD; variable flag_register : DATA_WORD; variable stack_memory : STACK; variable prog_memory : ROM;
address_bus <= X7FFF; address_bus (8 to 15) <= XFF; accumulator := 01101010; flag_register(3) := 1; stack_memory(127) := flag_register; stack_memory(127) (3) := 0; prog_memory (127) := accumulator; prog_memory (127, 3) := 0;
Constrained Arrays the number of elements in the array type is specified explicitly. For e.g.
type ADD_WORD is array (0 to 15) of BIT;
Unconstrained Arrays - the number of elements in the array is not specified in the type declaration Instead, the number of elements in the array is specified during object declaration
Unconstrained Arrays
BIT_VECTOR an array of bits variable accumulator : BIT_VECTOR(0 to 7); STRING an array of characters
Record Types
Are similar to structures in C or record data types in Pascal Example record type declaration
type PSW is record accumulator : BIT_VECTOR( 0 TO 7); flag_register : DATA_WORD; end record;
Access Types
Values belonging to an access type are pointers to dynamically allocated object of some other type They are similar to pointers in C and Pascal E.g. type top_of_stack is access STACK;
File Types
Objects of file type represent files in the host environment Provide a mechanism by which a VHDL design communicates with the host environment For e.g. type names is file of STRING;
Subtypes
A subtype is a type with a constraint For e.g.
The set of operations defined on subtype are same as that of its base type
Operators
2.
3. 4.
5.
6.
Logical operators
These are
and or not nand nor xor xnor
Relational operators
These are
= /= < <= > >= equal to not equal to less than less than equal to greater than greater than equal to
Shift operators
These are
sll srl sla sra rol ror
Adding operators
These are
+ (addition) - (subtraction) & (concatenation)
Multiplying operators
These are
* (multiplication) / (division) mod (modulus) rem (remainder)
Miscellaneous operators
These are
abs (absolute) ** (exponentiation)