# Programmable Logic/VHDL General Syntax

This page of the Programmable Logic book is a stub. You can help by expanding it.
VHDL's syntax is derived from ADA. It is strongly typed and case insensitive.

## Identifiers

An identifier in VHDL must begin with a letter and can be any combination of letters, digits, and underscore (_).

## Comments

A comment in VHDL is denoted with a "--":
Everything after the "--" to the end of the line is considered a comment.

## Keywords

The following words are VHDL keywords and cannot be used for identifiers (signal names, process names, entity names, etc...)
Top

### VHDL 1987

This is an incomplete list...
Top

### VHDL 1993

VHDL 1987 keywords and:
Top

### VHDL 2000

VHDL 1993 and 1987 keywords, additionally:
Top

### VHDL 2002

VHDL 1993, 1987 and 2000 keywords, additionally:
Top

### VHDL 2008

VHDL 1993, 1987, 2000 and 2002 keywords, additionally:
Top

### VHDL 2019

VHDL 1993, 1987, 2000, 2002 and 2008 keywords, additionally:

## Alphabetical Reference
### links to other references

https://peterfab.com/ref/vhdl/vhdl_renerta/source/vhd00001.htm
https://ics.uci.edu/~jmoorkan/vhdlref/vhdl.html

### abs
#### Introduction

The abs command in VHDL is a predefined function that returns the absolute value of a numeric argument.
For example, abs(-3) returns 3, and abs(4.5) returns 4.5.
The abs command can be used with any numeric type, such as integer, real, or fixed-point.

#### Notes

The 1987 version of VHDL saw the introduction of abs.
The abs command is synthesiseable.
synthesizable, Rules, tips, common mistakes, related keywords etc

#### Syntax

Top

### access
#### Introduction

In VHDL, an access type is like a pointer in other programming languages. It allows you to create and manipulate data that is created dynamically during simulation. This means that you can create new data on the fly, and the size of the data doesn’t have to be known in advance.
For example, imagine you want to create a list of numbers, but you don’t know how many numbers there will be. You could use an access type to create a linked list, where each item in the list points to the next item. This way, you can add as many items to the list as you want, without having to know the size of the list beforehand.
Access types are very useful for modeling potentially large structures, like memories or FIFOs, but they are not supported by synthesis tools.

#### Notes

The 1987 version of VHDL saw the introduction of access.
Not synthesizable
See https://peterfab.com/ref/vhdl/vhdl_renerta/source/vhd00001.htm

#### Syntax

Top

### after
#### Introduction

The VHDL command “after” is used to introduce a delay in the assignment of a signal. It is used to specify the time after which the signal should be assigned a new value. For example, x <= '1' after 10 ns; means that the signal x will be assigned the value '1' after 10 nanoseconds have passed.

#### Notes

The 1987 version of VHDL saw the introduction of after.
Not Synthesisable.
Delays are not supported in functions.
It is important to note that the “after” command has to do with the delay model. In the default VHDL inertial delay, your second “slower” signal assignment statement cancels the future update of the first. You could schedule multiple updates in one statement to correct this, for example: x <= '1' after 10 ns, '0' after 20 ns;.
see http://gmvhdl.com/delay.htm

#### Syntax

Top

### alias
#### Introduction

Aliases, are alternative names for existing objects, such as signals, variables, constants, types, etc. Aliases can be useful for making your code more readable, avoiding name conflicts, or accessing parts of an array or a record.
You can also use a special syntax << ... >> to create external names, which are aliases that can access objects in other design units or hierarchy levels

#### Notes

The 1987 version of VHDL saw the introduction of alias.
Aliases are local to the declarative region where they are defined, and they cannot be redefined or overridden.
Aliases cannot be used as targets of assignments.
Aliases can be used in any place where the original name can be used, such as expressions, statements, or subprogram calls.
See https://peterfab.com/ref/vhdl/vhdl_renerta/mobile/source/vhd00003.htm

#### Syntax

Top

### all
#### Introduction

The keyword "all" in a context declaration is a way to specify a set of libraries, packages, and entities that are used in a design unit.
For example, you can write:
This means that all the design units that reference this context will have access to the ieee library and the packages std_logic_1164 and numeric_std. The keyword "all" in this case means that all the design units in the current working library can use this context.

#### Alternative

Since VHDL-2008, the keyword "all" is used to indicate that the sensitivity list of a process should be inferred by the tool, rather than explicitly specified by the designer.
The sensitivity list is a list of signals that trigger the execution of the process when they change their values.
For example, consider the following process that implements a D flip-flop with asynchronous reset:
The sensitivity list of this process is (i_clk, i_rst), which means that the process will run whenever i_clk or i_rst changes. However, we can also use the keyword "all" to let the tool infer the sensitivity list for us:
This is equivalent to the previous process, as the tool will automatically determine that i_clk and i_rst are the only signals that affect the behavior of the process.
Using the keyword "all" can be convenient and less error-prone, as it avoids the need to manually update the sensitivity list when adding or removing signals from the process.
Some tools may not support this feature, or may generate different results depending on the sensitivity list inference algorithm so check the tool documentation and verify the synthesis and simulation results before using the keyword "all" in a clocked process.

