EDA考试设计报告电子锁码器样本.docx

上传人:b****6 文档编号:4728416 上传时间:2022-12-08 格式:DOCX 页数:35 大小:84.72KB
下载 相关 举报
EDA考试设计报告电子锁码器样本.docx_第1页
第1页 / 共35页
EDA考试设计报告电子锁码器样本.docx_第2页
第2页 / 共35页
EDA考试设计报告电子锁码器样本.docx_第3页
第3页 / 共35页
EDA考试设计报告电子锁码器样本.docx_第4页
第4页 / 共35页
EDA考试设计报告电子锁码器样本.docx_第5页
第5页 / 共35页
点击查看更多>>
下载资源
资源描述

EDA考试设计报告电子锁码器样本.docx

《EDA考试设计报告电子锁码器样本.docx》由会员分享,可在线阅读,更多相关《EDA考试设计报告电子锁码器样本.docx(35页珍藏版)》请在冰豆网上搜索。

EDA考试设计报告电子锁码器样本.docx

EDA考试设计报告电子锁码器样本

广东海洋大学

EDA考试设计报告

调研题目:

电子锁码器

院系班级:

信息学院电子系电子1081班____

小构成员:

袁伟龙

指引教师:

郭晓云__________

时间:

.5.14

联系方式:

(66)

评阅成绩:

____________

 

电子锁码器

Electroniclocktranscoder

【abstract】:

inresponsetotherequirementsofthetestsubjectsteachersdodesign.Thisdesigncanrealizetheeightdecimalnumberlockcode,lockwithinaoutputthatcansignal(highleveleffective).

【keywords】:

lockcode,decimal,makecan

【摘要】:

为响应科目教师对考试规定而做设计。

本设计能实现八位十进制数以内锁码,锁定一种输出使能信号(高电平有效)。

【核心词】:

锁码十进制使能

引言

该锁码器分主状态分三个(待机状态,密码状态,结束状态),密码状态再分三个次状态(输入状态,修改状态,运营状态),可以设立8位以内十进制数任何密码,每个状态均有不同状态灯显示,当输入密码对的可以选取变化密码或者调至运营状态输出一种使能信号。

正文

一、待机状态

待机状态中,除输入对的状态灯外四个状态灯显示为“0001”,当使用者拨动回车键(enter、上升沿有效),使go信号置1,锁码器会从待机状态进入密码状态,进行输码、改码等功能。

二、密码状态

密码状态可用前提是go信号为高电平,且密码输入状态及时可用。

1)密码输入状态

密码输入状态四个状态灯显示为“0010”。

当状态灯这样显示时使用者可以输入想要输入八位以内十进制数然后拨动回车键,当输入暂时数(temp_password)等于已存储密码(password)时,对的输入状态灯亮。

当输入暂时数不等于已存储锁定密码,对的输入状态灯不亮且及时跳至主状态中结束状态。

当对的输入状态灯亮时,有两种选取。

①拨动回车键调至运营状态;②拨动变化键(change_password、上升沿有效)进入密码修改状态。

2)密码修改状态

密码修改状态四个状态灯显示为“0100”,这是对的输入状态灯依然在亮。

当状态灯这样显示时使用者可以输入想要八位以内十进制数。

当输入完毕时,使用者有两个选取:

①拨动变化键,把已输入数存储为密码;②拨动回车键,直接进入运营状态,由于对的输入状态灯依然亮,对的输入依然有效(当使用者觉得所修改密码不适当状况下需要用到)。

当使用者输入完毕,并拨动变化键把想要密码存储完后,拨动回车键就可进入运营状态。

(只要对的输入状态灯亮时,拨动回车键都能是锁码器进入运营状态)

3)运营状态

运营状态四个状态灯显示为“1000”,这时对的输入状态灯已熄灭。

当锁码器处在运营状态时,锁定输出使能信号为‘1’。

当使用者觉得已经完毕运营时拨动回车键就能使锁码器进入主状态中结束状态,并使输出使能信号、go信号置‘0’,且使次状态回到输入状态。

三、结束状态

结束状态没有任何操作,会有一种简朴流水灯效果,倒数一段不长时间后自动返回待机状态。

四、结束语

在设计基本完毕时,还存在诸多细节上问题。

例如在对的输入之后想要进入变化密码状态而未拨动变化键时,如果拨动数字选项键,会使到进入变化状态后暂时数初始值不为空(全0)。

虽然比较繁琐,但是通过一步步耐心在modelsim仿真验证后,基本上已经能让使用者正常、以便使用该锁码器了。

由于de2板上开关存在严重抖动现象,因此该锁码器中除了电平触发复位键外,其她所有使用到开关都带有去抖动功能。

