- •About This Manual
- •Additional Resources
- •Manual Contents
- •Conventions
- •Typographical
- •Online Document
- •Using Foundation Express with VHDL
- •Hardware Description Languages
- •Typical Uses for HDLs
- •Advantages of HDLs
- •About VHDL
- •Foundation Express Design Process
- •Using Foundation Express to Compile a VHDL Design
- •Design Methodology
- •Design Descriptions
- •Entities
- •Entity Generic Specifications
- •Entity Port Specifications
- •Architecture
- •Declarations
- •Components
- •Concurrent Statements
- •Constant Declarations
- •Processes
- •Signal Declarations
- •Subprograms
- •Type Declarations
- •Examples of Architectures for NAND2 Entity
- •Configurations
- •Packages
- •Using a Package
- •Package Structure
- •Package Declarations
- •Package Body
- •Resolution Functions
- •Data Types
- •Type Overview
- •Enumeration Types
- •Enumeration Overloading
- •Enumeration Encoding
- •Enumeration Encoding Values
- •Integer Types
- •Array Types
- •Constrained Array
- •Unconstrained Array
- •Array Attributes
- •Record Types
- •Record Aggregates
- •Predefined VHDL Data Types
- •Data Type BOOLEAN
- •Data Type BIT
- •Data Type CHARACTER
- •Data Type INTEGER
- •Data Type NATURAL
- •Data Type POSITIVE
- •Data Type STRING
- •Data Type BIT_VECTOR
- •Unsupported Data Types
- •Physical Types
- •Floating-Point Types
- •Access Types
- •File Types
- •Express Data Types
- •Subtypes
- •Expressions
- •Overview
- •Operators
- •Logical Operators
- •Relational Operators
- •Adding Operators
- •Unary (Signed) Operators
- •Multiplying Operators
- •Miscellaneous Arithmetic Operators
- •Operands
- •Operand Bit-Width
- •Computable Operands
- •Aggregates
- •Attributes
- •Expressions
- •Function Calls
- •Identifiers
- •Indexed Names
- •Literals
- •Numeric Literals
- •Character Literals
- •Enumeration Literals
- •String Literals
- •Qualified Expressions
- •Records and Fields
- •Slice Names
- •Limitations on Null Slices
- •Limitations on Noncomputable Slices
- •Type Conversions
- •Sequential Statements
- •Assignment Statements and Targets
- •Simple Name Targets
- •Indexed Name Targets
- •Slice Targets
- •Field Targets
- •Aggregate Targets
- •Variable Assignment Statements
- •Signal Assignment Statements
- •Variable Assignment
- •Signal Assignment
- •if Statements
- •Evaluating Conditions
- •Using the if Statement to Infer Registers and Latches
- •case Statements
- •Using Different Expression Types
- •Invalid case Statements
- •loop Statements
- •Basic loop Statement
- •while...loop Statements
- •for...loop Statements
- •Steps in the Execution of a for...loop Statement
- •for...loop Statements and Arrays
- •next Statements
- •exit Statements
- •Subprograms
- •Subprogram Always a Combinatorial Circuit
- •Subprogram Declaration and Body
- •Subprogram Calls
- •Procedure Calls
- •Function Calls
- •return Statements
- •Procedures and Functions as Design Components
- •Example with Component Implication Directives
- •Example without Component Implication Directives
- •wait Statements
- •Inferring Synchronous Logic
- •Combinatorial Versus Sequential Processes
- •null Statements
- •Concurrent Statements
- •Overview
- •process Statements
- •Combinatorial Process Example
- •Sequential Process Example
- •Driving Signals
- •block Statements
- •Nested Blocks
- •Guarded Blocks
- •Concurrent Versions of Sequential Statements
- •Concurrent Procedure Calls
- •Concurrent Signal Assignments
- •Simple Concurrent Signal Assignments
- •Conditional Signal Assignments
- •Selected Signal Assignments
- •Component Instantiation Statements
- •Direct Instantiation
- •generate Statements
- •for...generate Statements
- •Steps in the Execution of a for...generate Statement
- •Common Usage of a for...generate Statement
- •if...generate Statements
- •Register and Three-State Inference
- •Register Inference
- •The Inference Report
- •Latch Inference Warnings
- •Controlling Register Inference
- •Inferring Latches
- •Inferring Set/Reset (SR) Latches
- •Inferring D Latches
- •Inferring Master-Slave Latches
- •Inferring Flip-Flops
- •Inferring D Flip-Flops
- •Inferring JK Flip-Flops
- •Inferring Toggle Flip-Flops
- •Getting the Best Results
- •Understanding Limitations of Register Inference
- •Three-State Inference
- •Reporting Three-State Inference
- •Controlling Three-State Inference
- •Inferring Three-State Drivers
- •Inferring a Simple Three-State Driver
- •Three-State Driver with Registered Enable
- •Three-State Driver Without Registered Enable
- •Writing Circuit Descriptions
- •How Statements Are Mapped to Logic
- •Design Structure
- •Adding Structure
- •Using Variables and Signals
- •Using Parentheses
- •Using Design Knowledge
- •Optimizing Arithmetic Expressions
- •Arranging Expression Trees for Minimum Delay
- •Sharing Common Subexpressions
- •Changing an Operator Bit-Width
- •Using State Information
- •Propagating Constants
- •Sharing Complex Operators
- •Asynchronous Designs
- •Don’t Care Inference
- •Using Don’t Care Default Values
- •Differences Between Simulation and Synthesis
- •Synthesis Issues
- •Feedback Paths and Latches
- •Fully Specified Variables
- •Asynchronous Behavior
- •Understanding Superset Issues and Error Checking
- •Foundation Express Directives
- •Notation for Foundation Express Directives
- •Foundation Express Directives
- •Translation Stop and Start Pragma Directives
- •synthesis_off and synthesis_on Directives
- •Resolution Function Directives
- •Component Implication Directives
- •Foundation Express Packages
- •std_logic_1164 Package
- •std_logic_arith Package
- •Using the Package
- •Modifying the Package
- •Data Types
- •UNSIGNED
- •SIGNED
- •Conversion Functions
- •Arithmetic Functions
- •Example 10-1: Binary Arithmetic Functions
- •Example 10-2: Unary Arithmetic Functions
- •Comparison Functions
- •Example 10-3: Ordering Functions
- •Example 10-4: Equality Functions
- •Shift Functions
- •ENUM_ENCODING Attribute
- •pragma built_in
- •Type Conversion
- •numeric_std Package
- •Understanding the Limitations of numeric_std package
- •Using the Package
- •Data Types
- •Conversion Functions
- •Resize Function
- •Arithmetic Functions
- •Comparison Functions
- •Defining Logical Operators Functions
- •Shift Functions
- •Rotate Functions
- •Shift and Rotate Operators
- •std_logic_misc Package
- •ATTRIBUTES Package
- •VHDL Constructs
- •VHDL Construct Support
- •Design Units
- •Data Types
- •Declarations
- •Specifications
- •Names
- •Identifiers and Extended Identifiers
- •Specifics of Identifiers
- •Specifics of Extended Identifiers
- •Operators
- •Shift and Rotate Operators
- •xnor Operator
- •Operands and Expressions
- •Sequential Statements
- •Concurrent Statements
- •Predefined Language Environment
- •VHDL Reserved Words
- •Examples
- •Moore Machine
- •Mealy Machine
- •Read-Only Memory
- •Waveform Generator
- •Smart Waveform Generator
- •Definable-Width Adder-Subtracter
- •Count Zeros—Combinatorial Version
- •Count Zeros—Sequential Version
- •Soft Drink Machine—State Machine Version
- •Soft Drink Machine—Count Nickels Version
- •Carry-Lookahead Adder
- •Carry Value Computations
- •Implementation
- •Serial-to-Parallel Converter—Counting Bits
- •Input Format
- •Implementation Details
- •Serial-to-Parallel Converter—Shifting Bits
- •Programmable Logic Arrays
VHDL Reference Guide
The component instantiation statement references a previously defined hardware component.
Finally, the generate statement creates multiple copies of any concurrent statement.
process Statements
A process statement (which is concurrent) contains a set of sequential statements. Although all processes in a design execute concurrently, Foundation Express interprets the sequential statements within each process one at a time.
A process communicates with the rest of the design by reading values from or writing them to signals or ports outside the process.
The syntax of a process statement follows.
[ label: ] process [ ( sensitivity_list ) ]
{process_declarative_item }
begin
{sequential_statement } end process [ label ] ;
•label, which is optional, names the process.
•sensitivity_list is a list of all signals (including ports) read by the process, in the following format.
signal_name {, signal_name}
The circuit Foundation Express synthesizes is sensitive to all signals read the process reads. To guarantee the same results from a VHDL simulator and the synthesized circuit, a process sensitivity list has to contain all signals whose changes require simulating the process again.
Follow these guidelines when developing the sensitivity list.
•Synchronous processes (processes that compute values only on clock edges) must be sensitive to the clock signal.
•Asynchronous processes (processes that compute values on clock edges and when asynchronous conditions are true) must be sensitive to the clock signal (if any) and to inputs that affect asynchronous behavior.
6-2 |
Xilinx Development System |
Concurrent Statements
Foundation Express checks sensitivity lists for completeness and issues warning messages for any signals that are read inside a process but are not in the sensitivity list. An error is issued if a clock signal is read as data in a process.
Note: IEEE VHDL does not allow a sensitivity list if the process includes a wait statement.
•process_declarative_item declares subprograms, types, constants, and variables local to the process. These items can be any of the following items, all of which are discussed in the “Design Descriptions” chapter.
•use clause
•Subprogram declaration
•Subprogram body
•Type declaration
•Subtype declaration
•Constant declaration
•Variable declaration
The sequence of statements in a process defines the behavior of the process. After executing all the statements in a process, Foundation Express executes them all again.
The only exception is during simulation; if a process has a sensitivity list, the process is suspended (after its last statement) until a change occurs in one of the signals in the sensitivity list.
If a process has one or more wait statements (and therefore no sensitivity list), the process is suspended at the first wait statement whose wait condition is FALSE.
The circuit synthesized for a process is either combinatorial (not clocked) or sequential (clocked). If a process includes a wait or if signal’event statement, its circuit contains sequential components. The wait and if statements are described in the “Sequential Statements” chapter.
Process statements provide a natural means for describing sequential algorithms. If the values computed in a process are inherently parallel, consider using concurrent signal assignment statements.
VHDL Reference Guide |
6-3 |
VHDL Reference Guide
(See the “Concurrent Versions of Sequential Statements” section of this chapter).
Combinatorial Process Example
The following example shows a process (with no wait statements) that implements a simple modulo-10 counter. The process reads two signals, CLEAR and IN_COUNT, and drives one signal, OUT_COUNT.
If CLEAR is ’1’ or IN_COUNT is ‘9’, then OUT_COUNT is set to’0.’ Otherwise, OUT_COUNT is set to one more than IN_COUNT. The resulting circuit design is shown in the figure following the example.
entity COUNTER is |
|
|
port (CLEAR: |
in |
BIT; |
IN_COUNT: |
in |
INTEGER range 0 to 9; |
OUT_COUNT: out |
INTEGER range 0 to 9); |
|
end COUNTER; |
|
|
architecture EXAMPLE |
of |
COUNTER is |
begin |
|
|
process(IN_COUNT, CLEAR) |
||
begin |
|
|
if (CLEAR = ’1’ |
or |
IN_COUNT = 9) then |
OUT_COUNT <= |
0; |
|
else |
|
|
OUT_COUNT <= |
IN_COUNT + 1; |
|
end if; |
|
|
end process; end EXAMPLE;
6-4 |
Xilinx Development System |
Concurrent Statements
|
|
|
|
ND3 |
IN_COUNT[2] |
|
|
|
|
IN_COUNT[0] |
OR3 |
IV |
NR2 |
NR2 |
IN_COUNT[1] |
AN2 |
|
||
|
NR2 |
|
|
|
|
|
|
|
|
|
|
|
AN2 |
MUX21L |
|
|
|
EO |
|
|
|
ND2 |
|
|
|
EO |
|
ND2 |
|
|
ND2 |
NR2 |
|
|
|
|
|
|
|
IN_COUNT[3] |
|
|
|
|
CLEAR |
|
|
|
|
NR2 

