Файл: Digital design with CPLD applications and VHDL (R. Dueck, 2000).pdf
ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 13.06.2025
Просмотров: 8204
Скачиваний: 6
6.6 • Binary Adders and Subtractors |
249 |
BEGIN
Component instantiation(s);
Other statements;
END arch_name;
The VHDL file for a 4-bit parallel adder using full adder components is shown next.
.vhd
parallel adder, using 4 instances
add4par.vhd |
component full_add |
||
ENTITY add4par IS |
|||
PORT( |
|||
c0 |
: IN |
BIT; |
|
a, b |
: IN |
BIT_VECTOR (4 downto 1); |
|
c4 |
: OUT |
BIT; |
|
sum |
: OUT |
BIT_VECTOR (4 downto 1)); |
|
END add4par; |
|||
ARCHITECTURE adder OF add4par IS
——Component declaration COMPONENT full_add
PORT (
a, b, c_in : IN BIT; c_out, sum : OUT BIT);
END COMPONENT;
——Define a signal for internal carry bits SIGNAL c : BIT_VECTOR (3 downto 1);
BEGIN
—— Four Component Instantiation Statements
adder1: full_add |
|
PORT MAP ( a |
a(1), |
b |
b(1), |
c_in |
c0, |
c_out |
c(1), |
sum |
sum (1)); |
adder2: full_add |
|
PORT MAP ( a |
a(2), |
b |
b(2), |
c_in |
c(1), |
c_out |
c(2), |
sum |
sum (2)); |
adder3: full_add |
|
PORT MAP ( a |
a(3), |
b |
b(3), |
c_in |
c(2), |
c_out |
c(3), |
sum |
sum (3)); |
adder4: full_add |
|
PORT MAP ( a |
a(4), |
b |
b(4), |
c_in |
c(3), |
c_out |
c4, |
sum |
sum (4)); |
END adder; |