1、 实验2 四位比较器 1设计四位二进制码比较器,并在实验开发系统上验证。 2学习层次化设计方法。 5其它器件与材料 若干本实验实现两个4位二进制码的比较器,输入为两个4位二进制码和,输出为M(A=B),G(AB)和L(AB)(如图所示)。用高低电平开关作为输入,发光二极管作为输出,具体管脚安排可根据试验系统的实际情况自行定义。 1用硬件描述语言编写四位二进制码比较器的源文件; 2对设计进行仿真验证; 3编程下载并在实验开发系统上进行硬件验证. 四位比较器功能框图 四位比较器VHDL源文件:library ieee;use ieee。std_logic_1164。all;entity comp4
2、 is port( A3,A2,A1,A0: in std_logic; B3,B2,B1,B0: G,M,L: out std_logic);end comp4;architecture behave of comp4 isbeginp1: process(A3,A2,A1,A0,B3,B2,B1,B0) variable comb1,comb2: std_logic_vector(3 downto 0); begin comb1:=A3A2&A1A0;comb2:=B3&B2B1&B0;if(comb1com2) then G=1; M=0; L=0; elsif(comb1comb2)
3、then M=1; G=0; L else L=1 G=0;end if;end process p1;end behave;仿真波形图: 试验3 并行加法器设计一、试验目的 1。设计一个4位加法器。 2.体会用VHDL进行逻辑描述的优点. 3,熟悉层次化设计方法.二、试验仪器与器材EDA开发软件 一套 2。微机 一台 3.试验开发系统 一台 4.打印机 一台 5.其他器材和材料 若干三、试验说明a3本试验实现一个4位二进制数加法器,其功能框图如图所示。试验时用高低电平开关作为输入,用数码管作为输出(或用发光二极管),管脚锁定可根据试验系统自行安排。1用硬件描述语言编写4位二进制数全加器的源文
4、件;2对设计文件进行编译;3仿真设计文件;4编程下载并进行试验验证。五、试验结果4位二进制全加器的源文件:library ieee;use ieee.std_logic_1164。all;entity adder4 is port(a,b: in std_logic_vector(3 downto 0); cin: in std_logic_vector(3 downto 0); sum: out std_logic_vector(3 downto 0); count: out std_logic);end adder4;architecture behavioral of adder4 is
5、p1:process(a,b,cin) variable vsum: std_logic_vector(3 downto 0); variable carry: std_logic;carry:=cin;for i in 0 to 3 loop vsum(i):=(a(i) xor b(i) xor carry; carry:=(a(i) and b(i) or (carry and (a(i) or b(i);end loop;sum=vsum;count=carry; end process p1;end behavioral;实验4 计数器设计计数器是实际中最为常用的时序电路模块之一,本
6、实验的主要目的是掌握使用HDL描述计数器类型模块的基本方法.1EDA开发软件 一套2微机 一台3实验开发系统 一台4打印机 一台5其他器材与材料 若干计数器是数字电路系统中最重要的功能模块之一,设计时可以采用原理图或HDL语言完成。下载验证时的计数时钟可选连续或单脉冲,并用数码管显示计数值。1设计一个带有计数允许输入端、复位输入端和进位输入端的十进制计数器.2编制仿真测试文件,并进行功能仿真。3下载并验证计数器功能.4为上述设计建立元件符号。5在上述基础上分别设计按8421BCD码和二进制计数的100进制同步计数器。 十进制计数器程序: library ieee;std_logic_unsig
7、ned.all;entity counter10 is port(en,reset,clk:in std_logic; q:buffer std_logic_vector(3 downto 0); co:out std_logic);end counter10;architecture behav of counter10 is process(clk,en) if clkevent and clk=1 then if reset=1 then q=0000”; elsif en=1 then if q”1001 then q=q+1 else q=”0000 end if; end if;
8、end process;co=1 when q=”1001 else 0;end behav;4_7译码器程序:entity decoder4_7 is port( insign: in std_logic_vector (3 downto 0); outsign: out std_logic_vector (6 downto 0); end decoder4_7;architecture behave of decoder4_7 is process(insign) case insign is when”0000=outsign0000001 when ”00011001111”; whe
9、n 0010”=outsign0010010 when ”0011”=outsignoutsign0100100 when ”01101100000”;0111”=outsignoutsign=”1111111 end case; end process; end behave ;100进制计数器原理图: 实验5 巴克码发生器1实现一个在通信领域中经常使用的巴克码发生器。2掌握用大规模可编程逻辑器件实现时序电路的方法。5其它器件与材料 若干巴克码发生器在数据通信、雷达和遥控领域有相当广泛的应用。它能自动产生周期性的序列码。本实验要求产生的序列码信号为(1110010),可以用寄存器或同步时序电
10、路实现。为了能够通过实验开发系统验证试验结果,可以使用两个输入端,其中一个输出端同时输出巴克码,另一个输出端输出节拍。巴克码发生器的功能框图如图所示。1写出全部设计文件。2编写测试向量,进行功能仿真.3下载并用实验板验证。巴克码发生器程序:use ieee.std_logic_1164.all;std_logic_arith.all;std_logic_unsigned。entity back is port(clk,reset: dout1,dout2:end back;architecture behave of back is signal count7:integer range 0 to 6; process(clk,reset) if reset=1 then count7=0; elsif clkevent and clk=1 then if count7dout1dout1=1; when 3= when 4=dout1=0; when 5=dout1= when 6= when others=dout1 end case; end process;end behave;
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1