Professional Documents
Culture Documents
DIGITAL DESIGN
VHDL
gaston.chamba@unl.edu.ec
Carrera de Ingenieria en Sistemas – UNL
Bloque 3.2 FEIRNNR – Loja - Ecuador
1
Implementation technology
2
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Implementation technology
The most common levels for Vdd are between 5 volts and
1 volt.
3
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Transistor switches
Logic circuits are built with transistors. For the purpose of understanding how logic circuits are built, we can assume
that a transistor operates as a simple switch.
The most popular type of transistor for implementing a simple switch is the metal oxide semiconductor field-effect
transistor (MOSFET)
There are two different types of MOSFETs, known as n-channel, abbreviated NMOS, and p-channel, denoted PMOS
4
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Transistor switches
In NMOS transistor if 𝑉𝐺 is low, then there is no connection between the source and drain,
and we say that the transistor is turned off. If 𝑉𝐺 is high, then the transistor is turned on and
acts as an closed switch that connects the source and drain terminals.
5
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Transistor switches
An NMOS transistor is turned on when its gate terminal is high, while a PMOS transistor is turned on when its
gate is low.
When the NMOS transistor is turned on, its drain is pulled down to GNG, and when the PMOS transistor is
turned on, its drain is pulled up to 𝑉𝐷𝐷
6
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Transistor switches: physical structure of an NMOS transistor
7
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Transistor switches: physical structure of an NMOS transistor
8
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
NMOS logic gates
The first schemes for building logic gates with MOSFETS became popular in the 1970s and relied on
either PMOS or NMOS transistors, but not both.
Since the early 1980s, a combination of both NMOS and PMOS transistors has been used.
In the circuit in the figure, when 𝑉𝑥 = 0 𝑉, the NMOS
transistor is turned off. No current flows through the
resistor R, and 𝑉𝑓 = 5 𝑉.
10
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
NMOS logic gates
The purpose of the resistor is to limit the amount of current that flows when 𝑉𝑥 = 5𝑉 . Rather than using
a resistor for this purpose, a transistor is normally used, a dashed box is drawn around the resistor as a
reminder that it is implemented using a transistor.
11
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
NMOS logic gates
12
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
NMOS logic gates
13
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
NMOS logic gates
14
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
NMOS logic gates
15
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
CMOS logic gates
For each of the circuits that has been presented, it is possible to derive an equivalent circuit that
uses PMOS transistors. However, it is more interesting to considerer how both NMOS and PMOS
transistors can be used together.
In CMOS technology we will refer to the part of the circuit that involves NMOS transistors as the
pull-down network (PDN).
16
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
CMOS logic gates
The concept of CMOS circuits is based on replacing the pull-up device with a
pull-up network that is built using PMOS transistors, such that the functions
realized by the PDN and PUN networks are complements of each other
17
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
CMOS logic gates
For any given evaluation of the inputs signals, either the PDN pulls 𝑉𝑓 down to GND or the PUN
pulls 𝑉𝑓 up to 𝑉𝐷𝐷 .
The PDN has NMOS transistors in series, the PUN has PMOS transistors in parallel, and vice versa.
18
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
CMOS logic gates
19
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
CMOS logic gates
The PDN has NMOS transistors in series, the PUN has PMOS
transistors in parallel.
20
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
CMOS logic gates
The PDN has NMOS transistors in parallel, the PUN has PMOS
transistors in series.
21
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Standard Chips: 7400-Series Standard Chips
An approach used widely until the mid-1980s was to connect together multiple chips, each containing
only a few logic gates.
They are known as 7400-series parts because the chip part numbers always begin with the digits 74.
The figure shows a type of package that the chip is provided in, called a dual-inline package (DIP)
22
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Standard Chips: 7400-Series Standard Chips
For each specific 7400-series chip, several variants are built with different technologies, for
instance, the part called 74LS00 is built with a technology called transistor-transistor logic
(TTL).
Whereas the 74HC00 is fabricated using CMOS technology. In general, the most popular
chips used today are the CMOS variants.
The function provided by each 7400-series device is fixed and each chip only provides a few
logic gates, these limitation make use of these chips inefficient for building large circuits.
23
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Implementation of 𝐟 = 𝒙𝟏 𝒙𝟐 + 𝒙𝟐 𝒙𝟑
24
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Programmable Logic Device
The function provided by each of the 7400-series parts is fixed and cannot be tailored to suit a particular design situation.
It is possible to manufacture chips that contain relatively large amounts of logic circuitry with a structure that is not fixed. Such
chips were first introduced in the 1970s and are called programmable logic devices (PLDs)
25
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Programmable Logic Array (PLA)
26
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Programmable Logic Array (PLA)
27
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Programmable Logic Array (PLA)
𝑃1 = 𝑥1 𝑥2 𝑃2 = 𝑥1 𝑥3 ,
𝑃3 = 𝑥1 𝑥2 𝑥3 𝑃4 = 𝑥1 𝑥3
𝑓1 = 𝑥1 𝑥2 + 𝑥1 𝑥3 + 𝑥1 𝑥2 𝑥3
𝑓1 = 𝑥1 𝑥2 + 𝑥1 𝑥2 𝑥3 + 𝑥1 𝑥3
29
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Programmable Array Logic (PAL)
In a PLA both the AND and OR planes are programmable, that presented two difficulties for
manufacturers of these devices:
These drawbacks led to the development of a similar device in which the AND plane is
programmable, but the OR plane is fixed.
30
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Programmable Array Logic (PAL)
𝑓1 = 𝑥1 𝑥2 𝑥3 + 𝑥1 𝑥2 𝑥3
𝑓2 = 𝑥1 𝑥2 + 𝑥1 𝑥2 𝑥3
31
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Programmable Array Logic (PAL)
32
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Programmable Array Logic (PAL)
33
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
VHDL: Introduction
VHDL stands for VHSIC Hardware Description Languaje. VHSIC is itself an abbreviation
for Very High Speed Integrated Circuits, an initiative funded by the United States
Department of Defense in the 1980s that led to the creation of VHDL.
VHDL was the original and first hardware description language to be standardized by the
Institute of Electrical and Electronics Engineers, through the IEEE 1076 standard.
An additional standard, the IEEE 1164, was later added to introduce a multi-valued logic
system.
34
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
VHDL: Introduction
35
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
VHDL: Introduction
The two main immediate applications of VHDL are in the field of Programmable Logic Devices
(CPLDs – Complex Programmable Logic Devices and FPGAs – Field Programmable Gate Arrays)
and in the field of ASICs (Application Specific Integrated Circuits).
Once the VHDL has been written, it can be used either to implement the circuit in a programmable
device (from Altera, Xilinx, Atmel, etc.).
VHDL contrary to regular computer programs which are sequential, its statements are inherently
concurrent. For that reason, VHDL is usually referred to as a code rather than a program.
In VHDL only statements placed inside a PROCESS, FUNCTION, or PROCEDURE are executed
sequentially.
36
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
VHDL: Design Flow
37
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
VHDL: Design Flow
38
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Fundamental VHDL Units
39
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Library Declarations
To declare a LIBRARY two lines of code are needed, one containing the name of the
library, and the other a use clause
At least three packages, from three different libraries, are usually needed in a design:
40
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Library Declarations
41
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Library Declarations
42
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
ENTITY
An ENTITY is a list with specifications of all input and output pins (PORTS) of the circuit
Finally, the name of the entity can be basically any name, except VHDL reserved words.
43
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
ENTITY
Let us consider the NAND gate. Its ENTITY can be specified as:
The meaning of the ENTITY above is the following: the circuit has three I/O pins, being
two inputs (a and b, mode IN) and one output (x, mode OUT). All three signals are of
type BIT. The name chosen for the entity was nand_gate.
44
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
ARCHITECTURE
An architecture has two parts: a declarative part (optional), where signals and constants
(among others) are declared, an the code part (from BEGIN down). The name of an
architecture can be basically any name (except VHDL reserve words), including the
same name as the entity’s.
45
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
ARCHITECTURE
The meaning of the ARCHITECTURE above is the following: the circuit must perform
the NAND operation between the two input signals (a,b) and assign (“<=”) the result to
the output pin (x). The name chosen for this architecture was myarch. In this example,
there is no declarative part, and the code contains just a single assignment.
46
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
ARCHITECTURE
The meaning of the ARCHITECTURE above is the following: the circuit must perform
the NAND operation between the two input signals (a,b) and assign (“<=”) the result to
the output pin (x). The name chosen for this architecture was myarch. In this example,
there is no declarative part, and the code contains just a single assignment.
47
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Identifiers
A basic identifier:
May only contain alphabetic letters (A to Z and a to z), decimal digits (0 to 9) and the underline
character (_)
Must start with an alphabetic letter
May not end with an underline character
May not include two successive underline characters
VHDL is not case-sensitive
No blank space(s) are allowed
Examples
Same identifier
Txclk, TxClk, TXCLK, TxCLK
Legal identifiers
Rst, Three_State_Enable, CS_244, Sel7D
Illegal identifiers
_Set, 80X86, large#bits, m__RAM, add_
48
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Data Types:
Pre-Defined Data Types (specified through the IEEE 1076 and IEEE 1164 standards)
Package standard of library std: Defines BIT, BOOLEAN, INTEGER, and REAL data types:
BIT
x <= ‘1’: x is a single-bit signal, whose value is ‘1’. Notice that single quotes (‘ ’) are used for a
single bit.
y <= “0111”: y is a 4-bit signal, whose value is “0111” (MSB=‘0’). Notice that double quotes (“ ”)
are used for vectors.
w <= “01110001”: w is an 8-bit signal, whose value is “01110001” (MSB=‘1’)
49
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Data Types:
Pre-Defined Data Types (specified through the IEEE 1076 and IEEE 1164 standards)
Package standard of library std: Defines BIT, BOOLEAN, INTEGER, and REAL data types:
50
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Data Types:
Pre-Defined Data Types (specified through the IEEE 1076 and IEEE 1164 standards)
Package standard of library std: Defines BIT, BOOLEAN, INTEGER, and REAL data types:
STD_LOGIC (and STD_LOGIC_VECTOR): 8-valued logic system introduced in the IEEE 1164 standard.
51
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Writing simple VHDL code
If we wish to write VHDL code to represent this circuit the first step is to declare the input
and output signals.
52
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Writing simple VHDL code
ENTITY example1 IS
PORT (x1, x2, x3 : IN BIT;
f : OUT BIT);
END example1;
An entity must be assigned a name; in this case we have chosen the name example1.
The input and output signals for the entity are called its ports, and thy are identified by the
keyword PORT.
53
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Writing simple VHDL code
ENTITY example1 IS
PORT (x1, x2, x3 : IN BIT;
f : OUT BIT);
END example1;
From the electrical jargon the word port refers to an input or output connection to an
electronic circuit.
Each port has an associated mode that specifies whether it is an input (IN) to the entity or an
output (OUT) from the entity.
ENTITY example1 IS
PORT (x1, x2, x3 : IN BIT;
f : OUT BIT);
END example1;
The entity example1 has four ports in total. The first three, x1, x2, and x3, are inputs signals of type
BIT. The port named f is an output of type BIT.
VHDL has rules that specify which characters are allowed in signals names. A simple guideline is
that signal names can include any letters or number, as well as the underscore character ‘_’.
There are two caveats: a signal name must begin with a letter, and a signal name cannot be a VHDL
keyword.
55
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Writing simple VHDL code
An entity specifies the input and output signals for a circuit, but it does not give any details
as to what the circuit represent.
The circuit’s functionality must be specified with a VHDL construct called an architecture.
In the architecture for our example we have chosen the name LogicFunc.
56
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Writing simple VHDL code
VHDL has built-in support for the following Boolean operators: AND, OR, NOT, NAND,
NOR, XOR and XNOR.
Following the BEGIN keyword, our architecture specifies, using the VHDL signal
assignment operator <=, that output f should be assigned the result of the logic expression on
the right-hand side of the operator.
57
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
Writing simple VHDL code
ENTITY example1 IS
PORT (x1, x2, x3 : IN BIT;
f : OUT BIT);
END example1;
58
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
DFF (D-type flip-flop) with Asynchronous Reset
If we wish to write VHDL code to represent this circuit the first step is to declare the input
and output signals.
59
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
RIPPLE CARRY ADDER
To perform addition by hand, we start from the least-significant digit and add pairs of digits,
progressing to the most-significant digit.
If a carry is produced in position i, then this carry is added to the operands in position i+1.
The same arrangement can be used in a logic circuit that performs additions.
60
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
RIPPLE CARRY ADDER
For each bit position we can use a full-adder circuit, connected as shown in figure.
The least-significant bit position is on the right. Carries that are produced by the full-adders
propagate to the left.
61
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
RIPPLE CARRY ADDER
When the operands X and Y are applied as input to the adder, it takes some time before the
output sum, S, is valid.
Each full-adder introduces a certain delay before its 𝑠𝑖 and 𝑐𝑖+1 outputs are valid. Let this
delay be denoted as ∆𝑡
62
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
RIPPLE CARRY ADDER
Thus the carry-out from the first stage, 𝑐1 , arrives at the second stage ∆𝑡 after the application
of the 𝑥0 and 𝑦0 inputs.
The carry-out from the second stage, 𝑐2 , arrives at the third stage with a 2∆𝑡 delay, and so
on.
63
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
RIPPLE CARRY ADDER
The signal 𝑐𝑛−1 is valid after a delay of (n − 1)∆𝑡, which means that the complete sum is
available after a delay of n∆𝑡.
Because of the way the carry signals “ripple” through the full-adder stages, the circuit is
called a ripple-carry adder.
64
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
DESIGN OF RIPPLE CARRY ADDER USING VHDL
An obvious way to create an n-bit adder is to draw a hierarchical schematic that contains n
full-adders. This approach can also be followed by using VHDL, by first creating a VHDL
entity for a full-adder and then creating a higher-level entity that uses four instances of the
full-adder
65
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
DESIGN OF RIPPLE CARRY ADDER USING VHDL
An obvious way to create an n-bit adder is to draw a hierarchical schematic that contains n
full-adders. This approach can also be followed by using VHDL, by first creating a VHDL
entity for a full-adder and then creating a higher-level entity that uses four instances of the
full-adder.
66
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
DESIGN OF RIPPLE CARRY ADDER USING VHDL
A full-adder circuit is a combinational circuit that produces the arithmetic addition of three
input bits, where the first and second bit represents the addends, and the third bit represents
the carry from the previous lower significant bit position.
67
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
DESIGN OF RIPPLE CARRY ADDER USING VHDL
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY fulladd IS
PORT ( Cin, x, y : IN STD_LOGIC;
s, Cout : OUT STD_LOGIC);
END fulladd;
It has the inputs 𝐶𝑖𝑛 , 𝑥 and 𝑦
ARCHITECTURE LogicFunc OF fulladd IS and produces the outputs 𝑠
BEGIN and 𝐶𝑜𝑢𝑡 . The sum, 𝑠, and
s <= x XOR y XOR Cin;
carry-out, 𝐶𝑜𝑢𝑡 , are described
Cout <= (x AND y) OR (Cin AND x) OR (Cin AND y);
by logic equations.
END LogicFunc;
68
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
DESIGN OF RIPPLE CARRY ADDER USING VHDL
LIBRARY ieee;
We now need to create a separate VHDL entity
USE ieee.std_logic_1164.all; for the ripple-carry adder, which uses the fulladd
ENTITY adder4 IS entity as a subcircuit.
PORT ( Cin : IN STD_LOGIC;
x3, x2, x1, x0 : IN STD_LOGIC;
y3, y2, y1, y0 : IN STD_LOGIC;
s3, s2, s1, s0 : OUT STD_LOGIC; The code for a four-bit ripple-carry adder entity is
Cout : OUT STD_LOGIC);
END adder4; called adder4 . One of the four-bit numbers to be
ARCHITECTURE Structure OF adder4 IS added is represented by the four signals 𝑥3 , 𝑥2 ,
SIGNAL c1, c2, c3 : STD_LOGIC;
COMPONENT fulladd 𝑥1 , 𝑥0 , and the other number is represented by
PORT (Cin, x, y : IN STD_LOGIC ;
s, Cout : OUT STD_LOGIC ); 𝑦3 , 𝑦2 , 𝑦1 , 𝑦0 . The sum is represented by 𝑠3 , 𝑠2 ,
END COMPONENT;
BEGIN 𝑠1 , 𝑠0 ,
stage0: fulladd PORT MAP (Cin, x0, y0, s0, c1);
stage1: fulladd PORT MAP (c1, x1, y1, s1, c2);
stage2: fulladd PORT MAP (c2, x2, y2, s2, c3);
stage0: fulladd PORT MAP (
Cin => c3, Cout => Cout, x => x3, y => y3, s =>s3);
END Structure;
69
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
DESIGN OF RIPPLE CARRY ADDER USING VHDL
LIBRARY ieee; Observe that the architecture body has the name
USE ieee.std_logic_1164.all;
Structure. We chose this name because the style of code
ENTITY adder4 IS in which a circuit is described in a hierarchical fashion,
PORT ( Cin : IN STD_LOGIC;
x3, x2, x1, x0 : IN STD_LOGIC; by connecting together subcircuits, is usually called the
y3, y2, y1, y0 : IN STD_LOGIC; structural style.
s3, s2, s1, s0 : OUT STD_LOGIC;
Cout : OUT STD_LOGIC);
END adder4; Signals can also be declared preceding the BEGIN
ARCHITECTURE Structure OF adder4 IS keyword in the architecture body. The three signals
SIGNAL c1, c2, c3 : STD_LOGIC; declared, called 𝑐1 , 𝑐2 and 𝑐3 , are used as carry-out
COMPONENT fulladd
PORT (Cin, x, y : IN STD_LOGIC ; signals from the first three stages of the adder.
s, Cout : OUT STD_LOGIC );
END COMPONENT;
BEGIN
The next statement is called component declaration
stage0: fulladd PORT MAP (Cin, x0, y0, s0, c1); statement. It uses syntax similar to that in an entity
stage1: fulladd PORT MAP (c1, x1, y1, s1, c2); declaration. This statement allows the fulladd entity to
stage2: fulladd PORT MAP (c2, x2, y2, s2, c3);
stage0: fulladd PORT MAP ( be used as a component (subcircuit) in the architecture
Cin => c3, Cout => Cout, x => x3, y => y3, s =>s3); body.
END Structure;
70
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
DESIGN OF RIPPLE CARRY ADDER USING VHDL
LIBRARY ieee;
USE ieee.std_logic_1164.all;
The four-bit adder is described using four
ENTITY adder4 IS
PORT ( Cin : IN STD_LOGIC; instantiation statements. Each statement begins
x3, x2, x1, x0 : IN STD_LOGIC;
y3, y2, y1, y0 : IN STD_LOGIC; with an instance name, which can be any legal
s3, s2, s1, s0 : OUT STD_LOGIC;
Cout : OUT STD_LOGIC); VHDL name, followed by the colon character.
END adder4;
The names must be unique.
ARCHITECTURE Structure OF adder4 IS
SIGNAL c1, c2, c3 : STD_LOGIC;
COMPONENT fulladd
PORT (Cin, x, y : IN STD_LOGIC ;
The least-significant stage in the adder is names
s, Cout : OUT STD_LOGIC ); stage0, and the most-significant stage is stage3.
END COMPONENT;
BEGIN
stage0: fulladd PORT MAP (Cin, x0, y0, s0, c1);
stage1: fulladd PORT MAP (c1, x1, y1, s1, c2);
stage2: fulladd PORT MAP (c2, x2, y2, s2, c3);
stage0: fulladd PORT MAP (
Cin => c3, Cout => Cout, x => x3, y => y3, s =>s3);
END Structure;
71
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
DESIGN OF RIPPLE CARRY ADDER USING VHDL
ARCHITECTURE Structure OF adder4 IS It is also possible to list the signal names in other
SIGNAL c1, c2, c3 : STD_LOGIC; orders by specifying explicitly which signal is to be
COMPONENT fulladd connected to which port on the component. An
PORT (Cin, x, y : IN STD_LOGIC ; example of this style is shown for the stage3
s, Cout : OUT STD_LOGIC ); instance.
END COMPONENT;
BEGIN This style of component instantiation is known as
stage0: fulladd PORT MAP (Cin, x0, y0, s0, c1); named association in the VHDL jargon, whereas the
stage1: fulladd PORT MAP (c1, x1, y1, s1, c2); style used for the other three instances is called
stage2: fulladd PORT MAP (c2, x2, y2, s2, c3); positional association.
stage0: fulladd PORT MAP (
Cin => c3, Cout => Cout, x => x3, y => y3, s =>s3); Note that for the stage3 instance, the signal mane
END Structure; 𝐶𝑜𝑢𝑡 is used as both the name of the component port
and the name of the signal in the adder4 entity. This
does not cause problem for the VHDL compiler,
because the component port name is always the one
on the left side of the => characters.
73
INGENIERÍA EN SISTEMAS ABRIL- SEPTIEMBRE 2018
DESIGN OF RIPPLE CARRY ADDER USING VHDL