资源预览内容
第1页 / 共8页
第2页 / 共8页
第3页 / 共8页
第4页 / 共8页
第5页 / 共8页
第6页 / 共8页
第7页 / 共8页
第8页 / 共8页
亲,该文档总共8页全部预览完了,如果喜欢就下载吧!
资源描述
实验二 模十状态机与7段译码器显示一、实验目的:通过设计频率可选的模十状态机以及7段译码电路以进一步掌握VHDL硬件描述语言。二、实验流程:本设计有分频器、多路选择器、状态机和译码器。1. 时钟输入作为分频器的输入,输出时钟分别为2分频、4分频、8分频和16分频;2. 四个频率的时钟信号由4选1的多路选择器选择其中之一作为状态机的时钟输入;3.使用选中的时钟频率作为输入驱动状态机按照以下的次序输出:0-2-5-6-1-9-4-8-7-3-0的顺序输出;4. 使用此输出作为驱动输入到7段译码器的显示逻辑。三、实验代码:library IEEE;use IEEE.std_logic_1164.all;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;entity mod10 isport(clk,rst,load:in std_logic;sel:in std_logic_vector(1 downto 0);countss:in std_logic_vector(3 downto 0);seg:out std_logic_vector(6 downto 0);end mod10;architecture beha of mod10 is signal clk1,clk2,clk4,clk8,clk16:std_logic; signal count,q_temp:std_logic_vector(3 downto 0); signal counts:std_logic_vector(3 downto 0):=0000;begin process(clk,rst) -分频、rst:清零,低有效 begin if( rst = 0) thencount =0000; elsif( clkevent and clk =0) then count = count+1; end if; clk2 = count(0); clk4 = count(1); clk8 = count(2); clk16 clk1 clk1 clk1 clk1 null; end case;end process;process(clk1,rst,load) -load:置数,高有效, beginif(rst=0)then counts=0000;elsif(load=1)thencountscountscountscountscountscountscountscountscountscountscountscounts=0000;end case;end if;q_tempsegsegsegsegsegsegsegsegsegsegseg=0001000;end case;end process;end beha;四、实验结果1、功能仿真整体结果:二分频:四分频:八分频: 十六分频:2、时序仿真整体结果:二分频: 四分频:八分频:十六分频:五、实验心得: 做这个实验的时候花了很长的时间,算下来应该有足足一天时间吧。学的最多的是怎么将几个模块联系起来,以及理解了processing几个模块间都是并行运行的这个思想特别的深刻,这让模块间的联系简单了许多。另一个收获就是更加深刻的理解了quartus II语言的规则,让运用更加的得心应手。
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号