VHDL——设计4输入端的与非与非电路(元件例化)

1.思路
利用2输入端与非门元件,设计4输入端的与非与非电路

1.1

1.2

1.3

2.实现过程
2.1 设计2输入端与非门

library ieee;
use ieee.std_logic_1164.all;

entity nd2 is
    port(a,b : in std_logic;
	      c : out std_logic);
end nd2;

architecture nd2bahave of nd2 is
  begin
	 c <= a nand b;
  end nd2bahave;

2.2 将设计的元件声明装入my_pkg程序包中(完成元件的“封装”)

library ieee;
use ieee.std_logic_1164.all;

package my_pkg is
  component nd2                 --元件声明
    port (a,b : in std_logic;
	       c : out std_logic);
  end component;
end my_pkg;

2.3 用原件例化产生电路(完成电路板上的元件“插座”的定义)

library ieee;
use ieee.std_logic_1164.all;

entity ord41 is
port (a1,b1,c1,d1 : in std_logic;
      z1 : out std_logic);
end ord41;

architecture ord41behave of ord41 is  --元件例化
  signal x,y : std_logic;
  component nd2                       --元件声明
    port (a,b : in std_logic;
	       c : out std_logic);
  end component;
  
  begin
  u1 : nd2 port map (a1,b1,x);       --位置关联方式:表达式(信号)必须与元件声明语句中的端口顺序一致
  u2 : nd2 port map (a => c1,        --名字关联方式 
  b => d1,c => y);
  u3 : nd2 port map (x,y,c => z1);   --混合关联方式
end ord41behave;  

3.注意:被调用的模块,要将其vhd文件放入调用者的文件中

  • 4
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

364.99°

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值