文档详情

并行乘法器[精品].doc

发布:2018-02-25约3.13万字共9页下载文档
文本预览下载声明
EDA技术与应用 实验报告 实验目的 1、学习包集和元件例化语句的使用。(五号+宋体,段前缩进2字符,固定值18磅行距) 2、学习FAU(全加器单元)电路的设计。 3、学习并行乘法器电路的设计。 实验内容 1、用VHDL代码描述FAU、与门电路,要求其操作数有a、b两个,每个操作数都是4位宽度。 2、利用元件例化语句构成所需要的基本元件,利用包集声明该元件,在主代码中调用该元件完成设计。 实验原理 1、并行乘法器的原理图: 2、TOP单元: (格式同上) 3、mid单元 4、lower单元 实验代码 library ieee; use ieee.std_logic_1164.all; entity adder is port (a,b,cin:in std_logic; s,cout:out std_logic); end adder; architecture adder of adder is begin s=a xor b xor cin; cout=(a and b)or(a and cin)or(b and cin); end adder; library ieee; use ieee.std_logic_1164.all; entity and_2 is port (a,b:in std_logic; y:out std_logic); end and_2; architecture and_2 of and_2 is begin y=a and b; end and_2; library ieee; use ieee.std_logic_1164.all; use work.my_components.all; entity top is port (a:in std_logic; b:in std_logic_vector(3 downto 0); s,c:out std_logic_vector(2 downto 0); p:out std_logic); end top; architecture reg of top is begin u1:component and_2 port map(a,b(3),s(2)); u2:component and_2 port map(a,b(2),s(1)); u3:component and_2 port map(a,b(1),s(0)); u4:component and_2 port map(a,b(0),p); c(2)=0;c(1)=0;c(0)=0; end reg; library ieee; use ieee.std_logic_1164.all; use work.my_components.all; entity mid is port (a:in std_logic; b:in std_logic_vector(3 downto 0); si,ci:in std_logic_vector(2 downto 0); s,c:out std_logic_vector(2 downto 0); p:out std_logic); end mid; architecture reg of mid is signal d:std_logic_vector(2 downto 0); begin u1:component and_2 port map(a,b(3),s(2)); u2:component and_2 port map(a,b(2),d(2)); u3:component and_2 port map(a,b(1),d(1)); u4:component and_2 port map(a,b(0),d(0)); u5:component adder port map(si(2),ci(2),d(2),s(1),c(2)); u6:component adder port map(si(1),ci(1),d(1),s(0),c(1)); u7:component adder port map(si(0),ci(0),d(0),p,c(0)); end reg; library ieee; use ieee.std_logic_1164.all; use work.my_components.all; entity lower is port ( si,ci:in std_logic_vector(2 downto 0); p:out std_logic_vector(3 downto 0) ); end lower; architecture reg of lower is signal d:std_logic_vector(2 down
显示全部
相似文档