并行乘法器.doc_第1页
并行乘法器.doc_第2页
并行乘法器.doc_第3页
并行乘法器.doc_第4页
并行乘法器.doc_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

EDA技术与应用实验报告 实验名称:并行乘法器姓 名:陈丹学 号:100401202班 级:电信(2)班时 间:2012.12.18南京理工大学紫金学院电光系一、实验目的1)学习包集和元件例化语句的使用。2)学习FAU(全加器单元)电路的设计。3)学习并行乘法器电路的设计二、实验原理1)用VHDL代码描述FAU、与门电路,要求其操作数有a,b两个,每个操作数都是4位宽度。2)利用元件例化语句构成所需要的基本元件,利用包集声明该元件,在主代码中调用该元件完成设计。三、实验内容6,1并行乘法器的VHDL描述 首先给出两个元件:2端口与门,全加器,然后由这两种元件构成并行乘法器6.21 全加器的设计 全加器的表达式为新建VHDL文件 出入代码将文件保存为adder.vhdlibrary ieee;use ieee.std_logic_1164.all;entity adder isport(a,b,cin:in std_logic;s,c:out std_logic);end adder;architecture rhg of adder isbegins=a xor b xor cin;c=(a and b) or (a and cin) or (b and cin);end rhg;6.2.2 与门新建VHDL文件 出入代码将文件保存为and_2.vhdlibrary ieee;use ieee.std_logic_1164.all;entity and_2 isport(a,b:in std_logic;y:out std_logic);end;architecture rhg of and_2 isbeginy=a and b;end rhg;编译 保存 6.2.3 package 定义新建VHDL文件 输入package定义的VHDL代码 存为my_components.vhdlibrary ieee;use ieee.std_logic_1164.all;package my_components iscomponent and_2 isport(a,b:in std_logic;y:out std_logic);end component;component adder isport(a,b,cin:in std_logic;s,c:out std_logic);end component;end my_components;6.2.4 设计top 单元library ieee;use ieee.std_logic_1164.all;use work.my_components.all;entity top isport(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;architecture rhg of top isbeginb1: and_2 port map(a,b(3),s(2);b2: and_2 port map(a,b(2),s(1);b3: and_2 port map(a,b(1),s(0);b4: and_2 port map(a,b(0),p);c=000;end rhg;6.2.4 设计mid 单元library ieee;use ieee.std_logic_1164.all;use work.my_components.all;entity mid isport(a:in std_logic; b:in std_logic_vector(3 downto 0); sin,cin:in std_logic_vector(2 downto 0); sout,cout:out std_logic_vector(2 downto 0); p:out std_logic);end;architecture rhg of mid issignal and_out:std_logic_vector(2 downto 0);beginb1: and_2 port map(a,b(3),sout(2);b2: and_2 port map(a,b(2),and_out(2);b3: and_2 port map(a,b(1),and_out(1);b4: and_2 port map(a,b(0),and_out(0);b5: adder port map(sin(2),cin(2),and_out(2),sout(1),cout(2);b6: adder port map(sin(1),cin(1),and_out(1),sout(0),cout(1);b7: adder port map(sin(0),cin(0),and_out(0),p,cout(0);end rhg;6.2.5 lower 单元设计library ieee;use ieee.std_logic_1164.all;use work.my_components.all;entity lower isport(sin,cin:in std_logic_vector(2 downto 0); p:out std_logic_vector(3 downto 0);end;architecture rhg of lower issignal local:std_logic_vector(2 downto 0);beginlocal(0)=0;b1:adder port map(sin(0),cin(0),local(0),p(0),local(1);b2:adder port map(sin(1),cin(1),local(1),p(1),local(2);b3:adder port map(sin(2),cin(2),local(2),p(2),p(3);end rhg;6.2.6 package 定义library ieee;use ieee.std_logic_1164.all;package my_com1 iscomponent lower isport(sin,cin:in std_logic_vector(2 downto 0); p:out std_logic_vector(3 downto 0);end component;component mid isport(a:in std_logic; b:in std_logic_vector(3 downto 0); sin,cin:in std_logic_vector(2 downto 0); sout,cout:out std_logic_vector(2 downto 0); p:out std_logic);end component;component top isport(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 component;end my_com1;6.2.7 设计并行乘法器library ieee;use ieee.std_logic_1164.all;use work.my_components.all;use work.my_com1.all;entity multiplier is port(a,b:in std_logic_vector(3 downto 0); p:out std_logic_vector(7 downto 0);end;architecture rhg of multiplier is type matrix is array (0 to 3) of std_logic_vector(2 downto 0);signal s,c:matrix;beginb1:top port map(a(0),b,s(0),c(0),p(0);b2:mid port map(a(1),b,s(0),c(0),s(1),c(1),p(1);b3:mid port map(a(2),b,s(1),c(1),s(2),c(2),p(2);b4:mid port map(a(3),b,s(2),c(2),s(3),c(3),p(3);b5:lower por

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论