找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1949|回复: 0
打印 上一主题 下一主题
收起左侧

四位全减器VHDL源程序

[复制链接]
跳转到指定楼层
楼主
ID:423659 发表于 2018-11-9 16:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
library ieee;


use ieee.std_logic_1164.all;


entity quanjian is


port(a,b,c:in std_logic;


sout,jout:out std_logic);


end;


architecture one of quanjian is


signal abc:std_logic_vector(2 downto 0);


begin


abc<=a&b&c;


process(abc)


begin


case abc is


when"000"=> sout<='0';jout<='0';


when"001"=> sout<='1';jout<='1';


when"010"=> sout<='1';jout<='1';


when"011"=> sout<='0';jout<='1';


when"100"=> sout<='1';jout<='0';


when"101"=> sout<='0';jout<='0';


when"110"=> sout<='0';jout<='0';


when"111"=> sout<='1';jout<='1';


when others=>null;


end case;


end process;


end one;


library ieee;


use ieee.std_logic_1164.all;


entity quanjian4 is


port(a11,a12,a13,a14,b11,b12,b13,b14:in std_logic;


s1,s2,s3,s4,j4:out std_logic);


end;


architecture two of quanjian4 is


signal d,e,f:std_logic;


component quanjian


port(a,b,c:in std_logic;


sout,jout:out std_logic);


end component;


begin


u1:quanjian port map(a=>a14,b=>b14,c=>'0',jout=>d,sout=>s4);


u2:quanjian port map(a=>a13,b=>b13,c=>d,jout=>e,sout=>s3);


u3:quanjian port map(a=>a12,b=>b12,c=>e,jout=>f,sout=>s2);


u4:quanjian port map(a=>a11,b=>b11,c=>f,jout=>j4,sout=>s1);


end two;
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表