当前位置:
文档之家› 2006031459黄德荣5位逐级进位和超前进位加法器设计剖析
2006031459黄德荣5位逐级进位和超前进位加法器设计剖析
s: out std_logic_vector(4 downto 0); cout:out std_logic); end adder; architecture Behavioral of adder is signal c:std_logic_vector(4 downto 0); begin c(0)<=cin; s(0)<=a(0) xor b(0) xor c(0); c(1)<=(a(0)and b(0))or (a(0)and c(0))or (b(0)and c(0)); s(1)<=a(1) xor b(1) xor c(1); c(2)<=(a(1)and b(1))or (a(1)and c(1))or (b(1)and c(1)); s(2)<=a(2) xor b(2) xor c(2); c(3)<=(a(2)and b(2))or (a(2)and c(2))or (b(2)and c(2)); s(3)<=a(3) xor b(3) xor c(3); c(4)<=(a(3)and b(3))or (a(3)and c(3))or (b(3)and c(3)); s(4)<=a(4) xor b(4) xor c(4); cout<=(a(4)and b(4))or (a(4)and c(4))or (b(4)and c(4));
VHDL 代码
--------------------------------------------------------------------------------- Company: -- Engineer: --- Create Date: 02:59:18 10/22/08 -- Design Name: -- Module Name: adder - Behavioral -- Project Name: -- Target Device: -- Tool versions: -- Description: --- Dependencies: --- Revision: -- Revision 0.01 - File Created -- Additional Comments: --------------------------------------------------------------------------------library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ---- Uncomment the following library declaration if instantiating ---- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity adder is port(a,b:in std_logic_vector(4 downto 0); cin:in std_logic;
深 圳 大 学 实 验 报 告
课程名称:
VHDL 数字电路设计教程
实验项目名称:
5 位逐级进位和超前进位加法器设计
学院:
信息工程学院
专业:
电子信息工程
指导教师:
梁松海
报告人:黄德荣
学号:20006031459 班级:
1班ቤተ መጻሕፍቲ ባይዱ
实验时间:
2008.10.22
实验报告提交时间:
2008.11.5
教务处制
实验目的与要求:
用 XILINX ISE 7.1i 实现逐级进位和超前进位加法器
方法、步骤: 1,逐级进位加法器
对每一位都使用了全加器 FAU,图中 a 和 b 是输入位,cin 是进位输入位。S 是求和 的结果,cout 是进位输出位。C 是进位矢量。图中每个全加器的输出结果都依赖于前一 级产生的进位。由全加器的特性,可以写出如下的逻辑表达式: S=a XOR b XOR cin cout=(a ANDb)OR(aAND cin)OR(b AND cin) 2,超前进位加法器
电路实现是需要两个非常重要的中间信号:generate 和 propagate,分别由 g 和 p 表 示。加法器两个输入位是 a 和 b,则 generate 和 propagate 信号定义如下: g=a AND b p=a XOR b 这两个信号与进位无关,只根据当前的输入计算。 现在两个输入矢量是: a=a(4)a(3)a(2)a(1)a(0) 和 b=b(4)b(3)b(2)b(1)b(0), 那么相应的 generate 矢量为 g=g(4)g(3)g(2)g(1)g(0),相应的 propagate 矢量为 p=p(4)p(3)p(2)p(1)p(0)。 其中: g(j)=a (j) AND b(j) p(j)=a (j)XOR b(j) 同时,进位矢量用 c=c(4)c(3)c(2)c(1)c(0)。进位可由 g 和 p 按照下面的方法计算得 到: c(0) = cin; c(1) = c(0)p(0))+g(0);
c(2) = c(0)p(0)p(1))+g(0)p(1)+g(1); c(3) = c(0)p(0)p(1) p(2)+g(0)p(1)p(2)+(g(1) p(2)+g(2); c(4) = c(0)p(0) p(1) p(2) p(3)+g(0) p(1) p(2) p(3)+g(1) p(2) p(3)+g(2) p(3)+g(3); c(5) =c(0)p(0) p(1) p(2) p(3) p(4)+g(0) p(1) p(2)p(3) p(4)+g(1) p(2) p(3) p(4)+g(2) p(3) p(4)+g(4); 可见超前进位加法器的每个全加器不依赖与前一级进位输出的计算结果,有利于 提高电路执行速度。 实验过程及内容: 1, 逐级进位加法器