1、数字逻辑与部件设计实验报告 Google Code数字逻辑与部件设计实验报告学号:0730*姓名:张璞实验一 译码器和编码器3实验二 七段显示译码器的设计.10实验三 加法器、算术逻辑单元及快速进位电路的设计13实验四 触发器和寄存器.19实验五 计数器的设计.24实验六 有限状态机31实验七 总线传输实验.43实验一 译码器和编码器实验要求1 用与非门设计一个3-8译码器74LS138,除了下述真值表中的输入输出信号外,增加三个控制信号G1、G2A、G2B,当G1位高电平,G2A和G2B同时为低电平时,实现如表中的正常译码,否则Y0-Y7都为高电平。输入输出S2S1S0Y0Y1Y2Y3Y4Y
2、5Y6Y700001111111001101111110101101111101111101111100111101111011111101111011111101111111111102 设计一个如下表逻辑功能的8-3普通编码器。输入输出I0I1I2I3I4I5I6I7F0F1F210000000000010000000010010000001000010000011000010001000000010010100000010110000000011113 设计一个8-3优先编码器实验目的1、 熟悉实验仪的使用方法,熟悉基本的VHDL语言的语法规范,熟悉卡诺图的化简方法,熟悉德摩根定律。2、
3、 熟悉VHDL中if语句的使用,特别注意if语句优先级的问题。实验过程及讨论1、 在第一个实验中,输入输出地真值表都已经给出,所以首先对每个输出做化简工作。这些函数都是三变量的,所以化简相对容易,经过化简可以得到如下布尔函数:由于本实验要求是用与非门来实现,而上面的都是用非门和或门来实现的,所以运用德摩根定律,可以将上述的布尔函数等价转化为如下的布尔函数:对上述的布尔函数用与非门来实现就非常容易了。另外,本实验的要求中还要求有三个控制信号G1、G2A、G2B,当G1位高电平,G2A和G2B同时为低电平时,实现如表中的正常译码,否则Y0-Y7都为高电平。所以可以增加一个信号check,表示三个控
4、制信号是否满足要求,check的布尔函数如下:,把这个控制信号与每个输出用与非门连接起来就能得到满足所有要求的输出函数。设计完毕。2、 第二个实验由于输入是8变量的,所以无法用卡诺图手工化简,如果不使用if语句,需要用基本的与门、非门和或门把这些变量连接起来,实现真值表中所示的函数的功能。每个输出对应的布尔函数为:设计完毕。3、 由于要实现8-3优先编码器,VHDL语言中的if语句正好可以用在这里,if语句必须在process中使用,而在一个process中,所有语句都是顺序执行的,if的判断是顺序的,所以判断和执行的先后顺序就代表了优先级。在我的设计中I7的优先级最高,I0的优先级最低,所以
5、在用if语句判断的时候是从I7是否为1开始,逐个递减直到I0结束。另外,在实验3中,需要注意的是,在引脚锁定的时候,由于I0的优先级是最低的,所以需要把I0的引脚注释掉,否则编译的时候会报错。由于是第一次实验,所以忘记把Number of Clock Buffers的值设置为0,造成编译的时候报错,后经询问老师才得以解决。实验代码与引脚锁定1、3-8译码器实验代码library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;- Uncomment the
6、 following lines to use the declarations that are- provided for instantiating Xilinx primitive components.-library UNISIM;-use UNISIM.VComponents.all;entity decoder_3_8 is Port ( S2 : in std_logic; S1 : in std_logic; S0 : in std_logic; G1 : in std_logic; G2A : in std_logic; G2B : in std_logic; Y0 :
7、out std_logic; Y1 : out std_logic; Y2 : out std_logic; Y3 : out std_logic; Y4 : out std_logic; Y5 : out std_logic; Y6 : out std_logic; Y7 : out std_logic);end decoder_3_8;architecture Behavioral of decoder_3_8 issignal YT0,YT1,YT2,YT3,YT4,YT5,YT6,YT7,check:std_logic;begin YT0=not(not S2) nand (not S
8、1) nand (not S0); YT1=not(not S2) nand (not S1) nand S0; YT2=not(not S2) nand S1) nand (not S0); YT3=not(not S2) nand S1) nand S0; YT4=not(S2 nand (not S1) nand (not S0); YT5=not(S2 nand (not S1) nand S0; YT6=not(S2 nand S1) nand (not S0); YT7=not(S2 nand S1) nand S0; check=not(not(G1 nand (not G2A)
9、 nand (not G2B); Y0=(not YT0) nand check; Y1=(not YT1) nand check; Y2=(not YT2) nand check; Y3=(not YT3) nand check; Y4=(not YT4) nand check; Y5=(not YT5) nand check; Y6=(not YT6) nand check; Y7=(not YT7) nand check;end Behavioral;引脚锁定文件#PINLOCK_BEGINNET S2 LOC = P46;NET S1 LOC = P45;NET S0 LOC = P4
10、4;NET G2B LOC = P43;NET G2A LOC = P42;NET G1 LOC = P41;NET Y7 LOC = P90;NET Y6 LOC = P89;NET Y5 LOC = P88;NET Y4 LOC = P87;NET Y3 LOC = P86;NET Y2 LOC = P83;NET Y1 LOC = P82;NET Y0 LOC = P81;#PINLOCK_END2、8-3编码器实验代码library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LO
11、GIC_UNSIGNED.ALL;- Uncomment the following lines to use the declarations that are- provided for instantiating Xilinx primitive components.-library UNISIM;-use UNISIM.VComponents.all;entity coder_8_3 is Port ( I0 : in std_logic; I1 : in std_logic; I2 : in std_logic; I3 : in std_logic; I4 : in std_log
12、ic; I5 : in std_logic; I6 : in std_logic; I7 : in std_logic; F0 : out std_logic; F1 : out std_logic; F2 : out std_logic);end coder_8_3;architecture Behavioral of coder_8_3 isbegin F0=(not I0) and (not I1) and (not I2) and (not I3) and I4 and (not I5) and (not I6) and (not I7)or(not I0) and (not I1)
13、and (not I2) and (not I3) and (not I4) and I5 and (not I6) and (not I7)or(not I0) and (not I1) and (not I2) and (not I3) and (not I4) and (not I5) and I6 and (not I7)or(not I0) and (not I1) and (not I2) and (not I3) and (not I4) and (not I5) and (not I6) and I7); F1=(not I0) and (not I1) and I2 and
14、(not I3) and (not I4) and (not I5) and (not I6) and (not I7)or(not I0) and (not I1) and (not I2) and I3 and (not I4) and (not I5) and (not I6) and (not I7)or(not I0) and (not I1) and (not I2) and (not I3) and (not I4) and (not I5) and I6 and (not I7)or(not I0) and (not I1) and (not I2) and (not I3)
15、and (not I4) and (not I5) and (not I6) and I7); F2=(not I0) and I1 and (not I2) and (not I3) and (not I4) and (not I5) and (not I6) and (not I7)or(not I0) and (not I1) and (not I2) and I3 and (not I4) and (not I5) and (not I6) and (not I7)or(not I0) and (not I1) and (not I2) and (not I3) and (not I4
16、) and I5 and (not I6) and (not I7)or(not I0) and (not I1) and (not I2) and (not I3) and (not I4) and (not I5) and (not I6) and I7);end Behavioral;引脚锁定文件#PINLOCK_BEGINNET I7 LOC = P48;NET I6 LOC = P47;NET I5 LOC = P46;NET I4 LOC = P45;NET I3 LOC = P44;NET I2 LOC = P43;NET I1 LOC = P42;NET I0 LOC = P4
17、1;NET F2 LOC = P83;NET F1 LOC = P82;NET F0 LOC = P81;#PINLOCK_END3、 优先编码的8-3编码器实验代码library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;- Uncomment the following lines to use the declarations that are- provided for instantiating Xilinx primitive compo
18、nents.-library UNISIM;-use UNISIM.VComponents.all;entity coder_8_3_2 is Port ( I0 : in std_logic; I1 : in std_logic; I2 : in std_logic; I3 : in std_logic; I4 : in std_logic; I5 : in std_logic; I6 : in std_logic; I7 : in std_logic; F0 : out std_logic; F1 : out std_logic; F2 : out std_logic);end coder
19、_8_3_2;architecture Behavioral of coder_8_3_2 isbegin process(I0,I1,I2,I3,I4,I5,I6,I7) begin if I7=1 then F0=1;F1=1;F2=1; elsif I6=1 then F0=1;F1=1;F2=0; elsif I5=1 then F0=1;F1=0;F2=1; elsif I4=1 then F0=1;F1=0;F2=0; elsif I3=1 then F0=0;F1=1;F2=1; elsif I2=1 then F0=0;F1=1;F2=0; elsif I1=1 then F0
20、=0;F1=0;F2=1; elsif I0=1 then F0=0;F1=0;F2=0; else F0=0;F1=0;F2=0; end if; end process;end Behavioral;引脚锁定文件#PINLOCK_BEGINNET I7 LOC = P48;NET I6 LOC = P47;NET I5 LOC = P46;NET I4 LOC = P45;NET I3 LOC = P44;NET I2 LOC = P43;NET I1 LOC = P42;#NET I0 LOC = P41;NET F2 LOC = P83;NET F1 LOC = P82;NET F0
21、LOC = P81;#PINLOCK_END实验二 七段显示译码器的设计实验要求1 设计一个BCD-7段显示译码器。输入输出ABCDC0C1C2C3C4C5C600001111110000101100000010110110100111111001010001100110101101101101101011111011111100001000111111110011110011101XXXXXXXX11XXXXXXXXX2 把上述译码器扩展到16进制-7段译码器,即增加对A、B、C、D、E、F的显示。实验目的1、 进一步熟悉四变量的卡诺图的化简,练习用组合逻辑设计的一般方法解决实际问题。2、
22、学习BCD-7段显示译码器的设计方法。实验过程和讨论1、 由于真值表已经给出,是4变量的布尔函数,所以可以用卡诺图手工化简输出的布尔函数,化简结果如下所示:这些函数用基本的与门、或门和非门就可以很容易实现。2、 16进制-7段译码器的真值表如下所示:输入输出ABCDC0C1C2C3C4C5C6000011111100001011000000101101101001111110010100011001101011011011011010111110111111000010001111111100111100111010111011110110011110110010011101101011110
23、11110100111111111000111有上述真值表可以得到各个输出所对应的布尔函数如下:显然,有上述的布尔函数,通过与门、或门和非门就能得到对应的结果。本实验中比较困难的是引脚锁定的问题,需要首先观察每个开关所对应的数字键盘上灯的位置,然后进行相应的锁定才能够得到想要的效果。设计完毕。实验代码和引脚锁定1、BCD-7段译码器实验代码library ieee;use ieee.std_logic_1164.all;entity bcd_7 is port ( A,B,C,D:in std_logic; C0,C1,C2,C3,C4,C5,C6:out std_logic );end bc
24、d_7;architecture data_flow of bcd_7 isbegin C0=A or (B and D) or C or (not B) and (not D); C1=A or (not C) and (not D) or (C and D) or (not B); C2=A or B or (not C) or D; C3=(not B) and (not D) or (not D) and C) or (B and (not C) and D) or (C and (not B); C4=(not B) and (not D) or (not D) and C); C5
25、=A or (not C) and (not D) or (not D) and B) or (not C) and B); C6=A or (not D) and C) or (not C) and B) or (C and (not B);end data_flow;引脚锁定文件#PINLOCK_BEGINNET D LOC = P44;NET C LOC = P43;NET B LOC = P42;NET A LOC = P41;NET C0 LOC = P90;NET C1 LOC = P89;NET C2 LOC = P88;NET C3 LOC = P87;NET C4 LOC = P86;NET C5 LOC = P83;NET C6 LOC = P82;#PINLOCK_END2、16进制-7段译码器实验代码library ieee;use ieee.std_logic_1164.all;entity bcd_7_2 is port ( A,B,C,D:in std_logic; C0,C1,C2,C3,C4,C5,C6:out std_logic
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1