第一范文网 - 专业文章范例文档资料分享平台

VHDL硬件描述语言四位加法器实验报告

来源:用户分享 时间:2025/11/4 11:01:29 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

1' h0 --Add0A[4..0]B[4..0]Add1A[4..0]a[3..0]1' h0 --+ADDERb[3..0]4' h0 --B[4..0]+ADDERcos[3..0]ci 由上图可知设计是正确的。 3、采用构造体的结构描述方式:

首先新建一个工程,命名为“adder4_3”,然后编辑代码。(附加要求:应用一位全加器按如下电路图通过结构描述方式构造四位加法器)

代码如下:

library ieee;

use ieee.std_logic_1164.all;

entity full_adder is port ( ); a

: in std_logic;

b : in std_logic; ci

: in std_logic;

s : out std_logic; co : out std_logic

end entity;

architecture rtl of full_adder is begin

s <= a xor b xor ci;

co <= (a and b) or (a and ci) or (b and ci);

end rtl;

library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity adder4_3 is port (

A,B : in std_logic_vector(3 downto 0); : in std_logic;

: out std_logic_vector(3 downto 0); : out std_logic

Ci S

Co );

end entity;

architecture rtl of adder4_3 is signal C0,C1,C2:std_logic; component full_adder is port ( a,b

: in std_logic;

: in std_logic;

ci s

: out std_logic; : out std_logic

co );

end component full_adder; begin

U0:full_adder port map(A(0),B(0),Ci,S(0),C0); U1:full_adder port map(A(1),B(1),C0,S(1),C1); U2:full_adder port map(A(2),B(2),C1,S(2),C2); U3:full_adder port map(A(3),B(3),C2,S(3),Co);

end rtl;

仿真波形图如下:

仿真电路图如下:

full_adder:U3full_adder:U2full_adder:U1full_adder:U0A[3..0]B[3..0]CiabcicosabcicosabcicosabcicosCoS[3..0] 由上图可知设计是正确的。 五、三种描述方式的比较:

这三种描述方式是从不同的角度对硬件系统进行行为和功能的描述。行为方式描述是对整个系统数学模型的描述,并不真正考虑其实际的操作,用行为方式描述的系统结构的程序其抽象程度高,很难直接映射到具体的逻辑元件的实现。要想得到具体的元件实现,必须将行为描述的VHDL语言程序改写为RTL方式描述的程序。采用RTL方式描述才能导出系统的逻辑表达式,才能直接得到逻辑元件之间的链接关系。构造体的结构描述方式是RTL方式描述的一种特殊的形

式,它可以将已有的设计成果应用到新的设计中,提高了设

计的效率。

VHDL硬件描述语言四位加法器实验报告.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c984ks3i4v67d82v9y99n_2.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top