VHDL DATA TYPES Data Types 23 Synthesis interpretation

  • Slides: 44
Download presentation
VHDL DATA TYPES

VHDL DATA TYPES

Data Types - 23 Synthesis interpretation of Integer types: Integer type and subtype objects

Data Types - 23 Synthesis interpretation of Integer types: Integer type and subtype objects are synthesized with data path widths , dependent on the size of range. The maximum data path width is dependent on the range of Integer. When arithmetic expressions are used, there may be intermediate values, whose range may be greater than the range of subtype. The synthesizers estimate this extra data width and provide for it. However, if the buswidth requirements of intermediate results exceed the range of the base type integer overflows will occur, as the maximum datapath width is determined by the range of Integer. The results of comparison operators are boolean type. Signed numbers are represented in two's complement form. While the functions that each arithmetic operator performs can be to some extent made out from the name of the operator, we will discuss all operators separately in a later section.

Data Types - 24 ARRAY TYPES: Array types are composite types. An array is

Data Types - 24 ARRAY TYPES: Array types are composite types. An array is a collection of data elements, which are all of the same type. The elements of an array are usually accessed by an index. The index is normally an integer. Unconstrained arrays : These arrays whose size (number of elements in the array) is not yet specified. Constrained arrays: These arrays whose size is specified. Unconstrained arrays are very useful while writing functions and parametric functions. Except that the size of an unconstrained array may be context dependent, all the arrays behave similarly.

Data Types - 25 A constrained array is declared as below: Eg 1. TYPE

Data Types - 25 A constrained array is declared as below: Eg 1. TYPE address_ptr IS ARRAY (0 TO 31) OF bit; Defines a user defined array type address_ptr , in which the total number of elements is 32 and all elements are bits. Eg 2. TYPE data_word IS ARRAY(15 DOWNTO 0) OF bit; Defines a user defined array type address_ptr , in which the total number of elements is 16 and all elements are bits. Eg 3. TYPE memory IS ARRAY(0 TO 32768) OF data_word; Defines a user defined array type memory whose elements are data_words, which in turn are arrays of bit type elements. This means that memory is an array of arrays or a two dimensional array. Although VHDL allows usage of multidimensional arrays, Arrays which have more than two dimensions cannot be synthesized. As a consequence arrays of more than two dimensions are seldom used. Eg 4. TYPE lifo IS ARRAY (63 DOWNTO 0) OF data_word; Like memory, lifo is also a two dimensional array of bits.

Data Types - 26 The above examples show user defined array types are created.

Data Types - 26 The above examples show user defined array types are created. We can declare data objects using the above types as below. Eg 5. SIGNAL DMA_ADR: address_ptr; Eg 6. SIGNAL ax: data_word; Eg 7. SIGNAL bx: data_word; Eg 8. SIGNAL cx: data_word; Eg 9. SIGNAL dx: data_word; Eg 7. SIGNAL dp_ram: Memory; Eg 8. VARIABLE stack: LIFO; While we used userdefined array types of bit elements in the above examples, usually we don’t do so. The PACKAGE STANDARD and the PACKAGE STD_LOGIC _1164 (not yet discussed) have pre defined array types. Normally we use these array types.

Data Types - 27 PACKAGE STANDARD defines the following two array types. TYPE bit_vector

Data Types - 27 PACKAGE STANDARD defines the following two array types. TYPE bit_vector IS ARRAY (natural RANGE <>) OF BIT; TYPE String IS ARRAY (natural RANGE <>) OF CHARACTER; PACKAGE STD_LOGIC_1164 defines the following array types. TYPE STD_ULOGIC_VECTOR IS ARRAY (natural RANGE <>) OF STD_ULOGIC; TYPE STD_LOGIC_VECTOR IS ARRAY (natural RANGE <>) OF STD_LOGIC; The above definitions of BIT_VECTOR, STRING, STD_LOGIC_VECTOR and STD_ULOGIC_VECTOR are also examples of how unconstrained arrays are defined. The symbol <> known as box , indicates that the array is unconstrained. The words natural and RANGE specify that the indices of elements in arrays of this type should be in the range of natural numbers. Remember that natural numbers are a subtype of integers covering all positive integers including 0

