实验名称 全加器构成4位加法器
实验人姓名
学 号
班 级
同组人姓名
实 验 时 间 2014.5.25
成 绩
石家庄经济学院信工学院
一、实验内容
由全加器构成4位加法器
二、实验原理
1.系统输入输出确定
7个输入A(3 downto 0),B(3 downto 0),Cin,2个输出S,Cn
2.真值表
输入 | 输出 | |||
Cin | ||||
0 | 0 | 0 | 0 | 0 |
0 | 0 | 1 | 1 | 0 |
0 | 1 | 0 | 1 | 0 |
0 | 1 | 1 | 0 | 1 |
1 | 0 | 0 | 1 | 0 |
1 | 0 | 1 | 0 | 1 |
1 | 1 | 0 | 0 | 1 |
1 | 1 | 1 | 1 | 1 |
4.VHDL程序源代码
library ieee;
use ieee.std_logic_11.all;
use ieee.std_logic_unsigned.all;
entity jfq is
port(Cin:in std_logic;
A,B:in std_logic_vector(3 downto 0);
S: out std_logic_vector(3 downto 0);
Cn: out std_logic);
end jfq;
ARCHITECTURE rtl OF jfq IS
component qjq
port(A,B,Cin:in std_logic;
Co:out std_logic;
S:out std_logic);
end component;
signal temp0,temp1,temp2:std_logic;
begin
U1:qjq port map(A(0),B(0),Cin,temp0,S(0));
U2:qjq port map(A(1),B(1),temp0,temp1,S(1));
U3:qjq port map(A(2),B(2),temp1,temp2,S(2));
U4:qjq port map(A(3),B(3),temp2,Cn,S(3));
end rtl;
三、测试及分析
仿真波形
实验结果证明:真实的实验结果与理论的结果相同。
四、总结
本次实验