EDA2位二进制全加器的设计程序(用VHDL语言) 求解

EDA2位二进制全加器的设计程序(用VHDL语言) 求解,第1张

有辩棚氏几种方法,下面给你个简单直接的

library ieee

use ieee.std_logic_1164.all

use ieee.std_logic_unsigned.all

entity adder2b is

port(cin;ins td_logic

a,b: in std_logic_vector(2 downto 0)

s: out std_logic_vector(2 downto 0)

cout: out std_logic)

end adder2b

architecture vhd of adder2b is

signed sint:std_logic_vector(3 downto 0)

signed al,bl:std_logic_vector(3 downto 0)

begin

al<='0'&a

bl<='0'携散和败&b

sint<=al+bl+cin

s<=sint(2 downto 0)

cout<=sint(3)

end vhd

无 进位输入 的:

libarary ieee

use ieee.std_logic_1164.all

entity adder is(

a,b :in std_logic

s,carry:out std_logic)

architecture rtl of adder is

begin

s<=a xor b

carry<=a and b

end rtl

有 进位输入 的(c):

libarary ieee

use ieee.std_logic_1164.all

entity adder is(

a,b ,c:in std_logic

s,carry:out std_logic)

architecture rtl of adder is

begin

carry<凳或= not (a xor b xor c)--not or ~, i can not remember ,please try it

carry<=a xor b xor c

end rtl

用异或逻辑写的看起来比较好看些,虽然它的速度不是最快的。(当然,差别1 2 个ns,基本可以忽略不计)。 直接粘贴即可。 -- 后面为注释。可以删掉。 此代码平台无关,是万金流。

另外,楼上那位仁兄的问题你要思考下,

你的芯枣派伍片是什么?在device 下拉菜单里面找到相应选项,设置。

你的pins 是怎么设置的? 菜单栏有个独羡扰立的按钮。貌似在assign 等等下拉菜单中有此选项。

使用新软件,必须每个存在的选项 都试一下,才能够做到“基本了解”。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8217922.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-14
下一篇 2023-04-14

发表评论

登录后才能评论

评论列表(0条)

保存