当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

黑龙江大学物理科学与技术学院:《EDA教程——EDA技术及应用》第四章 VHDL的基本描述语句(蔡喜平)

资源类别:文库,文档格式:PPT,文档页数:24,文件大小:190KB,团购合买
点击下载完整版文档(PPT)

4.13并行信号赋值语句 信号赋值语句: 目标信号<表达式 三种形式:并发信号赋值语句;条件信号赋值语句;选择信号赋值语句 1.并发信号赋值语句 又称基本信号赋值语句。 个结构体中多条并发信号赋值语句是并行执行的,与书写顺序无关。 例:加法器 包括:半加器、全加器和多位全加器 (1)半加器 将两个输入的二进制数字相加,输出结果为和(um)和进位(arry) 半加器:只考虑了两个加数本身,没有考虑从低位来的进位 half add 半加器的真值表 输入 輸出 被加数A 加数B 和数S 进位C 0 a 0 1 0 0100 000 半加器的电路符号 1

4.1.3并行信号赋值语句 信号赋值语句: 目标信号 <= 表达式; 三种形式:并发信号赋值语句;条件信号赋值语句;选择信号赋值语句 1. 并发信号赋值语句 又称基本信号赋值语句。 一个结构体中多条并发信号赋值语句是并行执行的,与书写顺序无关。 例:加法器 包括:半加器、全加器和多位全加器 (1) 半加器 将两个输入的二进制数字相加,输出结果为和(sum)和进位(carry)。 半加器:只考虑了两个加数本身,没有考虑从低位来的进位 输入 输出 被加数A 加数B 和数S 进位C 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 半加器的真值表 半加器的电路符号 half_add a b c s

●半加器的原理图编辑 半加器的原理图编辑 ●文本编辑法 library ieee; useieee.std_logic_1164. all; entity half add is port(a, b:in std _ logic, S,c: out std_ logic) end half add: architecture one ofhalf add is b gin s<=axorb c<=a and b do

⚫半加器的原理图编辑 XOR inst AND2 inst1 VCC A INPUT VCC B INPUT OUTPUT S OUTPUT C 半加器的原理图编辑 ⚫文本编辑法 library ieee; use ieee.std_logic_1164.all; entity half_add is port(a,b:in std_logic; s,c: out std_logic); end half_add; architecture one of half_add is begin s<=a xor b; c<=a and b; end one;