#### Notes

The 1987 version of VHDL saw the introduction of all.
Top

### and
#### Introduction

This keyword is used to represent the logical AND operation, which is a basic building block in digital logic circuits.
The `AND` operator performs a bitwise AND operation if the operands are vectors (arrays of bits like std_logic_vector) or performs a logical AND operation if the operands are of type bit or boolean.
If all inputs are ‘1’, the result is ‘1’. Otherwise, the result is ‘0’.
This behavior mimics the functionality of an AND gate in digital electronics.

#### Notes

The 1987 version of VHDL saw the introduction of and.
see
https://fpgatutorial.com/vhdl-logical-operators-and-signal-assignments-for-combinatorial-logic/

#### Syntax

Top

### architecture
#### Introduction

The term "Architecture" assumes a pivotal role. It serves as a formal blueprint associated with an entity declaration, tasked with elucidating the internal organization and operation of a design entity. In essence, an architecture delineates the behavior, data flow, or structural composition of the design entity with precision and rigor. This technical construct finds utility in describing the intricate relationships between input and output ports within a design, encompassing two primary components: declarations and concurrent statements. Declarations encompass various elements, including types, signals, constants, subprograms, components, and groups, while concurrent statements articulate how inputs interact with outputs, with diverse statement types allowing for flexibility in expressing design functionality. Architecture, in the context of VHDL, embodies a systematic and unambiguous approach to defining the fundamental characteristics of digital systems, laying the foundation for their subsequent implementation and analysis.
The architecture is used to detail the behavior, data flow, or structure of a design entity.
An architecture linked to an entity primarily delineates the inner relationships between the input and output ports of the entity. It consists of two primary components: declarations and concurrent statements.
The declarative part of an architecture encompasses various types of declarations, such as types, signals, constants, subprograms (functions and procedures), components, and groups. Detailed information on each of these can be found in their respective topics.
Concurrent statements, on the other hand, describe how inputs relate to outputs within the architecture. These relationships can be expressed through diverse types of statements, including concurrent signal assignments, process statements, component instantiations, concurrent procedure calls, generate statements, concurrent assertion statements, and block statements. These statements can be written in various styles, such as structural, dataflow, behavioral (functional), or mixed, depending on the intended design.
Structural descriptions rely on component instantiation and generate statements, enabling the creation of hierarchical projects that range from simple gates to intricate components, encompassing entire subsystems. These components connect through ports, as illustrated in Example 1 for a BCD decoder.
Dataflow descriptions employ concurrent signal assignment statements. Each statement can activate when any of its input signals change, describing the circuit's behavior and structure, as showcased in Example 2.
In contrast, a behavioral description, as demonstrated in Example 3, includes only one or more processes, each containing sequential statements. This approach focuses solely on the expected functionality of the circuit, without specifying hardware implementation details.
A mixed architecture description, as seen in Example 4, combines both behavioral and structural elements within the same architecture body.

#### Notes

The 1987 version of VHDL saw the introduction of architecture.
An entity can have multiple architectures, but an architecture cannot be assigned to different entities.
An architecture must be associated with an entity.
All declarations within an entity are entirely visible and accessible within any architecture assigned to that entity.
Different types of statements, such as processes, blocks, concurrent signal assignments, component instantiations, etc., can coexist within the same architecture.

#### Syntax

Top

### array
#### Introduction

Introduction to the Keyword "Array" in VHDL:
In VHDL, the keyword "Array" is a versatile data type to structure and organise data. In VHDL, an array is formally defined as a type whose value consists of elements of the same subtype, making it ideal for managing homogeneous data sets. What distinguishes each element within an array is an index (or indices, for multidimensional arrays) associated with it. These indices are required to be values of a discrete type and must fall within the specified index range.
In simpler terms, an array is like a container that holds elements of a consistent type, and each element is uniquely identified by its index. The number of indices directly corresponds to the number of dimensions; for example, a one-dimensional array has one index, while a two-dimensional array has two.
Arrays in VHDL come in two flavors: constrained and unconstrained. A constrained array has a fixed size, determined either by a discrete type mark or a specified range. In contrast, an unconstrained array does not have a predefined size; its size is only determined when you declare an object of that type.
For instance, VHDL's Package STANDARD includes predefined unconstrained array types like STRING and BIT_VECTOR. These arrays are widely used, with STRING elements indexed by positive values and BIT_VECTOR elements indexed by natural values.
Arrays in VHDL can be manipulated using various techniques such as indexing, concatenation, aggregates, and slices. These methods provide flexibility in accessing and assigning values to array elements, making them a crucial component of VHDL programming.
It's worth noting that while arrays are a powerful tool in VHDL, not all synthesis tools support multidimensional arrays. There are exceptions, such as two-dimensional "vectors of vectors," and some synthesis tools allow limited support for two-dimensional arrays.
In summary, arrays in VHDL are fundamental data structures that allow you to efficiently manage and manipulate collections of data, making them a key element in VHDL programming.

