|
VHDL Tutorial |
Integer types in VHDL | ||
|
Introduction Fundamental concepts Modelling concepts Elements of behaviour Elements of structure Analysis elaboration Lexical elements Identifiers Numbers Characters and strings Syntax descriptions Constants and variables Scalar type Integer types Floating point types Time type Enumeration types Character types Boolean type Bits type Standard logic Sequential statements Case statements Loop and exit statements Assertion statements Array types & array operations Architecture bodies Entity declarations Behavioral descriptions Wait statements Delta delays Process statements Conditional signal assignment Selected signal assigment Structural descriptions Library and library clauses Procedures Procedure parameters Signal parameters Default values Unconstrained array parameter Functions Package declarations and bodies Subprograms in package Use clauses Resolved signals and subtypes Resolved signals and ports Parameterizing behavior Parameterizing structure
|
. Integer Types
In VHDL, integer types have values that are whole numbers. The predefined type integer includes all the whole numbers representable on a particular host computer. The language standard requires that the type integer include at least the numbers – 2,147,483,647 to +2,147,483,647 (–231 + 1 to +231 – 1), but VHDL implementations may extend the range. There are also two predefined integer subtypes
natural, containing the integers from 0 to the largest integer, and
positive, containing the integers from 1 to the largest integer.
Want To have highly paid VLSI jobs ?? then you may contact at
Contact : webmaster@freehost7com Where the logic of a design indicates that a number should not be negative, it is good style to use one of these subtypes rather than the base type integer. In this way, we can detect any design errors that incorrectly cause negative numbers to be produced. The operations that can be performed on values of integer types include the fa- miliar arithmetic operations:
+ addition, or unary identity
– subtraction, or unary negation
* multiplication
/ division (with truncation)
mod modulo (same sign as right operand) rem remainder (same sign as left operand) abs absolute value ** exponentiation (right operand must be non-negative)
Here is a declaration that defines a subtype of integer:
subtype small_int is integer range –128 to 127;
Values of small_int are constrained to be within the range –128 to 127. If we de- clare some variables:
variable deviation : small_int; variable adjustment : integer;
we can use them in calculations:
|