序列信号发生器的设计与实现
时钟输出clk_outt和序列信号输出q_out组成,进程p1描述状态逻辑,用if语句完成循环。实验过程与实验1类似。
四、 VHDL程序源代码
1、 序列信号发生器
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity xinhao IS
port
(
clk:in std_logic;
clear:in std_logic;
q_out:out std_logic;
clk_outt:out std_logic
);--用户定义的输入输出及类型
end xinhao;
architecture a of xinhao is
component div50m
port
(
clk_in:in std_logic;
clk_out:out std_logic
);--用户定义分频器的输入输出及类型
end component;
signal tmp: integer range 0 to 7;
signal clock: std_logic;--用户定义的信号及其类型
begin
u1: div50m port map(clk_in=>clk,clk_out=>clock);--分频器的引入
p1:process(clock)--第一个进程p1描述状态逻辑
begin
if clock'event and clock='1' then
if tmp=7 then
tmp<=0;
else