#### Notes

The 1987 version of VHDL saw the introduction of array.

#### Syntax

Top

### assert
#### Introduction

In VHDL, the assert command is used to validate assumptions or conditions within your code. When the condition specified in the assert statement is false, an error message is generated, and the simulation can be halted, paused, or continue based on the severity level specified.
This feature is useful in VHDL for debugging, as it helps identify errors in the simulation phase, reducing the risk of issues in actual hardware.

#### Notes

The 1987 version of VHDL saw the introduction of assert.
Not Synthesisable.

#### Syntax The general syntax for the assert command is

e.g.
Each component of this syntax serves a specific purpose:
* <condition>: A boolean expression that the designer expects to be true. If false, the assert command will activate.
* <message>: (Optional) A string that provides additional information about the condition, helping to identify the reason for failure.
* <level>: (Optional) Specifies the severity level of the assertion failure, which controls how the simulation responds. Severity levels include:
** note: Minor information; simulation continues.
** warning: Indicates potential issues; simulation continues.
** error: A critical problem; simulation continues but indicates a serious issue.
** failure: Terminates the simulation, representing a fatal error.
Why Use the Assert Command?
Using assert commands enhances the reliability and maintainability of VHDL code. With assertions, designers can ensure that:
* Key assumptions hold true throughout the design.
* Corner cases are effectively handled.
* Critical sections of the design meet expected criteria during simulations.
Assertions are particularly useful in:
* Testbenches, to check expected values.
* Design specifications, to enforce conditions on inputs and outputs.
* Safety-critical applications, to prevent unexpected behaviors.
Top

### attribute
#### Notes

The 1987 version of VHDL saw the introduction of attribute.

#### Syntax

Top

### begin
#### Notes

The 1987 version of VHDL saw the introduction of begin.

#### Syntax

Top

### block
#### Notes

The 1987 version of VHDL saw the introduction of block.

#### Syntax

Top

### body
#### Notes

The 1987 version of VHDL saw the introduction of body.

#### Syntax

Top

### buffer
#### Notes

The 1987 version of VHDL saw the introduction of buffer.

#### Syntax

Top

### bus
#### Notes

The 1987 version of VHDL saw the introduction of bus.

#### Syntax

Top

### case
#### Notes

The 1987 version of VHDL saw the introduction of case.

#### Syntax

Top

### component
#### Notes

The 1987 version of VHDL saw the introduction of component.

#### Syntax

Top

### configuration
#### Notes

The 1987 version of VHDL saw the introduction of configuration.

#### Syntax

Top

### constant
#### Notes

The 1987 version of VHDL saw the introduction of constant.

#### Syntax

Top

### disconnect
#### Notes

The 1987 version of VHDL saw the introduction of disconnect.

#### Syntax

Top

### downto
#### Notes

The 1987 version of VHDL saw the introduction of downto.

#### Syntax

Top

### else
#### Notes

The 1987 version of VHDL saw the introduction of else.

#### Syntax

Top

### elsif
#### Notes

The 1987 version of VHDL saw the introduction of elsif.

#### Syntax

Top

### end
#### Notes

The 1987 version of VHDL saw the introduction of end.

#### Syntax

Top

### entity
#### Notes

The 1987 version of VHDL saw the introduction of entity.

#### Syntax

Top

### exit
#### Notes

The 1987 version of VHDL saw the introduction of exit.

#### Syntax

Top

### file
#### Notes

The 1987 version of VHDL saw the introduction of file.

#### Syntax

Top

### for
#### Notes

The 1987 version of VHDL saw the introduction of for.

#### Syntax

Top

### function
#### Notes

The 1987 version of VHDL saw the introduction of function.

#### Syntax

Top

### generate
#### Notes

The 1987 version of VHDL saw the introduction of generate.

#### Syntax

Top

### generic
#### Notes

The 1987 version of VHDL saw the introduction of generic.

#### Syntax

Top

### guarded
#### Notes

The 1987 version of VHDL saw the introduction of guarded.

#### Syntax

Top

### if
#### Notes

The 1987 version of VHDL saw the introduction of if.

#### Syntax

Top

### in
#### Notes

The 1987 version of VHDL saw the introduction of in.

#### Syntax

Top