Data Types - 28 Individual elements of an array are referred to by the

Data Types - 28 Individual elements of an array are referred to by the index. Eg: SIGNAL ax : bit_vector (15 DOWNTO 0); SIGNAL bx : bit_vector(15 DOWNTO 0); SIGNAL cx : bit_vector(0 TO 15); Individual elements of ax are referred to as ax(15), ax(14), ax(13), ax(12)………. . ax(0); Individual elements of bx are referred to as bx(15), bx(14), bx(13), bx(12)………. bx(0); Elements of one array can be assigned to elements of another array as follows, provided both arrays are of same size. ax <= bx; This statement assigns… ax(15) <= bx(15); ax(14) <= bx(14); ax(13)<bx(13); …………………ax(2) <= bx(2); ax(1) <= bx(1); ax(0) <= bx(0);

Data Types - 29 Individual elements of an array can be directly accessed using

Data Types - 29 Individual elements of an array can be directly accessed using the index , Or, indirectly with using a signal of appropriate type as index. Eg. SIGNAL fourbit : NATURAL range 0 TO 3; fourbit <= 4; ax(fourbit) <= '0'; fourbit <= fourbit+1; ax(fourbit)<= '1'; The above statements assign '0' to ax(4) and '1' to ax(5). Signals can be used to dynamically index an array.

Data Types - 30 Slicing of arrays: It is possible to refer to parts

Data Types - 30 Slicing of arrays: It is possible to refer to parts of arrays as slices. Eg. ax(3 DOWNTO 0) <= bx(15 DOWNTO 12); The above statement assigns the MSB four bits of array BX to LSB four bits of array AX, without modifying any of the remaining elements of either array. The assignment is made as below. ax (3)<= bx(15); ax (2)<= bx(14); ax (1)<= bx(13); ax (0)<= bx(12);

Data Types - 31 Assignments to elements in arrays can be made indifferent ways.

Data Types - 31 Assignments to elements in arrays can be made indifferent ways. i. 1. We can assign element by element; ax(15) <= '0'; ax(14) <= '1'; ax(13) <= '1'; ax(12) <= '0'; . ii. 2. We can make aggregate assignment; ax < = (15 => '0', 14=>'1', 13=> '1', 12=>'0', …………………. . etc. ); Is equivalent to assignment statements in 1. iii. In both the above cases, we can assign other signal values to the array elements. ax <= (15 =>bx(0); 14 =>bx(1); 13=>bx(2); 12=>bx(3), …………etc); The signals being assigned should be of the same type as the data elements of the array. Note that the example above is reversing the bit sequence of array bx.

Data Types - 32 If the initial elements of an array are taking same

Data Types - 32 If the initial elements of an array are taking same value and if remaining elements another value, assignment can be made as below. ax <=(15 DOWNTO 12 => '1'; 11 DOWNTO 0 <= '0'); Assigns value 1111000000 to the array; The same assignment can also be made as follows; ax <= (15 DOWNTO 12 => '1', OTHERS =>'0'); or ax <= (15 => '1', 14=>'1', 13=> '1', 12=>'1', OTHERS =>'0'); ax <= (15|14|13|12 => '1'; OTHERS =>'0'); All the above assignments also Assigns value 1111000000 to the array; The keyword OTHERS refers to all the remaining elements of the array, not already covered.

Data Types - 33 Values can be assigned elements by positional association. ax <=

Data Types - 33 Values can be assigned elements by positional association. ax <= ('1', '0', '0', '0', '0'); ax <= ( bx(0), bx(1), '1', '0', '0', '0', '0'); Signal names also can be used in assignments using positional association; ii. String literals can be used for assigning to bit_vectors and std_logic_vectors. ax <= "1111000000"; is same as all previous examples.

Data Types - 34 OPERATIONS ON ARRAYS: Individual elements of an array are similar

Data Types - 34 OPERATIONS ON ARRAYS: Individual elements of an array are similar to independent signals or variables of the given type. So, individual elements can have all the operations applicable to that data type. For example, the elements of a bit_vector type data_object are made up of BIT data type. So all the operations defined for BIT data type viz. , boolean/logical operations and comparison operators are applicable to elements of bit vectors. Eg. ax(0) <= bx(0) AND bx(1) + bx(3) ax(2) <= ax(15) XOR ax(14); Similarly if an array is made of elements of Integer type or any subtype of Integer type, the elements of the array will have arithmetic and comparison operations. While individual elements can have operations depending on the element type, arrays as a whole can only have concatenation operation and comparison operations.

