
数字系统设计实验报告.doc
12页数字系统设计实验报告 班级:计算机 姓名: 学号: 计数器设计实验1、实验目的 1)学习计数器不同设计方法 2)学习掌握VHDL中不同输出类型在具体应用时的区别(OUT、INOUT、BUFFER) 3)学习掌握时序电路仿真方法2、实验内容 1)采用VHDL设计方法,设计一个60进制计数器,采用BCD码输出 2)给出上述设计的仿真结果3、实验设备1)清华同方PⅣ 2.4G\256M60G2)ISE 6.2i—Windows软件系统4、实验步骤1)创建工程2)程序输入3)仿真5、实验程序library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;ENTITY cm ISPORT(ai,bi,cin:IN STD_LOGIC; si,cio: OUT STD_LOGIC);END cm;ARCHITECTURE Behavioral OF cm ISBEGINsi<=(ai xor bi)xor cin;cio<=(ai and bi)or(cin and ai)or(cin and bi);END Behavioral;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 components.--library UNISIM;--use UNISIM.VComponents.all;entity mn isPORT(a,b:IN STD_LOGIC_VECTOR(3 downto 0); ci:IN STD_LOGIC; co:OUT STD_LOGIC; s:OUT STD_LOGIC_VECTOR(3 downto 0));END mn;architecture Behavioral of mn iscomponent cmPORT(ai,bi,cin:IN STD_LOGIC; si,cio:OUT STD_LOGIC);END component;signal carry:STD_LOGIC_VECTOR(4 downto 0);begincarry(0)<=ci;co<=carry(4);add1: cm port map(a(0),b(0),carry(0),s(0),carry(1));add2: cm port map(a(1),b(1),carry(1),s(1),carry(2));add3: cm port map(a(2),b(2),carry(2),s(2),carry(3));add4: cm port map(a(3),b(3),carry(3),s(3),carry(4));end Behavioral;6、 实验仿真结果实验二、加法器设计实验1、实验目的 1)学习了解加法器工作原理。
2)学习用VHDL语言设计全加器的设计方法 3)学习使用元件例化的方法设计多位加法器2、实验原理 两个n位二进制数相加的过程,是从最低有效位开始相加,形成和数并传送进位最后得到结果最低位只有加数和被加数相加,这种两个一位数相加称为半加;完成加数、被加数、低位的进位数三个一位数相加称为全加实现半加运算的电路称为半加器,实现全加运算的电路称为全加器3、实验内容 1)用VHDL语言设计全加器 2)用元件例化方法设计一个四位二进制加法器4、实验设备 1)清华同方PⅣ 2.4G\256M60G 2)ISE 6.2i—Windows软件系统5、实验步骤1)创建工程2)程序输入3)仿真6. 实验程序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 components.--library UNISIM;--use UNISIM.VComponents.all;entity fulladder is PORT(ai,bi,cin:IN STD_LOGIC; si,cio:OUT STD_LOGIC);end fulladder;architecture behavioral of fulladder isbegin si<=(ai xor bi) xor cin; cio<=(ai and bi)or(ai and cin) or(bi and cin);end Behavioral;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 components.--library UNISIM;--use UNISIM.VComponents.all;entity four is Port ( a,b : in std_logic_vector(3 downto 0); ci : in std_logic; co : out std_logic; s : out std_logic_vector(3 downto 0));end four;architecture Behavioral of four iscomponent fulladder PORT(ai,bi,cin:IN STD_LOGIC; si,cio:OUT STD_LOGIC); end component;signal carry:STD_LOGIC_VECTOR(4 downto 0);begincarry(0)<=ci;co<=carry(4);gen:for i in 0 to 3 generateadd:fulladder PORT map(ai=>a(i),bi=>b(i),cin=>carry(i),si=>s(i),cio=>carry(i+1));end generate gen;end Behavioral;7.仿真结果数字系统设计第三次实验简易数字钟设计实验1、实验目的 1)学习VHDL语言源程序输入方法。
2)学习使用元件例化的方法设计简易数字钟 3)进一步加深对仿真过程和仿真结果的理解2、实验原理数字钟是对输入时基秒脉冲进行计数,依次输出秒数值、分数值、小时数值,从而确定时钟时间3、实验内容 1)建立一个新的 工程 2)在上述工程中,采用VHDL语言的方 法设计上述简易数字钟 3) 通过仿真来验证设计结果4、 实验设备 1)清华同方PⅣ 2.4G\256M60G 2)ISE 6.2i—Windows软件系统 3)多功能EDA实验系统(V型)5、实验报告要求 1)实验目的、实验内容、实验设备、实验步骤 2)写出设计程序 3)画出简易数字钟的仿真波形6源程序: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 components.--library UNISIM;--use UNISIM.VComponents.all;entity counter24 is Port ( en,clk,temp : in std_logic; qh,ql : out std_logic_vector(3 downto 0); qcc : out std_logic);end counter24;architecture Behavioral of counter24 issignal temp_h:std_logic_vector(3 downto 0) := "0010";signal temp_l:std_logic_vector(3 downto 0) := "0011";beginprocess(en,clk)beginif clk='1'and clk'event thenif en = '1' and temp='1'thenif temp_l="0011"and temp_h = "0010" thentemp_l <= "0000";temp_h <= "0000";elseif temp_l="1001" thentemp_l <= "0000";temp_h <= temp_h + '1';elsetemp_l <= temp_l + '1';end if;end if;end if;end if;end process;qh <= temp_h;ql <= temp_l;qcc <= (not temp_l(3)) and (not temp_l(2)) and temp_l(1) and temp_l(0) and (not temp_h(3)) and (not temp_h(2)) and temp_h(1) and (not temp_h(0));end Behavioral;library IEEE;use IEE。
