A.2 VHDL Syntax
A.2
VHDL Syntax
In the rules that follow an
underline (
like this
) indicates syntax that is present in VHDL-93, but not in VHDL-87. A
strikethrough (
like this
) indicates syntax that is present in VHDL-87, but not in VHDL-93; this occurs only in the rule for
file_declaration
(rule
38
). This means that any VHDL-87 code that contains keywords
in
or
out
in a file declaration will not compile in a VHDL-93 environment. Except for this one exception, VHDL-93 is a superset of VHDL-87.
The VHDL productions are in alphabetical order. The highest-level production is the definition for
design_file
; this is where you start to traverse the tree starting at the top level. The following parts (indicated by the use of uppercase in the BNF) are the lowest-level constructions:
UPPER_CASE_LETTER
(
A–Z
plus accented uppercase letters),
LOWER_CASE_LETTER
(
a–z
and accented lowercase letters,
é
, and so on),
LETTER
(either uppercase or lowercase letters,
a–Z
, and all accented letters),
DIGIT
(
0–9
),
SPACE_CHARACTER
(
' '
and
nonbreaking space),
UNDERLINE
(
'_'
),
SPECIAL_CHARACTER
(
" # & ' () * + , - . / : ; < = > [ ] _ |
), and
OTHER_SPECIAL_CHARACTER
(all remaining characters such as
! $ % @ ?
and so on, but not including
format effectors). Format effectors are the ISO (and ASCII) characters called
horizontal tabulation,
vertical tabulation,
carriage return,
line feed, and
form feed.
Keywords are shown in
bold
. Notice that the terms
label, literal,
and
range
are keywords (
label
,
literal
,
range
) and are also used as the name of a part (
label
,
literal
,
range
), as they are in the LRM. Construct names that commence with
italics
, such as
time
_expression
, are intended to make the syntax definitions easier to read. The italic part of the construct is treated as a comment. You look up the definition for
time
_expression
under
'e'
for expression, not
't'
for time. There are no formal definitions of the italic modifiers; if you are not sure exactly what is meant, you must look up the semantics in the body of the LRM.
actual_part
::= [93LRM 4.3.2.2] [1]
expression
|
signal_
name
|
variable_
name
|
file_
name
|
open
|
function_
name
(
expression
|
signal_
name
|
variable_
name
|
file_
name
|
open
)
|
type_mark
(
expression
|
signal_
name
|
variable_
name
|
file_
name
|
open
)
aggregate
::= [93LRM 7.3.2] [2]
( [
choice
{ |
choice
} => ]
expression
{, [
choice
{ |
choice
} => ]
expression
} )
alias_declaration
::= [93LRM 4.3.3] [3]
alias
identifier
| '
graphic_character
' | " {
graphic_character
} "
[
:
subtype_indication
]
is
name
[
signature
]
;
architecture_body
::= [93LRM 1.2] [4]
architecture
identifier
of
entity_
name
is
{
block_declarative_item
}
begin
{
concurrent_statement
}
end
[
architecture
]
[
architecture_
identifier
];
assertion
::= [93LRM 8.2] [5]
assert
boolean_
expression
[
report
expression
] [
severity
expression
]
association_list
::= [93LRM 4.3.2.2] [6]
[
formal_part
=> ]
actual_part
{, [
formal_part
=> ]
actual_part
}
attribute_declaration
::= [93LRM 4.4]
attribute
identifier
:
type_mark
; [7]
attribute_name
::= [93LRM 6.6]
prefix
[
signature
]
'
attribute_
identifier
[8]
[ (
expression
) ]
attribute_specification
::= [93LRM 5.1] [9]
attribute
attribute_
identifier
of
entity_name_list
:
entity_class
is
expression
;
based_literal
::= [93LRM 13.4.2] [10]
integer
# DIGIT | LETTER { [ UNDERLINE ] DIGIT | LETTER }
[ . DIGIT | LETTER { [ UNDERLINE ] DIGIT | LETTER } ]
# [ E [ + ]
integer
| E –
integer
]
basic_graphic_character
::= [93LRM 13.1] [11]
UPPER_CASE_LETTER | DIGIT | SPECIAL_CHARACTER | SPACE_CHARACTER
bit_string_literal
::= [93LRM 13.7] [12]
B | O | X " [DIGIT | LETTER { [ UNDERLINE ] DIGIT | LETTER } ]"
block_configuration
::= [93LRM 1.3.1] [13]
for
architecture_
name
|
block_statement_
label
|
generate_statement_
label
[ (
discrete_
subtype_indication
|
range
|
static_
expression
) ]
{
use
prefix
.
suffix
{,
prefix
.
suffix
} ; }
{
block_configuration
|
component_configuration
}
end
for
;
block_declarative_item
::= [93LRM 1.2.1] [14]
subprogram_specification
; |
subprogram_body
|
type_declaration
|
subtype_declaration
|
constant_declaration
|
signal_declaration
|
shared_
variable_declaration
|
file_declaration
|
alias_declaration
|
component_declaration
|
attribute_declaration
|
attribute_specification
|
configuration_specification
|
disconnection_specification
|
use_clause
|
group_template_declaration
|
group_declaration
block_statement
::= [93LRM 9.1] [15]
block_
label
:
block
[ (
guard_
expression
) ]
[
is
]
[
generic
(
generic_
interface_list
);
[
generic
map
(
generic_
association_list
) ; ] ]
[
port
(
port_
interface_list
);
[
port
map
(
port_
association_list
) ; ] ]
{
block_declarative_item
}
begin
{
concurrent_statement
}
end block [
block_
label
] ;
case_statement
::= [93LRM 8.8] [16]
[
case_
label
: ]
case
expression
is
when
choice
{ |
choice
} => {
sequential_statement
}
{
when
choice
{ |
choice
} => {
sequential_statement
} }
end case
[
case_
label
]
;
choice
::= [93LRM 7.3.2] [17]
simple_expression
|
discrete_range
|
element_
identifier
|
others
component_configuration
::= [93LRM 1.3.2] [18]
for
instantiation_
label
{ ,
instantiation_
label
} :
component_
name
|
others
:
component_
name
|
all
:
component_
name
[
[
use
entity
entity_
name
[ (
architecture_
identifier
) ]
|
configuration
configuration_
name
|
open
]
[
generic
map
(
generic_
association_list
) ]
[
port
map
(
port_
association_list
) ] ; ]
[
block_configuration
]
end
for
;
component_declaration
::= [93LRM 4.5] [19]
component
identifier
[
is
]
[
generic
(
local_generic_
interface_list
) ; ]
[
port
(
local_port_
interface_list
) ; ]
end
component
[
component_
identifier
]
;
component_instantiation_statement
::= [93LRM 9.6] [20]
instantiation_
label
:
[
component
]
component_
name
|
entity
entity_
name
[ (
architecture_
identifier
) ]
|
configuration
configuration_
name
[
generic
map
(
generic_
association_list
)]
[
port
map
(
port_
association_list
) ] ;
concurrent_statement
::= [93LRM 9] [21]
block_statement
|
process_statement
| [
label
: ]
[
postponed
]
procedure_call
;
| [
label
: ]
[
postponed
]
assertion
;
| [
label
: ]
[
postponed
]
conditional_signal_assignment
| [
label
: ]
[
postponed
]
selected_signal_assignment
|
component_instantiation_statement
|
generate_statement
conditional_signal_assignment
::= [93LRM 9.5.1] [22]
name
|
aggregate
<= [
guarded
] [
transport
| [
reject
time_
expression
]
inertial
]
{
waveform
when
boolean_
expression
else
}
waveform
[
when
boolean_
expression
]
;
configuration_declaration
::= [93LRM 1.3] [23]
configuration
identifier
of
entity_
name
is
{
use
prefix
.
suffix
{ ,
prefix
.
suffix
} ;
|
attribute_specification
|
group_declaration
}
block_configuration
end
[
configuration
]
[
configuration_
identifier
] ;
configuration_specification
::= [93LRM 5.2] [24]
for
instantiation_
label
{ ,
instantiation_
label
} :
component_
name
|
others
:
component_
name
|
all
:
component_
name
[
use
entity
entity_
name
[ (
architecture_
identifier
) ]
|
configuration
configuration_
name
|
open
]
[
generic
map
(
generic_
association_list
) ]
[
port
map
(
port_
association_list
) ] ;
constant_declaration
::= [93LRM 4.3.1.1] [25]
constant
identifier
{ ,
identifier
} :
subtype_indication
[ :=
expression
] ;
constraint
::=
range_constraint
|
index_constraint
[93LRM 4.2] [26]
decimal_literal
::= [93LRM 13.4.1] [27]
integer
[ .
integer
] [ E [ + ]
integer
| E –
integer
]
design_file
::= [93LRM 11.1] [28]
{
library_clause
|
use_clause
}
library_unit
{ {
library_clause
|
use_clause
}
library_unit
}
disconnection_specification
::= [93LRM 5.3] [29]
disconnect
guarded_
signal_list
:
type_mark
after
time_
expression
;
discrete_range
::= [93LRM 3.2.1]
discrete_
subtype_indication
|
range
[30]
entity_class
::= [93LRM 5.1][31]
entity
|
architecture
|
configuration
|
procedure
|
function
|
package
|
type
|
subtype
|
constant
|
signal
|
variable
|
component
|
label
|
literal
|
units
|
group
|
file
entity_declaration
::= [93LRM 1.1] [32]
entity
identifier
is
[
generic
(
formal_generic_
interface_list
) ; ]
[
port
(
formal_port_
interface_list
) ; ]
{
subprogram_specification
; |
subprogram_body
|
subtype_declaration
|
constant_declaration
|
signal_declaration
|
file_declaration
|
alias_declaration
|
attribute_declaration
|
attribute_specification
|
type_declaration
|
disconnection_specification
|
use_clause
|
shared_
variable_declaration
|
group_template_declaration
|
group_declaration
}
[
begin
{ [
label
: ]
[
postponed
]
assertion
;
| [
label
: ]
[
postponed
]
passive_
procedure_call
;
|
passive_
process_statement
} ]
end
[
entity
]
[
entity_
identifier
] ;
entity_name_list
::= [93LRM 5.1] [33]
identifier
| " {
graphic_character
} "
| '
graphic_character
' [
signature
]
{ ,
identifier
| " {
graphic_character
} "
| '
graphic_character
' [
signature
]
}
|
others
|
all
enumeration_literal
::= [93LRM 3.1.1]
identifier
| '
graphic_character
' [34]
exit_statement
::= [93LRM 8.11] [35]
[
label
:]
exit
[
loop_
label
] [
when
boolean_
expression
] ;
expression
::= [93LRM 7.1] [36]
relation
{
and
relation
}
|
relation
{
or
relation
}
|
relation
{
xor
relation
}
|
relation
[
nand
relation
]
|
relation
[
nor
relation
]
|
relation
{
xnor
relation
}
factor
::= [93LRM 7.1]
primary
[ **
primary
] |
abs
primary
|
not
primary
[37]
file_declaration
::= [93LRM 4.3.1.4] [38]
file
identifier
{ ,
identifier
}
:
subtype_indication
[
[
open
file_open_kind_
expression
]
is
[ in | out ]
string_
expression
]
;
formal_part
::= [93LRM 4.3.2.2] [39]
generic_
name
|
port_
name
|
parameter_
name
|
function_
name
(
generic_
name
|
port_
name
|
parameter_
name
)
|
type_mark
(
generic_
name
|
port_
name
|
parameter_
name
)
function_call
::= [93LRM 7.3.3]
function_
name
[ (
parameter_
association_list
) ] [40]
generate_statement
::= [93LRM 9.7] [41]
generate_
label
:
for
identifier
in
discrete_
subtype_indication
|
range
|
if
boolean_
expression
generate
[ {
block_declarative_item
}
begin
]
{
concurrent_statement
}
end
generate
[
generate_
label
] ;
graphic_character
::= [93LRM 13.1] [42]
basic_graphic_character
| LOWER_CASE_LETTER | OTHER_SPECIAL_CHARACTER
group_declaration
::= [93LRM 4.7] [43]
group
identifier
:
group_template_
name
(
name
| '
graphic_character
'
{ ,
name
| '
graphic_character
' } ) ;
group_template_declaration
::= [93LRM 4.6] [44]
group
identifier
is
(
entity_class
[ <> ] { ,
entity_class
[ <> ] } ) ;
identifier
::= [93LRM 13.3] [45]
LETTER { [ UNDERLINE ] LETTER | DIGIT }
| \
graphic_character
{
graphic_character
} \
if_statement
::= [93LRM 8.7] [46]
[
if_
label
: ]
if
boolean_
expression
then
{
sequential_statement
}
{
elsif
boolean_
expression
then
{
sequential_statement
} }
[
else
{
sequential_statement
} ]
end
if
[
if_
label
]
;
index_constraint
::= [93LRM 3.2.1] (
discrete_range
{ ,
discrete_range
} ) [47]
integer
::= [§ 13.4.1] DIGIT { [ UNDERLINE ] DIGIT } [48]
interface_declaration
::= [93LRM 4.3.2] [49]
[
constant
]
identifier
{ ,
identifier
}
: [
in
]
subtype_indication
[ :=
static_
expression
]
| [
signal
]
identifier
{ ,
identifier
}
: [
in
|
out
|
inout
|
buffer
|
linkage
]
subtype_indication
[
bus
] [ :=
static_
expression
]
| [
variable
]
identifier
{ ,
identifier
}
: [
in
|
out
|
inout
|
buffer
|
linkage
]
subtype_indication
[ :=
static_
expression
]
|
file
identifier
{ ,
identifier
} :
subtype_indication
interface_list
::= [93LRM 4.3.2.1]
interface_declaration
{;
interface_declaration
} [50]
label
::=
identifier
[93LRM 9.7] [51]
library_clause
::= [93LRM 11.2]
library
identifier
{,
identifier
} ; [52]
library_unit
::= [93LRM 11.1] [53]
entity_declaration
|
configuration_declaration
|
package_declaration
|
architecture_body
|
package_body
literal
::= [93LRM 7.3.1] [54]
decimal_literal
|
based_literal
|
physical_literal
|
enumeration_literal
|
string_literal
|
bit_string_literal
|
null
loop_statement
::= [93LRM 8.9] [55]
[
loop_
label
: ]
[
while
boolean_
expression
|
for
identifier
in
discrete_range
]
loop
{
sequential_statement
}
end
loop
[
loop_
label
] ;
name
::= [93LRM 6.1] [56]
identifier
| " {
graphic_character
} "
|
prefix
.
suffix
|
prefix
(
expression
{ ,
expression
} )
|
prefix
(
discrete_range
)
|
attribute_name
next_statement
::= [93LRM 8.10] [57]
[
label
: ]
next
[
loop_
label
] [
when
boolean_
expression
] ;
null_statement
::= [93LRM 8.13] [
label
: ]
null
; [58]
package_body
::= [93LRM 2.6] [59]
package
body
package_
identifier
is
{
subprogram_specification
; |
subprogram_body
|
type_declaration
|
subtype_declaration
|
constant_declaration
|
file_declaration
|
alias_declaration
|
use_clause
|
shared_
variable_declaration
|
group_template_declaration
|
group_declaration
}
end
[
package
body
]
[
package_
identifier
] ;
package_declaration
::= [93LRM 2.5] [60]
package
identifier
is
{
subprogram_specification
; |
type_declaration
|
subtype_declaration
|
constant_declaration
|
signal_declaration
|
file_declaration
|
alias_declaration
|
component_declaration
|
attribute_declaration
|
attribute_specification
|
disconnection_specification
|
use_clause
|
shared_
variable_declaration
|
group_template_declaration
|
group_declaration
}
end
[
package
]
[
package_
identifier
] ;
physical_literal
::= [93LRM 3.1.3] [
decimal_literal
|
based_literal
]
unit_
name
[61]
physical_type_definition
::= [93LRM 3.1.3] [62]
range_constraint
units
identifier
;
{
identifier
=
physical_literal
; }
end
units
[
physical_type_
identifier
]
prefix
::= [93LRM 6.1]
name
|
function_call
[63]
primary
::= [93LRM 7.1] [64]
name
|
literal
|
aggregate
|
function_call
|
type_mark
' (
expression
) |
type_mark
'
aggregate
|
type_mark
(
expression
)
| (
expression
)
|
new
subtype_indication
|
new
type_mark
' (
expression
) |
new
type_mark
'
aggregate
procedure_call
::= [93LRM 8.6]
procedure_
name
[ (
parameter_
association_list
) ] [65]
process_statement
::= [93LRM 9.2 ] [66]
[
process_
label
: ]
[
postponed
]
process
[ (
signal_
name
{ ,
signal_
name
} ) ]
[
is
]
{
subprogram_specification
; |
subprogram_body
|
type_declaration
|
subtype_declaration
|
constant_declaration
|
variable_declaration
|
file_declaration
|
alias_declaration
|
attribute_declaration
|
attribute_specification
|
use_clause
|
group_template_declaration
|
group_declaration
}
begin
{
sequential_statement
}
end
[
postponed
]
process
[
process_
label
] ;
range
::= [93LRM 3.1] [67]
range_
attribute_name
|
simple_expression
to
|
downto
simple_expression
range_constraint
::= [93LRM 3.1]
range
range
[68]
record_type_definition
::= [93LRM 3.2.2] [69]
record
identifier
{,
identifier
} :
subtype_indication
;
{
identifier
{,
identifier
} :
subtype_indication
; }
end
record
[
record_type_
identifier
]
relation
::= [93LRM 7.1] [70]
simple_expression
[
sll
|
srl
|
sla
|
sra
|
rol
|
ror
simple_expression
]
[ = | /= | < | <= | > | >=
simple_expression
[
sll
|
srl
|
sla
|
sra
|
rol
|
ror
simple_expression
]
]
report_statement
::= [93LRM 8.3] [71]
[
label
: ]
report
expression
[
severity
expression
] ;
return_statement
::= [93LRM 8.12]
[
label
: ]
return
[
expression
] ; [72]
selected_signal_assignment
::= [93LRM 9.5.2] [73]
with
expression
select
name
|
aggregate
<= [
guarded
]
[
transport
| [
reject
time_
expression
]
inertial
]
waveform
when
choice
{ |
choice
}
{ ,
waveform
when
choice
{ |
choice
} } ;
sequential_statement
::= [93LRM 8] [74]
wait_statement
|
[
label
: ]
assertion
;
|
report_statement
|
signal_assignment_statement
|
variable_assignment_statement
|
[
label
: ]
procedure_call
;
|
if_statement
|
case_statement
|
loop_statement
|
next_statement
|
exit_statement
|
return_statement
|
null_statement
signal_assignment_statement
::= [93LRM 8.4] [75]
[
label
: ]
name
|
aggregate
<=
[
transport
|
[
reject
time_
expression
]
inertial
]
waveform
;
signal_declaration
::= [93LRM 4.3.1.2] [76]
signal
identifier
{,
identifier
} :
subtype_indication
[
register
|
bus
] [ :=
expression
] ;
signal_list
::= [93LRM 5.3]
signal_
name
{ ,
signal_
name
} |
others
|
all
[77]
signature
::= [93LRM 2.3.2] [78]
[ [
type_mark
{ ,
type_mark
} ] [
return
type_mark
] ]
simple_expression
::= [93LRM 7.1] [ + | - ]
term
{ + | - | &
term
} [79]
string_literal
::= [93LRM 13.6] " {
graphic_character
} "
[80]
subprogram_body
::= [93LRM 2.2] [81]
subprogram_specification
is
{
subprogram_specification
;
|
subprogram_body
|
type_declaration
|
subtype_declaration
|
constant_declaration
|
variable_declaration
|
file_declaration
|
alias_declaration
|
attribute_declaration
|
attribute_specification
|
use_clause
|
group_template_declaration
|
group_declaration
}
begin
{
sequential_statement
}
end
[
procedure
|
function
]
[
identifier
| " {
graphic_character
} " ] ;
subprogram_specification
::= [93LRM 2.1] [82]
procedure
identifier
| " {
graphic_character
} "
[ (
parameter_
interface_list
) ]
|
[
pure
|
impure
]
function
identifier
| " {
graphic_character
} "
[ (
parameter_
interface_list
) ]
return
type_mark
subtype_declaration
::= [93LRM 4.2] [83]
subtype
identifier
is
[
resolution_function_
name
]
type_mark
[
constraint
] ;
subtype_indication
::= [93LRM 4.2] [84]
[
resolution_function_
name
]
type_mark
[
< |