- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
全加器,四位串行加法器
VHDL硬件描述语言 全加器 四位串行加法器 电路的三种设计方法 结构化电路设计方法:通过对电路结构的描述来建模,即通过对器件的调用(HDL概念称为例化), 运用组件(component)语句实现。 数据流式电路设计方法:通过对数据流在设计中的具体行为的描述来建模。 行为式电路设计方法:是指采用对信号行为级的描述来建模。抽象程度比数据流描述形式和结构描述形式高得多,常采用算术运算、关系运算等语句实现。该方法常用于系统数学模型的仿真或是系统工作原理的仿真。 一般VHDL程序的结构 全加器(逻辑图) 全加器(数据流式) --quanjia library ieee; use ieee.std_logic_1164.all; entity f_adder is port(x,y,cin:in std_logic; s,cout:out std_logic); end entity f_adder; architecture bhv of f_adder is begin g0:s=x xor y xor cin; g1:cout=(x and y)or(x and cin)or(y and cin); end architecture bhv; 四位串行加法器(逻辑图) 四位串行加法器(结构体式) --adder4 library ieee; use ieee.std_logic_1164.all; entity adder4 is port(x,y:in std_logic_vector(3 downto 0); c0:in std_logic; s:out std_logic_vector(3 downto 0); c4:out std_logic); end entity adder4; architecture structural of adder4 is component f_adder port(x,y,cin:in std_logic; s,cout:out std_logic); end component f_adder; signal c: std_logic_vector(0 to 4); begin g0:f_adder port map(x(0),y(0),c(0),s(0),c(1)); g1:f_adder port map(x(1),y(1),c(1),s(1),c(2)); g2:f_adder port map(x(2),y(2),c(2),s(2),c(3)); g3:f_adder port map(x(3),y(3),c(3),s(3),c(4)); c(0)=c0; c4=c(4); end structural; 四位全加器(行为描述式) library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity bit_f_adder is port(cin: in std_logic; a,b : in std_logic_vector(3 downto 0); s: out std_logic_vector(3 downto 0); cout: out std_logic); end bit_f_adder; architecture bhv of bit_f_adder is signal x,y,z:std_logic_vector(4 downto 0); begin x=0a(3 downto 0); y=0b(3 downto 0); z=x+y+cin; s(3 downto 0)=z(3 downto 0); cout=z(4); end bhv; 谢谢观赏~~~ 并行加法器(逻辑图) library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity bit_f_adder is port(cin: in std_logic; a,b : in std_logic_vector(3 downto 0); s: out std_logic_vector(3 downto 0); cout: out std_logic); end bit_f_adder; architecture bhv of bit_f_
文档评论(0)