计数器及其应用研究
一、 实验目的:
1.熟悉计数器的工作原理,掌握中规模计数器 (MSI)逻辑功能及其应用。
2.掌握计数器的级联方法,并会用中规模计数 器(MSI)实现任意进制计数器。 二 实验仪器
1. 万用表 一块 2. 直流稳压电源 一台 3. 函数信号发生器 一台 4. 双踪示波器 一台 5. 逻辑分析仪 一台 6. 数字电路实验板 一块 三.实验内容
1.用VHDL语言描述模50计数器。要求完成电路设计,进行电路仿真,并下载后作功能测试。将计数器时钟置为1HZ方波信号,输出接译码、显示电路,在数码管上观察输出状态变化。
2.设计一个计数型序列码产生电路,产生的序列码(输出Z)为1101000101。要求用FPGA实现,并在实验箱上测试其功能,时钟设置为1KHZ,在示波器上双踪观察并记录CP,Z的波形。 四.实验结果 1.VHDL语言描述
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;
entity m50 is port (
clk : in bit; rst : in bit; en:in bit; rco:out bit;
q:out std_logic_vector(5 downto 0) ); end m50;
architecture one of m50 is
signal temp_q:std_logic_vector(5 downto 0); begin
process(clk,rst) begin
if (rst='0')then temp_q<=\ rco<='0';
elsif (clk'event and clk='1')then if(en='1')then
if(temp_q<\ temp_q<=temp_q+1; else
temp_q<=\ end if; else
temp_q<=\ end if; end if;
if(temp_q=\ rco<='1'; else rco<='0'; end if; end process; q<=temp_q; end one;
仿真波形: 功能仿真
时序仿真
2.VHDL语言描述 library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;
entity xuliema is
port (
clk : in std_logic; z: out std_logic ); end xuliema;
architecture one of xuliema is
type state_type is (s0,s1,s2,s3,s4,s5,s6,s7,s8,s9); signal current_state,next_state:state_type; begin process begin
wait until (clk'event and clk='1'); current_state<=next_state; end process;
process(current_state) begin
case current_state is