数电实验报告序列信号发生器的设计与实现

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

北京邮电大学

数字电路与逻辑设计实验报告

姓名:李金隆

学号: 09210947--15

班级: 2009211204

学院: 电子工程学院

2011年5月1日

一、实验名称:序列信号发生器的设计与实现

二、实验任务要求:

1、用VHDL语言设计实现一个信号发生器,产生的序列码为

01100111,仿真验证其波形,并下载到实验板测试。

2、用VHDL语言设计实验一个序列长度为7的M序列发生器,

仿真验证其功能,并下载到实验班测试。

三、设计思路与过程

1、序列信号发生器

序列信号发生器的端口由一个时钟输入和两个输出,信号序列输出q_out和时钟输出clk_outt组成。程序由两个进程构成,第一个进程p1描述状态逻辑,使用if语句实现自启动;第二个进程p2描述输出逻辑,用case语句完成其功能。根据题目要求,在第1、4、5位置上输出为“0”,在其他位置上输出为“1”,每8位实现一次循环。

在实验过程中,首先在建立Quartus II软件中建立工程,然后再工程中建立VHDL文件,输入程序代码后保存调试,编译成功后,建立Vector Waveform文件进行仿真,仿真完毕后,在程序中引入分频器,编译,锁定引脚后,下载到实验板验证其功能。在实验板上用一个开关代表clear清零,两个LED一个显示输出序列,一个显示时钟序列clk_outt。

2、M_序列信号发生器

M_序列信号发生器的端口由一个时钟输入clk和两个信号输出,

时钟输出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

tmp<=tmp+1;

end if;

end if;

end process p1;

p2: process(clear,tmp)—第二个进程描述输出逻辑

begin

if clear='0' then

q_out<='0';

else

case tmp is

when 0|3|4 =>q_out<='0';

when others =>q_out<='1';

end case;

end if;

end process p2;

clk_outt<=clk;

end a;

2、M序列信号发生器

library IEEE;

USE IEEE. std_logic_1164.all;

entity m_xulie is

port (

clk:in std_logic;

q_out:out std_logic;

clk_outt:out std_logic);--用户定义的输出输入及类型

end m_xulie;

architecture a of m_xulie is

component div50m

port

(

clk_in:in std_logic;

clk_out:out std_logic

);--用户定义分频器的输入的输出及类型

end component;

signal tmp:std_logic_vector (2 downto 0);

signal clock: std_logic;

begin

u1: div50m port map(clk_in=>clk,clk_out=>clock);--分频器的引入 p1:process(clk)—第一个进程P1描述状态逻辑

begin

if tmp= "000" then tmp <="001"; elsif clk'event and clk ='1' then tmp(0)<=tmp(0) xor tmp(2);

tmp(1)<=tmp(0);

tmp(2)<=tmp(1);

end if;

end process p1;

q_out<=tmp(2);--数列信号的输出

clk_outt<=clk;

end a;

五、RTL电路图

1、序列信号发生器

2、M_序列信号发生器

相关文档
最新文档