VHDL Programming

(C. Jardin) #1

80 Chapter Four


to be a scalar type can hold, at most, one of the scalar values at any point
in time. Referencing the name of the object references the entire object.
Scalar types encompass these four classes of types:

Integer types

Real types

Enumerated types

Physical types

INTEGER TYPES are exactly like mathematical integers. All of the nor-
mal predefined mathematical functions like add, subtract, multiply, and di-
vide apply to integer types. The VHDL LRM does not specify a maximum
range for integers, but does specify the minimum range: from -2,147,483,647
to 12,147,483,647. The minimum range is specified by the Standard
package contained in the Standard Library.
The Standard package defines all of the predefined VHDL types pro-
vided with the language. The Standard Library is used to hold any packages
or entities provided as standard with the language.
It may seem strange to some designers who are familiar with two’s
complement representations that the integer range is specified from
2,147,483,647 to 2,147,483,647 when two’s complement integer repre-
sentations usually allow one smaller negative number,2,147,483,648. The
language defines the integer range to be symmetric around 0.
Following are some examples of integer values:

ARCHITECTURE test OF test IS
BEGIN
PROCESS(X)
VARIABLE a : INTEGER;
VARIABLE b : int_type;
BEGIN
a := 1; --Ok 1
a := -1; --Ok 2
a := 1.0; --error 3
END PROCESS;
END test;

The first two statements (1 and 2) show examples of a positive integer
assignment and a negative integer assignment. Line 3 shows a non-
integer assignment to an integer variable. This line causes the compiler
to issue an error message. Any numeric value with a decimal point is con-
sidered a real number value. Because VHDL is a strongly typed language,
Free download pdf