OUT_COUNT[0]
AN2
OUT_COUNT[1]
MUX21L
OUT_COUNT[2]
NR2 
OUT_COUNT[3]
X8622
Figure 6-1 Modulo-10 Counter Process Design
Sequential Process Example
Another way to implement the counter in the previous example is to use a wait statement to contain the count value internally in the process.
The process in the following example implements the counter as a sequential (clocked) process.
•On each 0-to-1 CLOCK transition, if CLEAR is ’1’ or COUNT is ‘9,’ COUNT is set to ‘0.’
•Otherwise, Foundation Express increments the value of COUNT by one.
•The value of the variable COUNT is stored in four flip-flops, which Foundation Express generates because COUNT can be read before it is set. Thus, the value of COUNT has to be maintained from the previous clock cycle. For more information on using wait statements and count values, see “wait Statements” section of the “Sequential Statements” chapter.
The resulting circuit design is shown in the figure that follows the example.
entity COUNTER is
port (CLEAR: in BIT;
VHDL Reference Guide |
6-5 |
VHDL Reference Guide
CLOCK: in BIT;
COUNT: buffer INTEGER range 0 to 9); end COUNTER;
architecture EXAMPLE of COUNTER is begin
process begin
wait until CLOCK’event and CLOCK =’1’;
if (CLEAR = ’1’ or COUNT >= 9) then COUNT <= 0;
else
COUNT <= COUNT + 1; end if;
end process; end EXAMPLE;
ND2 |
ND2 |
|
|
AN3 |
|
COUNT[0] |
|
CLOCK |
|
FD1 |
|
|
|
|
|
|
NR2 |
|
COUNT[1] |
|
EO |
|
|
|
|
FD1 |
|
OR3 |
|
|
|
ND2 |
ND2 |
|
|
|
|
|
|
IV |
|
|
|
CLEAR |
NR2 |
|
COUNT[2] |
|
|
||
|
EO |
|
|
|
|
FD1 |
|
ND2 |
NR2 |
|
COUNT[3] |
NR2 |
|
|
|
NR2 |
|
|
|
|
|
FD1 |
X8621 |
|
|
|
Figure 6-2 Modulo-10 Counter Process with wait Statement Design
6-6 |
Xilinx Development System |