Data Types - 35 • • • • • SIGNAL dx : bit_vector( 31

Data Types - 35 • • • • • SIGNAL dx : bit_vector( 31 DOWN TO 0); dx <= ax & bx; --& is concatenation operator; The above statement assigns elements of ax and bx to elements of dx as follows. dx(31) <= ax(15) ; dx(30) <= ax(14) ; dx(29) <= ax(13) ; . dx(18) <= ax(2) ; dx(17) <= ax(1) ; dx(16) <= ax(0) ; dx(15) <= bx(15) ; dx(14) <= bx(14) ; dx(13) <= bx(13) ; . dx(2) <= bx(2) ; dx(1) <= bx(1) ; dx(0) <= bx(0) ;

Data Types - 36 It is possible to use slices of arrays in concatenation

Data Types - 36 It is possible to use slices of arrays in concatenation operations. cx <= dx(31 DOWNTO 28) & bx(15 DOWNTO 12) & ax(7 DOWNTO 0); The above statement assigns the elements of ax, bx, and dx to cx as follows. cx(15) <= dx(31); cx(14) <= dx(30); cx(13) <= dx(29); cx(12) <= dx(28); cx(11) <= bx(15); cx(10) <= bx(14); cx(9) <= bx(13); cx(8) <= bx(12); cx(7) <= ax(7); cx(6) <= ax(6); cx(5) <= ax(5); cx(4) <= ax(4); cx(3) <= ax(3); cx(2) <= ax(2); cx(1) <= ax(1); cx(0) <= ax(0);

Data Types - 37 • Comparison operators: • The comparison operators =, /= ,

Data Types - 37 • Comparison operators: • The comparison operators =, /= , < , >, <=, >= can be applied on two arrays. • The result of the comparison operation is BOOLEAN type (TRUE OR FALSE). • Two arrays are equal , if and only if • Both arrays are of the same size, and • All the corresponding elements of the arrays are equal.

Data Types - 38 • When to arrays of different sizes are compared, •

Data Types - 38 • When to arrays of different sizes are compared, • The elements are compared one by one starting from the first element. The comparison proceeds till an element mismatch occurs, or all the elements of the smaller array are finished. • If no mismatches are encountered, then the larger array is greater than smaller array. • If a mismatch is encountered, the comparison stops at the first mismatch. The array whichever has the greater element at the first mismatch position is greater. Thus the smaller array can be greater than the larger array

Data Types - 39 • • • • Examples: consider the following integer arrays.

Data Types - 39 • • • • Examples: consider the following integer arrays. A <= (2, 3, 4, 5); B <= (2, 3, 4, 5); C <= (1, 2, 7, 8); D <= (1, 9, 10, 11, 12, 15); E <= (2, 3, 4, 5, 6); F <= (2, 7, 8, 9, 0, 0, 0); In the above arrays, it can be seen that, A = B is TRUE because both arrays are of same size and all elements are equal. A > C is TRUE because the first element of A is greater than first element of C. A > D is TRUE because the first element of A is greater than first element of D. A < E is TRUE because all initial elements of E are equal to corresponding elements of A and E is larger than A. A < F is TRUE because the second element of F is greater than second element of A. It can also be verified that, B is greater than C. B is greater than D. B is less than E. B is less than F. C is less than D. C is less than E. C is less than F. D is less than E. D is less than F; E is less than F;

Data Types - 40 PHYSICAL TYPES: Data Objects of Physical types are used to

Data Types - 40 PHYSICAL TYPES: Data Objects of Physical types are used to hold values that represent measurements of physical parameters like Time, current, voltage, length etc. A physical type declaration looks as below. TYPE type_name IS range low TO high UNITS; . . . END UNITS; type_name : data type being defined by user. Low : low range of data. High : high range of data. UNITS : in this block use has to specify the Units and subunits of the physical parameter

Data Types - 41 Example TYPE millivolts IS 0 TO 10000 UNITS mv; --basic

Data Types - 41 Example TYPE millivolts IS 0 TO 10000 UNITS mv; --basic measurement unit of millivolts; V = 1000 mv -- one Volt is made upof 1000 millivolts; END UNITS; TYPE length IS 0 TO 10000 UNITS mm; -- basic measurement of length; cm = 10 mm; --one centimeter = 10 mm; dm = 10 cm ; -- one decimeter = 10 cm; meter = 10 dm; -- one meter = 10 dm; END UNITS;

Data Types - 42 STANDARD PACKAGE has predefined TIME as a physical type as

Data Types - 42 STANDARD PACKAGE has predefined TIME as a physical type as follows. TYPE time IS RANGE -9223372036854775807 to 9223372036854775807; UNITS fs; -- basic unit of time is a femto-second ; ps = 1000 fs; -- one picosecond = 1000 femto seconds; ns = 1000 ps; -- one nanosecond = 1000 picoseconds; us = 1000 ns; -- one microsecond = 1000 nanoseconds; ms = 1000 us; -- one millisecond = 1000 microseconds; sec = 1000 ms; -- one second = 1000 milliseconds; min = 60 sec; -- one minute = 60 seconds; hr = 60 min; -- one hour = 60 minutes; END UNITS;

Data Types - 43 How to declare data objects of Physical types: SIGNAL gate_delay

Data Types - 43 How to declare data objects of Physical types: SIGNAL gate_delay : TIME; CONSTANT rise_time : TIME : = 10 ns; CONSTANT clock_period : TIME : = 20 ns; VARIABLE delay : TIME : = 0 ns; CONSTANT logic_low : millivolts; CONSTANT logic_high : millivolts; VARIABLE dac_out : millivolts; VARIABLE trace_length : length; CONSTANT trace_width : length; Operations on physical types: Arithmetic and comparison operations are possible on physical types, just like on integers.

Data Types - 44 • RECORD TYPE: A record is a collection of data

Data Types - 44 • RECORD TYPE: A record is a collection of data objects. Unlike arrays, which are also collections of data objects of same type, all elements of a record need not be of same type. A record is similar to a structure in C language. Unconstrained arrays cannot be used in records. Records may not be supported by some synthesizers because of their limited use. However records are quite useful for writing test benches.

Data Types - 45 Defining record: TYPE type_name IS RECORD Data_object 1 declaration; Data_object

Data Types - 45 Defining record: TYPE type_name IS RECORD Data_object 1 declaration; Data_object 2 declaration; Data_object 3 declaration; . . . END RECORD; type_name is the name given by the user to the record type being defined. Data object declarations are declaration of data object types that are members of the record.

Data Types - 46 Example: TYPE complex IS RECORD Real : integer; Imag :

Data Types - 46 Example: TYPE complex IS RECORD Real : integer; Imag : integer; END RECORD; SIGNAL a : complex; SIGNAL b : complex; SIGNAL c : complex; a, b, c are defined as records of complex type. Each of these records have two members. The members of record a are: a. real and a. imag. The members of record b are: b. real and b. imag. The members of record c are: c. real and c. imag. Data_object identifier. Member_name is used to access the individual members of a record type data object.

Data Types - 47 The members (or individual elements) of a record behave the

Data Types - 47 The members (or individual elements) of a record behave the same way as the other objects of the data type to which they belong. So operations on individual elements of records are governed by the same rules as those for individual data objects of same type. In this example a. real, a. imag, b. real, b. imag , c. real, c. imag are all integers. So the following assignments and arithmatic are valid. c. real <= 0; c. imag <= 0; c. real <= a. real + b. real c. imag <= a. imag + b. imag; Only operations possible on two records are =, /= comparison operations; Two records are equal if and only if all the corresponding elements of both records are equal; The result of comparison operation as usual is boolean;

Data Types - 48 FLOATING POINT TYPES: Floating point values or floating point literals

Data Types - 48 FLOATING POINT TYPES: Floating point values or floating point literals can be distinguished from Integer values or integer literals by the presence of a dot or decimal point in the value. Eg: 0, 1, 2, 3 etc are integer literals, while 0. 0, 1. 0, 2. 0, etc are floating point literals. It is possible to express both floating point and integer literals in exponential form. Eg: 0. 62345 is same as 62345 E-5; 12345. 6 is same sa. 123456 e 5; 600 is same as 6 e 2 (integer value); A floating point type is defined as follows; TYPE type_name IS RANGE low TO high; type_name is the name of user defined type. low is the lower limit of the range and high is the higher limit of the range.

Data Types - 49 Example: TYPE real_data IS RANGE -10. 0 to 10. 0;

Data Types - 49 Example: TYPE real_data IS RANGE -10. 0 to 10. 0; real_data is now declared as a floating point data type. data objects of type real_data can take floating point data values between -10. 0 and 10. 0. We can now define variables of real_data type. VARIABLE V 1: real_data; V 1 is a floating point data object, whose values are in the range 10. 0 to +10. 0. We can also define variables with a constrained range. The constrained range is a sub range of the data type. VARIABLE V 2: real_data RANGE -5. 0 TO +5. 0; VARIABLE V 2 , even though its data type is real_data, it has a constrained range.

Data Types - 50 Subtypes can also be used to limit the range of

Data Types - 50 Subtypes can also be used to limit the range of data_objects; Eg: subtype real_data_subset IS real_data RANGE -5. 0 TO 5. 0; All the data objects of type real_data_subset will be constrained from -5. 0 to +5. 0; VARIABLE V 3: real_data_subset; --V 3 has same range as V 2. STANDARD PACKGE predefines a floating point data type known as real; The range of real is implementation dependent. TYPE real IS RANGE implementation dependent; However the rage must be at least -1. 0 E 38 TO +1. 0 E 38. Arithmetic and comparison operations are possible on floating point types. Most Synthesizers cannot synthesize floating point types directly, as they are very complex. Although the normal base for integer as well as floating point literals is 10, They can also be expressed in any other base. These are called based literals. The syntax for base literals is as below. Base # based_value #, or Base #based_value# E exponent; Eg: 2 #1001001# -- represents 73 in decimal • 16#1. 8#E 2 -- is equivalent to 384 in decimal (verify)

Data Types - 51 STRING LITERALS: Strings are array types. The type STRING is

Data Types - 51 STRING LITERALS: Strings are array types. The type STRING is predefined in PACKAGE STANDARD TYPE string IS array (POSITIVE range <>) OF character; String data types are useful to report errors, print messages, headers etc in test benches. Data_Objects of string type can be assigned string literals. String literals are sequences of characters enclosed by double quotes. Below are examples of string literals. "setup time violation" "test message" String type data objects are declared as follows. VARIABLE message : STRING(1 TO 20); Message : = "setup time violation" As strings are array types, Concatenation and comparison operations are possible on strings. The rules for comparison are same. Remember that when characters are compared , they are compared by their position in the enumeration type declaration.

ATTRIBUTES-1 ATTRIBUTES: We can crudely say that attributes are used to refer to the

ATTRIBUTES-1 ATTRIBUTES: We can crudely say that attributes are used to refer to the characteristics of data objects. For example, a data object of type array has characteristics like, size of the array, direction of the array range( ascending or descending) etc. A data_object of user defined subtype will have attributes like range, lowest value, highest value, basetype etc. While we mention that attributes are used to refer to the characteristics of data objects, to understand the meaning of an attribute, it is not true that attributes are associated with only data objects. Attributes can be associated with Entity names, Architectures, Configurations, Components, Labels, Signals Variables, Constants, Functions Types Subtypes, procedures Attributes are definable by user. There also a number of predefined attributes in VHDL.

ATTRIBUTES-2 Predefined attributes: These can be broadly classified as Value attributes, Function attributes, Range

ATTRIBUTES-2 Predefined attributes: These can be broadly classified as Value attributes, Function attributes, Range attributes , Signal attributes, Type attributes. Value attributes return a constant value. Function attributes call a function that returns a constant value. Range attributes return a range. Signal attributes create a new signal. Type attributes return a type name.

ATTRIBUTES-3 Attributes of Scalar data types: Enumeration and integer data types are known as

ATTRIBUTES-3 Attributes of Scalar data types: Enumeration and integer data types are known as Scalar data types. If T is a scalar type, then the following predefined attributes are available for T. Value attributes: T'LEFT : returns left bound ( leftmost value of T). T'RIGHT : returns right bound (right most value of T). T'HIGH: returns the upper bound (largest value of T). T'LOW: returns the lower bound (lowest value of T). T'ASCENDING : returns TRUE if the type has an ascending range, else returns false

ATTRIBUTES-4 • Function attributes: • T'POS(V) : returns the position of value V in

ATTRIBUTES-4 • Function attributes: • T'POS(V) : returns the position of value V in the ordered list of values of T. • T'VAL(P) : returns the value of position P in the ordered list of values of T. • T'SUCC (V): returns the value of parameter whose value is one larger than the value V in the ordered list of values of T. • T'PRED(V): returns the value of parameter whose value is one lesser than the value V in the ordered list of values of T. • T'LEFTOF(V): returns the value of parameter that is left to the value V in the ordered list of values of T. • T'RIGHTOF(V): returns the value of parameter that is right to the value V in the ordered list of values of T.

ATTRIBUTES-5 • • • • Example 1: Consider the following enumeration type. TYPE Txstate

ATTRIBUTES-5 • • • • Example 1: Consider the following enumeration type. TYPE Txstate IS (idle, start, data, parity, stop); Then, Txstate'left is idle. Txstate'right is stop. Txstate'low is idle. Txstate'high is stop. Txstate'ascending is -- to be verified. Txstate'POS(parity) is 3. Txstate'VAL(2) is data. Txstate'SUCC(start) is data. Txstate'PRED(start) is idle. Txstate'LEFTOF(start) is idle. Txstate'RIGHTOF (start) is data.

ATTRIBUTES-6 • In an enumeration type the values are assigned by position. The lowest

ATTRIBUTES-6 • In an enumeration type the values are assigned by position. The lowest value being 0 and the highest depending on the number of elements in the enumeration. • Thus the leftmost element has the lowest value and the rightmost element has the highest value. For any element, the element to the left of it has lower value and to the right of it has greater value. • Hence, Txstate'LOW is same as Txstate'LEFT and Txstate'HIGH is same as Txstate'RIGHT. • Similarly, Txstate'LEFTOF(start) will return the same value as Txstate'PRED(start). And, • Txstate'PRED(start) will return the same value as Txstate 'RIGHTOF(start).

ATTRIBUTES-7 • Example 2: • TYPE Short IS -128 to 127; • Short'left is

ATTRIBUTES-7 • Example 2: • TYPE Short IS -128 to 127; • Short'left is -128. Short'right is 127. Short 'low is -128. Short 'high is 128. Short 'ascending is TRUE Short 'POS(-125) is 3. Short 'VAL(1) is -127. Short 'SUCC(0) is 1. Short 'PRED(127) is 126. Short 'LEFTOF(124) is 123. Short 'RIGHTOF (124) is 125.

ATTRIBUTES-8 • Example 3: • • TYPE descending IS 127 to -128; • •

ATTRIBUTES-8 • Example 3: • • TYPE descending IS 127 to -128; • • descending 'left is 127. • descending 'right is -128. • descending 'low is -128. • descending 'high is 127. • descending 'ascending is false. • descending 'POS(-125) is 252. • descending 'VAL(1) is 126. • descending 'SUCC(0) is 1. • descending 'PRED(127) is 126. • descending 'LEFTOF(124) is 125. • descending 'RIGHTOF (124) is 123

ATTRIBUTES-9 Array Attributes: Array attributes act on signals or variables of array type. If

ATTRIBUTES-9 Array Attributes: Array attributes act on signals or variables of array type. If A is an array, A'LEFT returns the index of the leftmost element of the array; A'RIGHT returns the index of the right most element of the array; A'LOW returns the index of the lowest numbered element of the array; A'HIGH returns the index of the highest numbered element of the array; A'LENGTH returns the number of elements in the array; A'RANGE refers to the range of the array; A'REVERSE_RAGE also refers to the range of the array;

ATTRIBUTES-10 Examples: SIGNAL DOWN : BIT_VECTOR( 7 DOWNTO 0); SIGNAL UP : BIT_VECTOR (

ATTRIBUTES-10 Examples: SIGNAL DOWN : BIT_VECTOR( 7 DOWNTO 0); SIGNAL UP : BIT_VECTOR ( 0 TO 7); SIGNL SIGN: BIT; SIGNAL X: BIT_VECTOR (DOWN'RANGE); SIGNAL Y: BIT_VECTOR (DOWN'REVERSE RANGE); SIGNAL Z: BIT_VECTOR (DOWN'LENGTH -1 DOWNTO 0); DOWN'LEFT is 7; DOWN'RIGHT is 0; DOWN'LOW is 0; DOWN'HIGH is 7; DOWN'LENGTH is 8; UP'LEFT is 0; UP'RIGHT is 7; UP'LOW is 0; UP'HIGH is 7; UP' LENGTH is 8; DOWN'RANGE is 7 DOWNTO 0; DOWN'REVERSE_RANGE is 0 TO 7; UP' RANGE is 0 TO 7; UP'REVERSE_RANGE is 7 DOWNTO 0;

ATTRIBUTES-11 The attributes left, right, low, high and length return integer values, which are

ATTRIBUTES-11 The attributes left, right, low, high and length return integer values, which are called universal integers. Universal integers can be assigned to data objects of any type of integers. SIGN <= down(down'left); Assigns the left most bit (MSB) bit of array down to SIGN. In case of signed numbers, this may be the sign bit. The attributes RANGE and REVERSE_RANGE donot have any numbers associated with them. However they can be referred to in some case. In the above examples , X is a BIT_VECTOR of same range as DOWN, That is 7 DOWNTO 0; Y is a BIT_VECTOR of revverse_range of DOWN that is 0 TO 7; Z is a bit vector of same size and direction (i. e. same range ) as DOWN, because DOWN'LENGTH returns value 8; The attributes of arrays , enumeration types and integers are very useful for developing parameterized components.

ATTRIBUTES-12 SIGNAL_ATTRIBUTES; The most frequently used signal attribute in synthesis is EVENT. If S

ATTRIBUTES-12 SIGNAL_ATTRIBUTES; The most frequently used signal attribute in synthesis is EVENT. If S is a scalar signal_object of type bit, std_logic or std_ulgic, then S'EVENT returns TRUE if the signal has changed its value during current delta. The following are attributes for signals; S'EVENT returns TRUE if a state change occurred during current delta. • S'ACTIVE returns active if a new value is assigned to a signal during current delta. A signal is active even if the new value is same as old value. • An event on some other signal has resulted in calculation and assignment of a new value to this signal. However if the new value is same as old value, then no event occurs on this signal. Else an event also occurs on this signal. • S'LAST_EVENT returns the time elapsed since the last event on the signal. • S'LAST_ACTIVE returns the time elapse since the last time a new value was assigned to this signal; • S'LAST_VALUE returns the value of the signal before the last event;

ATTRIBUTES-13 • • • S'DRIVING returns FALSE if in a process where this attribute

ATTRIBUTES-13 • • • S'DRIVING returns FALSE if in a process where this attribute is used, the signal referred is disconnected. S'DRIVING_VALUE returns the current value of the driver. S'DELAYED(T) creates a new signal of the same type as S delayed by T. S'STABLE(T) returns TRUE when a signal did not change its value for a period greater than T. S'QUIET(T) returns TRUE if the signal has not been active (assigned a new value) for time greater than T, since the last assignment. S'TRANSACTION creates a signal of type bit, which toggles every time the signa S toggles. Signal attributes other than EVENT are not used in synthesis. All others will be reviewed in greater detail when test benches are covered.

OPERATORS - 1 The Operators supported by VHDL can be grouped under the following

OPERATORS - 1 The Operators supported by VHDL can be grouped under the following six categories. 1. 2. 3. 4. 5. 6. Logical Operators. Relational(comparison) Operators. Shift Operators. Adding Operators. Multiplying Operators. Miscellaneous Operators. Operator Precedence: The operator precedence increases in the above list along with the numerical number. Thus Miscellaneous operators have the highest precedence, while logical operators have the lowest precedence. NOT eventhough a logical operator has the highest precedence. & (concatenation operator) has the same precedence as adding operators.