您好,欢迎来到欧得旅游网。
搜索
您的当前位置:首页组合逻辑VHDL设计——门电路

组合逻辑VHDL设计——门电路

来源:欧得旅游网
实验名称: 组合逻辑VHDL设计——门电路

班级: 09电气2Z 学号: 09312213 姓名: 钱雷

一、3输入与非门的VHDL设计 1.实体框图

2.程序设计 ①正确的程序

entity nand3a is port(a,b,c:in bit; y:out bit); end entity nand3a;

architecture ex1 of nand3a is begin

y<=not(a and b and c); end architecture ex1;

3.仿真波形图

4.仿真波形分析 由真值表可知: A

B 0 0 0 0 1 1 1 1

C 0 0 1 1 0 0 1 1

Y 0 1 0 1 0 1 0 1

1 1 1 1 1 1 1 0

当输入有零时输出全部为1,当输入全部为1时,输出才为0. 二、2输入异或门的VHDL设计 1.实体框图

2.程序设计 ①正确的程序 library ieee;

use ieee.std_logic_1164.all; entity xor2a is port(a,b:in std_logic; y:out std_logic);

end entity xor2a;

architecture ex1 of xor2a is begin

y<=((not a) and b) or (a and (not b)); end architecture ex1;

3.仿真波形图

4.仿真波形分析 由真值表可知: A

0 0 1 1 B

0 1 0 1

Y

0 1 0 1

当输入相同时输出为0,输入不同时输出为1. 三、3输入与非门的VHDL设计 1.实体框图

2.程序设计 ①编译前的程序 library ieee;

use ieee.std_logic_1164.all; entity adder4 is port(a,b,ci:in std_logic; co:out std_logic); end entity adder4;

architecture ex1 of adder4 is begin

s<=(not(((not a) and b) or (a and (not b))) and ci) or((((not a)and b)or (a and (not b))) and (not ci)) co<=((((not a)and b) or (a and (not b))) and ci) or (a and b) end architecture ex1;

②程序编译错误情况 错误1:

③正确的程序 library ieee;

use ieee.std_logic_1164.all; entity adder4 is port(a,b,ci:in std_logic; s,co:out std_logic); end entity adder4;

architecture ex1 of adder4 is begin

s<=(not(((not a) and b) or (a and (not b))) and ci) or((((not a)and b)or (a and (not b))) and (not ci));

co<=((((not a)and b) or (a and (not b))) and ci) or (a and b); end architecture ex1;

3.仿真波形图

4.仿真波形分析 由真值表可以知道: A

0 0 0 0 1 1 1 1 B

0 0 1 1 0 0 1 1 C

0 1 0 1 0 1 0 1 S

0 1 1 0 1 0 0 1 CO

0 0 0 1 0 1 1 1

由真值表可知s是加法器的和位输出,co是加法器的进位输出

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- ovod.cn 版权所有 湘ICP备2023023988号-4

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务