Constants in VHDL
On this page
Constants in VHDL are similar to those in many other programming languages. VHDL supports various types of constant values such as character, string, boolean, and numeric values.
In this example, we’ll see how constants are declared and used in VHDL.
Declaration of Constants in VHDL
Explanation
To declare a constant in VHDL, you use the constant
keyword.
This declares a string constant s
with the value "constant"
.
This declares an integer constant n
with the value 500000000
.
This declares a real constant d
with the value of 3e20
divided by n
. In constants, arithmetic expressions are computed with arbitrary precision.
In the process
, we print out the constants with the report
statement:
The report
statement outputs the values and the real'image
and integer'image
functions are used for converting numerical values to string representations.
This VHDL example shows how to declare and use constants, perform arithmetic with constants, and print out their values using the report
statement.