Professional Documents
Culture Documents
VHDL BASICS
Design entities and configurations
The design entity is the primary hardware abstraction in VHDL. It
represents a portion of a hardware designthat has well-defined inputs and outputs and
performs a well-defined function. A design entity may representan entire system, a
subsystem, a board, a chip, a macro-cell, a logic gate, or any level of abstraction in
between.A configuration can be used to describe how design entities are put together to
form a complete design.
A design entity may be described in terms of a hierarchy of blocks, each of which
represents a portion of the whole design. The top-level block in such a hierarchy is the
design entity itself; such a block is an external block that resides in a library and may be
used as a component of other designs. Nested blocks in the hierarchy are internal blocks,
defined by block statements
5.1Entity declarations:
An entity declaration defines the interface between a given design entity and the
environment in which it issued. It may also specify declarations and statements that are
part of the design entity. A given entity declaration may be shared by many design
entities, each of which has a different architecture. Thus, an entity declaration can
potentially represent a class of design entities, each with the same interface.
entity_declaration ::=
entity identifier is
entity_header
entity_declarative_part
[ begin
entity_statement_part ]
end [ entity ] [ entity_simple_name ] ;
5.1.1Generics:
Generics provide a channel for static information to be communicated to a block from its
environment. The following applies to both external blocks defined by design entities and
to internal blocks defined by block
statements.
generic_list ::= generic_interface_list
The generics of a block are defined by a generic interface list. Each interface element in
such a generic interface list declares a formal generic.
5.1.2 Ports:
Ports provide channels for dynamic communication between a block and its environment.
primary_unit_declaration
{ secondary_unit_declaration }
end units [ physical_type_simple_name ]
5.4.1.4 Floating point types:
Floating point types provide approximations to the real numbers. Floating point
types are useful for models in which the precise characterization of a floating point
calculation is not important or not determined.
floating_type_definition ::= range_constraint
5.4.2 Composite types:
Composite types are used to define collections of values. These include both
arrays of values (collections of values of a homogeneous type) and records of values
(collections of values of potentially heterogeneous types).
5.4.2.1 Array types
An array object is a composite object consisting of elements that have the same
subtype. The name for an element of an array uses one or more index values belonging to
specified discrete types. The value of an array object is a composite value consisting of
the values of its elements
unconstrained_array_definition ::=
array
(
index_subtype_definition
{
,
index_subtype_definition } )
of element_subtype_indication
constrained_array_definition ::=
array index_constraint of element_subtype_indication
A file type definition defines a file type. File types are used to define objects
representing files in the hostsystem environment. The value of a file object is the
sequence of values contained in the host system file.
file_type_definition ::= file of type_mark
5.5 Data Objects:
5.5.1 Object declarations
An object declaration declares an object of a specified type. Such an object is called an
explicitly declared object.
5.5.1.1 Constant declarations
A constant declaration declares a constant of the specified type. Such a constant
is an explicitly declared constant.
constant_declaration ::=
constant identifier_list : subtype_indication [ := expression ] ;
If the assignment symbol ":=" followed by an expression is present in a constant
declaration, the expression specifies the value of the constant; the type of the expression
must be that of the constant. The value of a constant cannot be modified after the
declaration is elaborated.
5.5.1.2 Signal declarations
A signal declaration declares a signal of the specified type. Such a signal is an explicitly
declared signal.
signal_declaration ::=
signal identifier_list : subtype_indication [ signal_kind ] [ := expression ] ;
signal_kind ::= register | bus
5.5.1.3 Variable declarations
A variable declaration declares a variable of the specified type. Such a variable is
an explicitly declared variable.
variable_declaration ::=
[ shared ] variable identifier_list : subtype_indication [ := expression ] ;
5.5.1.4 File declarations
A file declaration declares a file of the specified type. Such a file is an explicitly declared
file.
file_declaration ::=
file identifier_list : subtype_indication [ file_open_information ] ;
5.6 Operators:
5.6.1.Logical Operators:
The logical operators and, or, nand, nor, xor, xnor, and not are defined for
predefined types BIT and BOOLEAN. They are also defined for any one-dimensional
array type whose element type is BIT or BOOLEAN. For the binary operators and, or,
nand, nor, xor, and xnor, the operands must be of the same base type. Moreover, for the
binary operators and, or, nand, nor, xor, and xnor defined on one-dimensional array
types, the operands must be arrays of the same length, the operation is performed on
matching elements of the arrays, and the result is an array with the same index range as
the left operand.
5.6.2.Relational Operators.
Relational operators include tests for equality, inequality, and ordering of
operands. The operands of each relational operator must be of the same type. The result
type of each relational operator is the predefined type BOOLEAN.
Operator
Operation
=
Operand
Type
Result Type
Equality
Any Type
Boolean
/=
Inequality
Any Type
Boolean
<
Less Than
Any ScalarType or
Descrete type
Boolean
Any ScalarType or
Descrete type
Boolean
Than
Any ScalarType or
Descrete type
Boolean
Greater Than or
Equal
Any ScalarType or
Descrete type
Boolean
<=
>
>=
Greater
5.6.3.Shift Operators.
The shift operators sll, srl, sla, sra, rol, and ror are defined for any one-dimensional
array type whose element type is either of the predefined types BIT or BOOLEAN.
Operator
Operation
sll
srl
Shift lef
logical
Shift right
logical
Left operand
type
Any one-dimensional
array
type
whose
element
type
is
BIT
or
BOOLEAN
Any one-dimensional
array
type
whose
element
type
is
BIT
or
Right
operand
Type
Result
type
INTEGER
Same
left
as
INTEGER
Same
left
as
BOOLEAN
sla
Shift
left
arithmetic
Any one-dimensional
array
type
whose
element
type
is
BIT
or
BOOLEAN
INTEGER
Shift right
arithmetic
Any one-dimensional
array
type
whose
element
type
is
BIT
or
BOOLEAN
INTEGER
sra
Any one-dimensional
array
type
whose
element
type
is
BIT
or
BOOLEAN
INTEGER
rol
Rotate left
logical
ror
Rotate right
logical
Any one-dimensional
array
type
whose
element
type
is
BIT
or
BOOLEAN
INTEGER
Same
left
as
Same
left
as
Same
left
as
sSame
left
as
5.6.4.Adding Operators.
The adding operators + and are predefined for any numeric type and have their
conventional mathematical meaning. The concatenation operator & is predefined for any
one-dimensional array type.
Operator
Operation
Left operand
type
Right operand
Type
Same type
Addition
Any
type
numeric
Subtraction
Same type
Result
Type
Same type
Same type
Same
type
array
Same
type
array
Same
type
array
Any element
type
5.6.5. Multiplying Operators:
The operators * and / are predefined for any integer and any floating point type and
have their conventional mathematical meaning; the operators mod and rem are
predefined for any integer type. For each of these operators, the operands and the result
are of the same type.
Operator
Operation
Multiplication
Division
mod
Modulus
rem
Remainde
Left operand
type
Right
operand
Type
Any integertype
Result
Type
Same type
Same type
Same type
Same type
Same type
Same type
Same type
Same type
Same type
Same type
Same type
Same type
Any
type
floating
point
floating
point
Operand
Operation
Result type
type
abs
Absolute value
The exponentiating operator ** is predefined for each integer type and for each floating
point type. In either case the right operand, called the exponent, is of the predefined type
INTEGER.
Operator
**
Operation
Exponentiation
Left operand
type
Right operand
Type
Result
Type
INTEGER
Same as left
INTEGER
Same as left
process_statement ::=
[ process_label : ]
[ postponed ] process [ ( sensitivity_list ) ] [ is ]
process_declarative_part
begin
process_statement_part
end [ postponed ] process [ process_label ] ;
where the sensitivity list of the wait statement is that following the reserved word
process. Such a process statement must not contain an explicit wait statement. Similarly,
if such a process statement is a parent of a procedure, then that procedure may not contain
a wait statement.
5.7.2 Sequential statements:
The various forms of sequential statements are described in this section.
Sequential statements are used to define algorithms for the execution of a subprogram or
process; they execute in the order in which they appear.
5.7.2.1 Wait statement
The wait statement causes the suspension of a process statement or a procedure .
wait_statement ::=
[ label : ] wait [ sensitivity_clause ] [ condition_clause ] [ timeout_clause ] ;
sensitivity_clause ::= on sensitivity_list
sensitivity_list ::= signal_name { , signal_name }
condition_clause ::= until condition
condition ::= boolean_expression
timeout_clause ::= for time_expression
5.7.2.2 Assertion statement:
An assertion statement checks that a specified condition is true and reports an
error if it is not.
assertion_statement ::= [ label : ] assertion ;
assertion ::=
assert condition
[ report expression ]
[ severity expression ]
5.7.2.3 Report statement:
A report statement displays a message.
report_statement ::=
[ label : ]
report expression
[ severity expression ] ;
5.7.2.4 If statement:
An if statement selects for execution one or none of the enclosed sequences of
statements, depending on the value of one or more corresponding conditions.
if_statement ::=
[ if_label : ]
if condition then
sequence_of_statements
{ elsif condition then
sequence_of_statements }
[ else
sequence_of_statements ]
end if [ if_label ] ;
If a label appears at the end of an if statement, it must repeat the if label.
For the execution of an if statement, the condition specified after if, and any
conditions specified after elsif, are evaluated in succession (treating a final else as elsif
TRUE then) until one evaluates to TRUE or all conditions are evaluated and yield
FALSE. If one condition evaluates to TRUE, then the corresponding sequence of
statements is executed; otherwise, none of the sequences of statements is executed.
1.7.2.5 Case statement:
A case statement selects for execution one of a number of alternative sequences
of statements; the chosen alternative is defined by the value of an expression.
case_statement ::=
[ case_label : ]
case expression is
case_statement_alternative
{ case_statement_alternative }
end case [ case_label ] ;
case_statement_alternative ::=
when choices =>
sequence_of_statements
The expression must be of a discrete type, or of a one-dimensional array type
whose element base type is a character type. This type must be determinable
independently of the context in which the expression occurs, but using the fact that the
expression must be of a discrete type or a one-dimensional character array type. Each
choice in a case statement alternative must be of the same type as the expression; the list
of choices specifies for which values of the expression the alternative is chosen.
5.7.2.6 Loop statement:
A loop statement includes a sequence of statements that is to be executed
repeatedly, zero or more times.
loop_statement ::=
[ loop_label : ]
[ iteration_scheme ] loop
sequence_of_statements
end loop [ loop_label ] ;
iteration_scheme ::=
while condition
| for loop_parameter_specification
parameter_specification ::=
identifier in discrete_range
5.7.2.7 Next statement:
A next statement is used to complete the execution of one of the iterations of an
enclosing loop statement (called loop in the following text). The completion is conditional
if the statement includes a condition.
next_statement ::=
[ label : ] next [ loop_label ] [ when condition ] ;
5.7.2.8 Exit statement:
An exit statement is used to complete the execution of an enclosing loop
statement (called loop in the following text). The completion is conditional if the
statement includes a condition.
exit_statement ::=
[ label : ] exit [ loop_label ] [ when condition ] ;
5.7.2.9 Return statement
A return statement is used to complete the execution of the innermost enclosing
function or procedure body
.return_statement ::=
[ label : ] return [ expression ] ;
5.7.2.10 Null statement
A null statement performs no action.
null_statement ::=
[ label : ] null ;
5.8 Data Flow Modeling:
block_statement ::=
block_label :
block [ ( guard_expression ) ] [ is ]
block_header
block_declarative_part
begin
block_statement_part
end block [ block_label ] ;
If a guard expression appears after the reserved word block, then a signal with
the simple name GUARD of predefined type BOOLEAN is implicitly declared at the
beginning of the declarative part of the block, and the guard expression defines the value
of that signal at any given time (see 12.6.4). The type of the guard expression must be
type BOOLEAN. Signal GUARD may be used to control the operation of certain
statements within the block (see 9.5).
5.8.2 Concurrent procedure call statements:
A concurrent procedure call statement represents a process containing the
corresponding sequential procedure call statement.
concurrent_procedure_call_statement ::=
[ label : ] [ postponed ] procedure_call ;
For any concurrent procedure call statement, there is an equivalent process
statement. The equivalent process statement is a postponed process if and only if the
concurrent procedure call statement includes the reserved word postponed.
5.8.3 Concurrent assertion statements:
A concurrent assertion statement represents a passive process statement containing the
specified assertion statement.
concurrent_assertion_statement ::=
[ label : ] [ postponed ] assertion ;
5.8.4 Concurrent signal assignment statements
A concurrent signal assignment statement represents an equivalent process
statement that assigns values to signals.
concurrent_signal_assignment_statement ::=
[ label : ] [ postponed ] conditional_signal_assignment