最后,感谢郭晓云教师悉心指引。

参照文献:

EDA技术与应用(张建邓桃丽邓锐朱旭东编著)

单片机技术及系统设计(周美娟肖来胜编著)

源程序:

--模块名称:

程序包模块

--模块功能:

设立设计中使用到两个类型。

libraryieee;

useieee.std_logic_1164.all;

packageMy_packageis

typestate1is(standby_state,password_state,end_state);

typestate2is(input_state,change_state,run_state);

endMy_package;

 

--模块名称:

待机状态、密码输入准备状态、结束状态转换

--模块功能:

在待机状态下按一下回车键进入密码输入准备状态,

-----------在密码输入准备状态下发出一种complete信号进入结束状态,

-----------结束状态中自动计数一秒后回到待机状态。

libraryieee;

useieee.std_logic_1164.all;

usework.My_package.all;

entityStandby_password_end_transitionis

port(

clk:

instd_logic;--时钟输入

reset:

instd_logic;--复位键

enter:

instd_logic;--回车键

complete:

instd_logic;--完毕运营信号

lkd_state:

bufferstate1;--模块状态信号

go:

outstd_logic--密码输入模块准许信号

);

endStandby_password_end_transition;

architecturebehaviorofStandby_password_end_transitionis

signalstarting:

std_logic:

='0';--待机到密码输入准备状态容许信号

signalfinishing:

std_logic:

='0';--密码输入准备状态到结束状态容许信号

signalending:

std_logic:

='0';--结束状态到待机状态容许信号

signalcount:

integerrange0to49999999:

=0;--计数器

signalcount_delay:

integerrange0to999999:

=0;

signalstart:

std_logic:

='0';

begin

--进程名称:

三状态转换控制进程

--进程功能:

在不同准许信号下三状态转换

process(reset,clk,starting,finishing,lkd_state)

begin

ifreset='1'then

lkd_state<=standby_state;

elsifrising_edge(clk)then

caselkd_stateis

whenstandby_state=>--待机状态解决

ifstarting='1'then

lkd_state<=password_state;

else

lkd_state<=standby_state;

endif;

whenpassword_state=>--密码准备状态解决

iffinishing='1'then

lkd_state<=end_state;

else

lkd_state<=password_state;

endif;

whenend_state=>--结束状态解决

ifending='1'then

lkd_state<=standby_state;

else

lkd_state<=end_state;

endif;

endcase;

endif;

endprocess;

--进程名称:

starting容许信号控制

--进程功能:

starting容许信号控制,附去抖动

process(enter,lkd_state,reset)

begin

ifreset='1'then

start<='0';

elsiflkd_state=standby_statethen

ifrising_edge(enter)then

start<='1';

endif;

else

start<='0';

endif;

endprocess;

process(clk,start,count_delay,enter)

begin

ifrising_edge(clk)then

ifstart='1'then

ifcount_delay<999999then

count_delay<=count_delay+1;

elsifenter='1'then

starting<='1';

else

starting<='0';

endif;

else

count_delay<=0;

starting<='0';

endif;

endif;

endprocess;

--进程名称:

go信号控制

--进程功能:

go信号控制

process(lkd_state)

begin

iflkd_state=password_statethen

go<='1';

elsego<='0';

endif;

endprocess;

--进程名称:

finishing信号控制

--进程功能:

finishing信号控制

process(lkd_state,complete)

begin

iflkd_state=password_statethen

ifrising_edge(complete)then

finishing<='1';

endif;

else

finishing<='0';

endif;

endprocess;

--进程名称:

ending信号控制

--进程功能:

ending信号控制

process(lkd_state,clk,reset,count)

begin

ifrising_edge(clk)then

iflkd_state=end_statethen

ifcount<49999999then

count<=count+1;

else

count<=0;

ending<='1';

endif;

else

ending<='0';

count<=0;

endif;

endif;

endprocess;

endbehavior;

 

--模块名称:

解码锁码

--模块功能:

按回车键,若密码输入对的可选取变化密码或直接运营(run)

--按回车键跳结束状态(end_state);

--不对的转至结束状态。

--锁定新密码后按回车键跳到运营状态;

--按回车键调至借宿状态。

libraryieee;

useieee.std_logic_1164.all;

usework.My_package.all;

entityUnlockis

