DSD Chapter2
DSD Chapter2
VHDL
• Introduction
• VHDL Description of combinational circuits
1. Introduction
• As integrated circuit technology has improved to allow more and
more components on a chip, digital systems have continued to grow
in complexity.
• The categories depending on the density of integration.
LSI (large scale VLSI (Very large
SSI (small scale MSI (medium scale scale integration) ULSI (Ultra large
integration)
integration) integration) scale integration)
200-few thousand 10,000 gates
1-20 gates 20-200 gates More 100 million
gates
Concurrent statements:
➢ The first statement will be evaluated anytime A or B changes
➢ The second statement will be evaluated anytime C or D changes
Declare
B <= "1100"
Assign '1' to B(3), '1' to B(2), '0' to B(1), and '0' to B(0).
5. VHDL Modules
• The interface-signal
declaration:
• The port declaration specifies that X, Y, and Cin are input the entity name (FullAdder) must match
signals of type bit, and that Cout and Sum are output signals the name used in the associated entity declaration
of type bit. The VHDL assignment statements for Sum and Cout
represent the logic equations for the full adder.
• Example2: Four-Bit Full Adder
• When a process is used, the statements between the begin and the end are
executed sequentially. The expression in parentheses after the word
process is called a sensitivity list, and the process executes whenever any
signal in the sensitivity list changes.
• Whenever one of the signals in the sensitivity list changes, the sequential
statements in the process body are executed in sequence one time. When a
process finishes executing, it goes back to the beginning and waits for a signal on
the sensitivity list to change again.
• whenever CLK changes, the process executes once • The expression CLK'event (read as “clock tick event”) is TRUE
through and then waits at the start of the process whenever the signal CLK changes.
until CLK changes again. • If CLK = '1' is also TRUE, this means that the change was
from '0' to '1', which is a rising edge.
• D latch
Within the architecture we dene a signal Qint that represents the state of the flip-
flop internal to the module
The two concurrent statements after begin transmit this internal signal to the Q
and QN outputs of the flip-flop
We do it this way because an output signal in a port cannot appear on the right
side of an assignment statement within the architecture
wait until A = B;
Statements:
• wait statements instead of a
sensitivity list. A process cannot have both wait statements and a sensitivity list
• The wait statement at the end of the process replaces the sensitivity
list at the beginning.
• both processes will initially execute the sequential statements one
time and then wait until A, B, C, or D changes.
• Note: The order in which sequential
statements execute in a process is not
necessarily the order in which the signals
are updated.
• Data Types
• Note: Users can define and create their own data types: the
enumeration type in which all of the values are enumerated.
• VHDL Operators: Example1:
A, B, C, and D are bit_vectors:
• Predefined VHDL operators can be
grouped into seven classes:
Example2:
• The binary logical operators (class 1) can • The ** operator raises an integer or floating-point
not be applied to bits, booleans, number to an integer power, and abs finds the
bit_vectors, and boolean_vectors.
absolute value of a numeric operand.
• The result of applying a relational
operator (class 2) is always a Boolean
(FALSE or TRUE). • The shift operators can be applied to any bit_vector or
boolean_vector.
• Equals (=) and not equals (/=) can be
applied to almost any type.
• The + and - operators can be applied to
integer or real numeric operands.
• Example: A = "10010101":
• The & operator can be used to
concatenate two vectors to form a longer
vector.
• The * and / operators perform
multiplication and division .
• The rem and mod operators calculate the
remainder and modulus for integer
operands.
Chapter2: introduction to
VHDL
• Introduction
• VHDL Description of combinational circuits
• Sequential statements and VHDL prcrocesses
• Simulation and Synthesis Examples
• Behavioral, data flow and structural VHDL
10- Compilation, simulation and synthesis of VHDL codes
• C is an internal signal
• The signal assignment statements are in a process
• An edge-triggered clock
➔C and G need to be retained after the clock edge, flip-flops
are required for both C and G
• If a MUX model is used inside a process, a • The case statement has the general form
concurrent statement cannot be used. As
an alternative, the MUX can be modeled
using a case statement:
Conclusion:
• combinational circuits can be described using concurrent or
sequential statements.
• Sequential circuits generally require a process statement.
• Process statements can be used to make sequential or
combinational circuits
13-Modeling Registers and Counters Using VHDL
Processes
• Arrays
• we must first declare an array type and then declare an array object.
• 3. while loop
14-VHDL Libraries
• VHDL libraries and packages are used to extend the functionality of VHDL by defining types, functions, components, and overloaded operators
• One of the earliest extensions was to dene multivalued logic as an IEEE standard
• The package IEEE. std_logic_1164 defines a std_logic type that has nine values, including '0', '1', 'X' (unknown), and 'Z' (high impedance). Also
std_logic_vectors, which are vectors of the std_logic type.
• This standard defines logic operations and other functions for working with std_logic and std_logic_vectors, but it does not provide for arithmetic
operations.
• the IEEE introduced two packages to facilitate writing synthesizable code: IEEE.numeric_bit and IEEE.numeric_std.
• The former uses bit_vectors to represent unsigned and signed binary numbers, and the latter uses std_logic_vectors.
• To access functions and components from a library, you need a library statement and a use statement:
✓ The statement
library IEEE;
✓ The statement use
IEEE.numeric_bit.all;
• Whenever a package is used in a module, the library and use statements must be placed before the
entity in that module period.
• The numeric_bit package defines unsigned and signed types as unconstrained arrays of bits: