在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 1689|回复: 2

[求助] 4位加法器,求排错啊

[复制链接]
发表于 2015-4-11 14:24:29 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity adder4bit 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_vector(3 downto 0) );
end adder4bit;
architecture one of adder4bit is
   signal sint: std_logic_vector(3 downto 0);
   signal aa,bb: std_logic_vector(3 downto 0);
                begin
                         aa<='0' & a (3 downto 0);
                         bb<='0' & b(3 downto 0);
                         sint<= aa+bb+cin;
                         s(3 downto 0) <= sint (3 downto 0);
                         cout .std_logic_vector(3 downto 0)all.!=  sint(3 downto 0);
end one;
发表于 2015-4-11 18:38:27 | 显示全部楼层
位宽不对吧,‘0’&a(3 downto 0)共5位,aa才4位
发表于 2015-4-12 11:32:36 | 显示全部楼层
最后一句的cout .std_logic_vector(3 downto 0)all.!=sint(3 downto 0)是什么意思?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

X

小黑屋| 手机版| 关于我们| 联系我们| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2025-6-26 07:32 , Processed in 0.018669 second(s), 11 queries , Gzip On, MemCached On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表