在数字电路系统中,分频电路应用得到十分广泛。例如,工程人
员常常使用分频电路来得到数字通信中的帧头信号、选通信号以及中断信号等。因此,分频电路在数字电路系统的设计中也应该作为重要的基本电路来掌握,从而给今后的一些设计带来方便。
三、实验内容
1.设计并实现一个6分频电路,要求其输出信号的占空比为50%。请分析分频电路设计原理并编写VHDL语言程序,利用Max*Plus2开发软件对其进行编译和仿真。
2.源代码 library ieee;
use ieee.std_logic_1164.all; --use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity clk_div6 is
port( clk: in std_logic; clk_out: out std_logic); end clk_div6;
architecture rtl of clk_div6 is signal clk_temp: std_logic; begin
process(clk)
variable counter: integer range 0 to 15;
constant md:integer:=2; begin
if clk'event and clk='1' then if counter=md then counter:=0;
clk_temp<=not clk_temp; else
counter:=counter+1; end if; end if; end process; clk_out<=clk_temp; end rtl;
library ieee;
use ieee.std_logic_1164.all; --use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity clk_div16 is
port( clk: in std_logic; clk_out: out std_logic);
end clk_div16;
architecture rtl of clk_div16 is signal clk_temp: std_logic; begin
process(clk)
variable counter: integer range 0 to 15; constant md:integer:=14; begin
if (clk'event and clk='1') then if counter=md or clk_temp='1'then counter:=0;
clk_temp<=not clk_temp; else
counter:=counter+1; end if; end if; end process; clk_out<=clk_temp; end rtl;
四、 运行结果
五、心得体会
在本实验中,由于我们对课本知识了解的不够透彻,对软件认知度不够强,我们遇到了很多的困难, 通过团队协商和老师的帮助指导,最终问题都克服了,本实验我们掌握了vhdl基本逻辑电路的综合设计应 用,看这最终做出的成功,加强了我们对这门课学习的兴趣。
实验七 时序逻辑移位寄存器的设计与
实现
一、 实验目的:
1. 进一步掌握VHDL语言的基本结构机设计的输入方法。 2. 掌握VHDL语言的时序逻辑电路的设计方法。
3. 掌握VHDL语言的基本描述语句特别是元件例化语句的使用方法。
二、 实验原理:
当CLK的上升沿到来时进程被启动,如果这时预置使能LOAD为高电平,则将输入端口的8位二进制数并行置入移位寄存器中,作为串行右移输出的初始值。
三、 实验内容:
1、 设计并实现一个带有同步并行预置功能的8位右移移位寄
存器。要求根据移位寄存器的设计原理编写此移位寄存器的