port(

clk:

instd_logic;--时钟输入

change_password:

instd_logic;--变化密码键(上升沿有效)

enter:

instd_logic;--回车键(上升沿有效)

reset:

instd_logic;--复位开关(高电平电平有效)

run:

outstd_logic;--运营容许信号(高电平有效)

------------Standby_password_end_transition模块信号

go:

instd_logic;--密码输入模块准许信号

complete:

outstd_logic;--运营完毕信号

------------暂时密码模块用信号

password_allow:

outstd_logic;--密码输入容许

clr_t:

outstd_logic;--暂时密码清零信号

ok:

bufferstd_logic;--回车键信号

change:

bufferstd_logic;--change_password信号

count_pn_enable:

outstd_logic;--count_pn使能信号

set_count_pn:

outstd_logic;--count_pn置数信号

password:

bufferstd_logic_vector(31downto0);--设定密码

temp_password:

instd_logic_vector(31downto0);--暂时密码

p_state:

bufferstate2;--Unlock状态信号

correct_input:

instd_logic;--密码输入对的信号

d_complete:

instd_logic--complete控制信号

);

endUnlock;

architecturebehavior2ofUnlockis

signalclr_o:

std_logic:

='0';--ok清零信号

signalclr_c:

std_logic:

='1';--change清零信号

signalclr_cpl:

std_logic:

='1';--complete清零

signalset_cpl:

std_logic:

='0';--complete置数

signalpass_word:

std_logic_vector(31downto0):

="00000000";--过渡密码

signalcount_delay1:

integerrange0to999999:

=0;

signalcount_delay2:

integerrange0to999999:

=0;

signaloo:

std_logic:

='0';

signalclr_oo:

std_logic:

='0';

signalcc:

std_logic:

='0';

signalclr_cc:

std_logic:

='0';

begin

--进程名称:

输入状态、变化状态、运营状态转换

--进程功能:

输入状态、变化状态、运营状态控制、解决

process(clk,reset,p_state,go,correct_input,change,ok,temp_password)

begin

ifrising_edge(clk)then

ifreset='1'then--复位

p_state<=input_state;

clr_cpl<='1';

set_cpl<='0';

clr_t<='1';

run<='0';

pass_word<="00000000";

count_pn_enable<='0';

set_count_pn<='0';

elsifgo='1'then

casep_stateis

wheninput_state=>--输入状态解决

run<='0';

clr_cpl<='0';

set_cpl<='0';

count_pn_enable<='1';

set_count_pn<='0';

clr_t<='0';

ifcorrect_input='1'then

count_pn_enable<='0';

set_count_pn<='1';

ifok='1'then

p_state<=run_state;

clr_t<='1';

set_count_pn<='0';

elsifchange='1'then

p_state<=change_state;

set_count_pn<='0';

clr_t<='1';

endif;

endif;

whenchange_state=>--变化状态解决

clr_t<='0';

count_pn_enable<='1';

ifok='1'then

p_state<=run_state;

clr_t<='1';

count_pn_enable<='0';

elsifchange='1'then

pass_word<=temp_password;

ifok='1'then

p_state<=run_state;

clr_t<='1';

count_pn_enable<='0';

endif;

endif;

whenrun_state=>--运营状态解决

run<='1';

clr_t<='0';

ifok='1'then

run<='0';

clr_cpl<='0';

set_cpl<='1';

p_state<=input_state;

clr_t<='1';

endif;

endcase;

else--go不等于1时解决

run<='0';

clr_cpl<='1';

set_cpl<='0';

p_state<=input_state;

count_pn_enable<='0';

set_count_pn<='0';

endif;

endif;

endprocess;

--进程名称:

ok信号控制

--进程功能:

通过回车键控制ok信号置1,通过clr_o置零,附去抖动

process(enter,reset,clr_oo,go)

begin

ifreset='1'then

oo<='0';

elsifclr_oo='1'then

oo<='0';

elsifgo='1'then

ifrising_edge(enter)then

oo<='1';

endif;

endif;

endprocess;

process(clk,clr_o,oo,count_delay1,enter)

begin

ifrising_edge(clk)then

ifgo='1'then

ifclr_o='1'then

ok<='0';

clr_o<='0';

elsifoo='1'then

ifcount_delay1<999999then

count_delay1<=count_delay1+1;

elsifenter='1'then

ok<='1';

clr_o<='1';

clr_oo<='1';

else

ok<='0';

clr_o<='1';

clr_oo<='1';

endif;

else

count_delay1<=0;

clr_o<='0';

clr_oo<='0';

endif;

else

ok<='0';

clr_o<='0';

clr_oo<='0';

endif;

endif;

endprocess;

--进程名称:

complete信号控制

--进程功能:

complete信号控制

process(clr_cpl,set_cpl,clk,d_complete)

begin

ifrising_edge(clk)then

ifclr_cpl='1'then

complete<='0';

elsifset_cpl='1'then

complete<='1';

else

complete<=d_complete;

endif;

endif;

endprocess;

--进程名称:

password_allow信号控制

--进程功能:

password_allow信号控制

process(p_stat

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 其它课程

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1