【VHDL】半减器和全减器的设计

题目描述:

设计一位半减器,然后利用元件方法设计一位全减器

半减器源代码:

library ieee;
use ieee.std_logic_1164.all;
entity h_suber is
port ( x,y:in std_logic;
diff,s_out:out std_logic);
end;
architecture one of h_suber is
begin
process(x,y)
begin
diff <= x xor y;
s_out <= (not x) and y;
end process;
end; 

全减器源代码:(全减器的实现可以调用半减器的代码,所以要将他们放在同一工程文件下)

library ieee;
use ieee.std_logic_1164.all;
entity fullsub is
port (xin,yin,sub_in:in std_logic;
   diffr,sub_out:out std_logic);
end;
architecture one of fullsub is
component h_suber
port (x,y:in std_logic;
diff,s_out:out std_logic);
end component;
signal c,d,e:std_logic;
begin
u1:h_suber port map(x => xin,y => yin,diff => c,s_out => d);
u2:h_suber port map(x => c,y => sub_in,diff => diffr,s_out => e);
sub_out <= d or e;
end;

波形图如下:

半减器功能仿真图

 

 

 

半减器时序仿真图

 

 

全减器功能仿真图

 

 

 

全减器时序仿真图

 

  • 19
    点赞
  • 115
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值