### inout
#### Notes

The 1987 version of VHDL saw the introduction of inout.

#### Syntax

Top

### is
#### Notes

The 1987 version of VHDL saw the introduction of is.

#### Syntax

Top

### label
#### Notes

The 1987 version of VHDL saw the introduction of label.

#### Syntax

Top

### library
#### Notes

The 1987 version of VHDL saw the introduction of library.

#### Syntax

Top

### linkage
#### Notes

The 1987 version of VHDL saw the introduction of linkage.

#### Syntax

Top

### loop
#### Notes

The 1987 version of VHDL saw the introduction of loop.

#### Syntax

Top

### map
#### Notes

The 1987 version of VHDL saw the introduction of map.

#### Syntax

Top

### mod
#### Notes

The 1987 version of VHDL saw the introduction of mod.

#### Syntax

Top

### nand
#### Notes

The 1987 version of VHDL saw the introduction of nand.

#### Syntax

Top

### new
#### Notes

The 1987 version of VHDL saw the introduction of new.

#### Syntax

Top

### next
#### Notes

The 1987 version of VHDL saw the introduction of next.

#### Syntax

Top

### nor
#### Notes

The 1987 version of VHDL saw the introduction of nor.

#### Syntax

Top

### not
#### Notes

The 1987 version of VHDL saw the introduction of not.

#### Syntax

Top

### null
#### Notes

The 1987 version of VHDL saw the introduction of null.

#### Syntax

Top

### of
#### Notes

The 1987 version of VHDL saw the introduction of of.

#### Syntax

Top

### on
#### Notes

The 1987 version of VHDL saw the introduction of on.

#### Syntax

Top

### open
#### Notes

The 1987 version of VHDL saw the introduction of open.

#### Syntax

Top

### or
#### Notes

The 1987 version of VHDL saw the introduction of or.

#### Syntax

Top

### others
#### Notes

The 1987 version of VHDL saw the introduction of others.

#### Syntax

Top

### out
#### Notes

The 1987 version of VHDL saw the introduction of out.

#### Syntax

Top

### package
#### Notes

The 1987 version of VHDL saw the introduction of package.

#### Syntax

Top

### port
#### Notes

The 1987 version of VHDL saw the introduction of port.

#### Syntax

Top

### procedure
#### Notes

The 1987 version of VHDL saw the introduction of procedure.

#### Syntax

Top

### process
#### Notes

The 1987 version of VHDL saw the introduction of process.

#### Syntax

Top

### range
#### Notes

The 1987 version of VHDL saw the introduction of range.

#### Syntax

Top

### record
#### Notes

The 1987 version of VHDL saw the introduction of record.

#### Syntax

Top

### register
#### Notes

The 1987 version of VHDL saw the introduction of register.

#### Syntax

Top

### rem
#### Notes

The 1987 version of VHDL saw the introduction of rem.

#### Syntax

Top

### report
#### Notes

The 1987 version of VHDL saw the introduction of report.

#### Syntax

Top

### return
#### Notes

The 1987 version of VHDL saw the introduction of return.

#### Syntax

Top

### select
#### Notes

The 1987 version of VHDL saw the introduction of select.

#### Syntax

Top

### severity
#### Notes

The 1987 version of VHDL saw the introduction of severity.

#### Syntax

Top

### signal
#### Notes

The 1987 version of VHDL saw the introduction of signal.

#### Syntax

Top

### subtype
#### Notes

The 1987 version of VHDL saw the introduction of subtype.

#### Syntax

Top

### then
#### Notes

The 1987 version of VHDL saw the introduction of then.

#### Syntax

Top

### to
#### Notes

The 1987 version of VHDL saw the introduction of to.

#### Syntax

Top

### transport
#### Notes

The 1987 version of VHDL saw the introduction of transport.

#### Syntax

Top

### type
#### Notes

The 1987 version of VHDL saw the introduction of type.

#### Syntax

Top

### units
#### Notes

The 1987 version of VHDL saw the introduction of units.

#### Syntax

Top

### until
#### Notes

The 1987 version of VHDL saw the introduction of until.

#### Syntax

Top

### use
#### Notes

The 1987 version of VHDL saw the introduction of use.

#### Syntax

Top

### variable
#### Notes

The 1987 version of VHDL saw the introduction of variable.

#### Syntax

Top

### wait
#### Notes

The 1987 version of VHDL saw the introduction of wait.

#### Syntax

Top

### when
#### Notes

The 1987 version of VHDL saw the introduction of when.

#### Syntax

Top

### while
#### Notes

The 1987 version of VHDL saw the introduction of while.

#### Syntax

Top

### with
#### Notes

The 1987 version of VHDL saw the introduction of with.

#### Syntax

Top

### xor
#### Notes

The 1987 version of VHDL saw the introduction of xor.