或 libraryieee, use 1eee.st td _logic_1164.all; use ieee std_logic_unsigned. all; entity half addis port(a, b:in std_ logic, S,c: out std logic) end half add architecture one ofhalf add is signal temp: std _logic_vector(1 downto 0 egin temp<=(0′&a)+b; s<=temp(o) c<=temp(1) end one

或 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity half_add is port(a,b:in std_logic; s,c: out std_logic); end half_add; architecture one of half_add is signal temp: std_logic_vector(1 downto 0); begin temp<=(‘0’&a )+b; s<=temp(0); c<=temp(1); end one;

(2)全加器 全加器执行加数、被加数和低位来的进位信号,并根据求和结果给出该进位的信号。 全加器的真值表 输 输出 被加数A加数B低位进和数s 进位co 0 0 0000 0 000 co 100 0 全加器的电路符号 1111 0101010 0100

(2) 全加器 输入 输出 被加数A 加数B 低位进 位ci 和数s 进位co 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 全加器的真值表 全加器的电路符号 add a b co s 全加器执行加数、被加数和低位来的进位信号,并根据求和结果给出该进位的信号。 ci

libraryieee, useieee.std _logic_1164. all; useieee. std logic unsigned. all entity addis port(a, b, ci:in std logic, S,co: out std _ logic) end add1 architecture one of add1 is signal temp: std _logic_vector(1 downto 0 begin temp<=("0′&a)+b+c; s<=temp(o) co<=temp(1) end one

library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity add1 is port(a,b, ci:in std_logic; s,co: outstd_logic); end add1; architecture one of add1 is signal temp: std_logic_vector(1 downto 0); begin temp<=(‘0’&a )+b+ci; s<=temp(0); co<=temp(1); end one;

(3)4位全加器 A、B分别为4位二进制,c为低位进位输入信号 lil faryieee> use ieee std_logic_1164.al add4 useieee. std_ logic_unsigned. all; b[3…s3 ntity addis port(a, b in std _ logic_vector(3 downto O) [3…0 gcy co 1: in std_logic; s: out std_logic_vector(3 downto O)) end add4: 4位全加器的电路符号 architecture one of add4 is signal temp: std_logic_vector(4 downto O); b cemp<=(0&)+b <=temp (3 downto O) co<-temp do

(3) 4位全加器 A、B分别为4位二进制,ci为低位进位输入信号 4位全加器的电路符号 add4 a[3…0] b[3…0] co s[3…0] ci library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity add4 is port(a,b:in std_logic_vector(3 downto 0); co: out std_logic; ci: in std_logic; s: out std_logic_vector(3 downto 0)); end add4; architecture one of add4 is signal temp: std_logic_vector(4 downto 0); begin temp<=(‘0’&a )+b+ci; s<=temp(3 downto 0); co<=temp(4); end one;

例:减法器 包括半减器、全减器和多位全减器 1)半减器 只考虑了减数和被减数,而没有考虑由低位来的借位 half sub 半加器的真值表 输入 输出 a dout 被减数A 减数B 差dout 借位cout 0 0 0 cout 0 0 0100 半加器的电路符号 0 无符号位二进制减法 0-0=0;1-0=1;1-1=0;0-1=1(从高位借位1) 借位规则:(a)如果从某一位借1后,则该位变为0; 〔b)如果借位的位本来是0,则要继续向更高一位借位,直到值为1 的位,原位上值为0的都转为1,而最后借位的位转为0

例:减法器 包括半减器、全减器和多位全减器 (1)半减器 只考虑了减数和被减数,而没有考虑由低位来的借位 输入 输出 被减数A 减数B 差dout 借位cout 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0 0 半加器的真值表 半加器的电路符号 half_sub b a cout dout ➢无符号位二进制减法: 0-0=0; 1-0=1; 1-1=0; 0-1=1 (从高位借位1) 借位规则: (a)如果从某一位借1后,则该位变为0; (b)如果借位的位本来是0,则要继续向更高一位借位,直到值为1 的位,原位上值为0的都转为1,而最后借位的位转为0

例:计算1110-1101 新的次高位厂向次高位的借位 01 1110 -1001 0101 例:计算10000-101 1111 10000向高位借位后 101 1011 思考:求:10101-10010; 答:00011 求:10000-1111; 答:0001

例:计算1110 - 1101 1 1 1 0 - 1 0 0 1 新的次高位 向次高位的借位 0 1 0 1 例:计算10000-101 0 1 1 0 0 0 0 -1 0 1 1 1 1 1 向高位借位后 1 0 1 1 思考:求:10101-10010; 答:00011 求:10000-1111; 答:0001

●采用原理图输入法 半减器原理图编辑 ●采用文本编辑法 library ieee; useieee.std_logic_1164. all; entity half subis port(a, b:in std _ logic, dout, cout: out std _ logic); end half sub architecture one ofhalf sub is b gin dout<=axor b: cout<=not a and b: end one

⚫采用原理图输入法 XOR inst NOT inst1 AND2 inst2 VCC a INPUT VCC b INPUT OUTPUT dout OUTPUT cout 半减器原理图编辑 ⚫采用文本编辑法 library ieee; use ieee.std_logic_1164.all; entity half_sub is port(a,b:in std_logic; dout, cout: outstd_logic); end half_sub; architecture one of half_sub is begin dout<=a xor b; cout<=not a and b; end one;

或 libraryieee, use ieeestd logic_1164.all; use ieee std_logicunsigned.all entity halt sub 1s port(a, b:in std_ logic, dout, cout: outsid logic) end half sub architecture one ofhalf sub is signal temp: std _logic_vector(1 downto 0 begin temp<=("0′&a)-b; dout<=temp(o); cout<=temp(1) end one

或 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity half_sub is port(a,b:in std_logic; dout, cout: outstd_logic); end half_sub; architecture one of half_sub is signal temp: std_logic_vector(1 downto 0); begin temp<=(‘0’&a )-b; dout<=temp(0); cout<=temp(1); end one;

点击下载完整版文档(PPT)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共24页,试读已结束,阅读完整版请下载
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有