Specifications
Language Structure
VHDL Reference Manual 2-17
Arithmetic Operators
Arithmetic operators are used to create arithmetic functions. VHDL
provides the following arithmetic operators:
+ Addition
- Subtraction
* Multiplication
/ Division
mod Modulus
rem Remainder
abs Absolute Value
** Exponentiation
These operators are defined for numeric types such as integer and
real.
Note: Using arithmetic operators in a design can result in very large
amounts of combinational logic being generated.
Overloading Operators
In addition to the predefined operators, VHDL allows you to create new
operators, or to overload existing operators to support alternate types
of arguments or to give them new meanings. For example, Synario
supplies overloaded functions defining the relational operators listed in
the previous section for type bit_vector as part of the package
bit_ops contained in the file \synario\lib5\dataio.vhd. Overloaded
relational operators for std_logic_vectors are supplied as part of the
package std_logic_ops which is found in the same file. Note that these
overloaded operators treat bit_vectors and std_logic_vectors as
unsigned quantities.
VHDL Attributes
VHDL has many predefined attributes that allow access to information
about types, arrays, and signals. For a complete list of the supported
attributes and their definitions, see Appendix A, “Quick Reference.”
Examples of attributes used to modify a type are shown below. In this
example, the 'high and 'low attributes are used to determine the
highest and lowest values of a type:
integer'high -- has a value of 2147483647
integer'low -- has a value of -2147483647
To declare a subtype of type integer, use the 'high and 'low
attributes to determine the resulting new upper and lower bounds of
the type :
subtype shorter is integer range 0 to 100;
shorter'high -- has a value of 100
shorter'low -- has a value of 0
Attributes can also be combined, as in:
shorter'base'high -- has a value of 2147483647