当前位置:文档之家› 基本逻辑电路设计优秀课件

基本逻辑电路设计优秀课件

9
7.1.2 简单门电路
▪ 简单门电路表达简答逻辑关系,采用简单的信 号代入语句就能够方便地实现;没有必要采用 复杂的结构。
▪ 例如, ▪ 反向器 y<= not a; ▪ 2输入与非门 y<= a nand b; ▪ 2输入或非门 y<= a nor b; ▪ 2输入异或门 y<= a xor b; ▪ 与或非门 y<= not ((a1 and a2) or (a3 and a4));
architecture rtl of fulladder is
signal a1,b1,cin1,sum1:std_logic_vector(1 downto 0);
begin a1<='0'& a; b1<='0'& b;
并位运算是为了满足代入符<=左、 右两侧运算对象的位数相同。
cin1<='0'& cin;
4
▪ 此例按真值表(用“与或”结构实现)要求,用 VHDL语言逻辑表达式方式描述四选一数据选 择器,将f=’1’的行用最小项表达式表达出来 即可。
▪ 这种描述方法和传统的由真值表变为最小项表 达式的设计方法是相同的,只是用VHDL语言 进行描述无须化简(由计算机进行化简);而用 传统设计方法描述时,常常要对最小项表达式 进行化简,以使设计电路简化。
y<=a nand b; end architecture nand2_1;
11
RTL视图
a
y~0
b
y
仿真波形图12源自2. 基于真值表的二输入与非门描述
library ieee; use ieee.std_logic_1164.all; entity nand2_72 is port (a,b:in std_logic;
1、借助真值表设计组合电路
设计任务:设计一个四选一数据选择器。
逻辑功能:从四个输入数据中选出某一数据输 出。
输入输出端口:四个数据输入端;两个选择控 制输入端;一个数据输出端。
in0
in1
in2 in3
mux4
f
x0
x1
引脚框图
entity mux4 is port(in0,in1,in2,in3:in bit;
10
1. 基于逻辑表达式的二输入与非门描述
library ieee; use ieee.std_logic_1164.all; entity nand2_71 is port(a,b:in std_logic;
y:out std_logic); end entity nand2_71; architecture nand2_1 of nand2_71 is begin
architecture rtl of funct is
begin
引脚框图
y<=(a and b and c) or (d and e); end architecture rtl;
逻辑表达式设计函数电路非常方便,只要用VHDL语 言的逻辑符号置换布尔方程中相应的逻辑符号即可。
6
3、用算术表达式描述组合电路
x0,x1:in bit; f: out bit); end entity mux4;
3
真值表:
in0 in1 in2 in3 x1 x0 f in0 - - - 0 0 in0 - in1 - - 0 1 in1 - - in2 - 1 0 in2
- - - in3 1 1 in3
architecture rtl of mux4 is
use ieee.std_logic_unsigned.all;
entity fulladder is
port(a,b,cin : in std_logic;
sum,cout: out std_logic);
end entity fulladder;
7
算术表达式:(cout,sum)=a+b+cin;
算术表达式设计电路,只要用
sum1<= a1+b1+cin1; VHDL语言的算术符号置换算术
sum<=sum1(0);
表达式中相应的算术符号即可,
cout<=sum1(1);
同时要考虑VHDL语言对运算操
end architecture rtl; 作数的要求。
8
组合逻辑电路设计实例
简单门电路 译码器 编码器 编码转换器 数据选择器 运算器 三态门及总线缓冲器
y:out std_logic); end entity nand2_72; architecture nand2_2 of nand2_72 is begin
13
process(a,b) is
variable comb:std_logic_vector(1 downto 0);
begin comb:=a&b; case comb is
基本逻辑电路设计
7.1 组合逻辑电路设计
7.1.1 设计基础 一、组合逻辑电路的设计步骤
逻辑问题 逻辑真值表 逻辑函数式 选定器件类型 化简逻辑函数 逻辑电路图
分析事件的因果关系,确定 输入端口和输出端口及逻辑 状态的含意。 将实际的逻辑问题抽象成逻 辑函数。
由EDA工具自动完成。
2
二、用VHDL建立组合逻辑电路的方法
5
2、用逻辑表达式描述组合电路
设计任务:设计一个函数电路y=abc+de。
输入输出端口:五个函数自变量输入端;一个 函数值输出端。 entity funct is
port(a,b,c,d,e:in bit;
a b
y: out bit);
c function y end entity funct;
d e
begin
f<= (in0 and ((not x1) and (not x0))) or
(in1 and ((not x1) and ( x0))) or
(in2 and (( x1) and (not x0))) or
(in3 and (( x1) and ( x0)));
end architecture rtl;
设计任务:设计一位全加器。
逻辑功能:考虑来自低位的进位,将两个一位的 二进制数相加,得到一个和位、一个进位位。
输入输出端口:两个加数输入端;一个低位进位 输入端;一个和输出端;一个进位输出端。
a
b
full sum
cin adder cout
引脚框图
library ieee;
use ieee.std_logic_1164.all;
相关主题