|
Designing Hardware with Software
by James Antonakos
Start ý Levels
of Design ý The Interface ý The
Body ý Full_Adder
ý Half _Adder ý Identifiers,
Data Types, and Operators ý Examples ý
The Five-Input AND Gate ý The
2:4 Decoder ý Timing Examples ý Other
Methods ý Sources and PDF
FULL_ADDER
As previously
mentioned, more detail is added to the design as you proceed to the
lower levels. Now that you have an idea of how the full adders are
used inside the ripple adder, itýs time to work on the Full_Adder
entity construction (see Listing 2). As usual, the entity interface
indicates only the associated input and output signals. The implementation
details are left for the body statements.
|
entity Full_Adder is
port
(AI,BI,CYI: in bit;
SUM,CYO : out bit);
end Full_Adder;
|
| Listing
2ýThe interface for the Full_Adder entity can be seen here. |
In Figure 5 you
can see the internal structure of the full adder. Two half adders
(HA) and an OR gate are required to implement a full adder. Three
internal signals complete the wiring scheme. Compare the diagram in
Figure 5 with the corresponding Full_Adder body statements.
 |
| Figure
5ýThe full adder implementation can be seen here. |
The body of the
Full_Adder entity can be seen in Listing 3. There are many
similarities to the body statements of the ripple adder. However,
notice the last statement before the end of the code snippet, where
the CYO output is generated. This is called a signal assignment statement.
Here only a single logic gate is needed to combine signals, so a simple
Boolean expression can be used.
| Listing
3 ýThese statements
form the body of the Full_Adder entity. |
The logical operations
available in VHDL are NOT, AND, NAND, OR, NOR, XOR, and XNOR (VHDL-93
only). All operations have the same precedence except NOT, which has
the highest precedence. This means that parenthesis must be used to
enforce a particular order of operations.
PREVIOUS NEXT
Circuit Cellar provides up-to-date information for engineers. Visit
www.circuitcellar.com for
more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe online.
ýCircuit Cellar, the Magazine for Computer Applications. Posted with
permission. |