数字逻辑系统课程设计报告 1.docx

上传人:b****7 文档编号:23901749 上传时间:2023-05-22 格式:DOCX 页数:14 大小:94.61KB
下载 相关 举报
数字逻辑系统课程设计报告 1.docx_第1页
第1页 / 共14页
数字逻辑系统课程设计报告 1.docx_第2页
第2页 / 共14页
数字逻辑系统课程设计报告 1.docx_第3页
第3页 / 共14页
数字逻辑系统课程设计报告 1.docx_第4页
第4页 / 共14页
数字逻辑系统课程设计报告 1.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

数字逻辑系统课程设计报告 1.docx

《数字逻辑系统课程设计报告 1.docx》由会员分享,可在线阅读,更多相关《数字逻辑系统课程设计报告 1.docx(14页珍藏版)》请在冰豆网上搜索。

数字逻辑系统课程设计报告 1.docx

数字逻辑系统课程设计报告1

 

数字逻辑系统课程设计报告

 

课题:

电子密码锁

专业:

电子信息工程技术

班级:

B1311

学号:

21311060104

姓名:

李文翔

设计时间:

2015年3月23日-27日

评定成绩:

指导教师:

 

目录

 

一、设计内容与要求………………………………………

1.设计内容………………………………………………

2.设计要求………………………………………………

二、方案设计

1.程序与仿真波形………………………………………

2.顶层仿真模块原理图…………………………………

三、实现与测试……………………………………………

四、分析与总结……………………………………………

参考文献………………………………………………

 

一.设计内容与要求

1、设计六位密码(每位均可以是0~9任意数字)的电子密码锁,用四个拨码开关(k1~k4)输入,并通过七段数码管显示输入密码。

2、密码验证:

按键设置验证开始,输入密码后,密码正确时开锁,绿灯亮,红灯灭,表示开锁成功;当密码输入错误时,绿灯灭,红灯亮,表示开锁失败。

3、密码更改:

密码验证正确后可以更改,并设置按键控制更改密码功能。

4、密码清除:

密码输入过程中可以清除,并重新输入。

5、初始密码:

预设初始密码为123456

二.方案设计

1.总体模块设计

通过拨码输入密码,送到密码校验电路,如果校验正确开锁,并执行显示在LED灯上,同时密码校验正确可以进行密码修改。

 

 

2.顶层文件设计

本设计采用EDA技术和VHDL语言设计了一种按键输入密码并数码管回显,当输入正确密码时轰动绿灯亮、红灯熄灭表示开锁,而当输入错误密码时,红灯亮、绿灯熄灭表示关锁。

根据系统设计要求,系统设计采用自顶向下的设计方法。

顶层设计采用原理图设计方式,系统的整体组装设计原理图如图2所示。

它由拨码输入、寄存器、密码比较和显示灯四个模块组成。

其顶层文件设计如图:

 

3.各功能模块的具体实现

(1)拨码输入模块

拨码输入模块包括设置密码并读取、输入密码、系统复位功能。

该模块中我们设置了6个按键,各个按键的功能分别为:

按键1、2、3、4分别对应4位二进制密码输入、键5为密码确认键、键6为系统复位和密码读取按键。

如图:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

useieee.std_logic_arith.all;

entityais

port(k1,k2,k3,k4,k5:

instd_logic;

k_out:

outstd_logic_vector(3downto0);

q:

bufferstd_logic_vector(2downto0));

end;

architecturebhvofais

begin

process(k5)

begin

ifk5'eventandk5='1'then

ifq<"101"thenq<=q+'1';

elseq<="000";

endif;

k_out<=k1&k2&k3&k4;

endif;

endprocess;

endbhv;

(2)寄存器

用两个寄存器,每个寄存器存入6个二进制数,每个寄存器的输入和输出各6个。

b2寄存器为存入拨码输入的6个二进制数,b1寄存器为存入密码的6个二进制数,并在b1中加入初始密码

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityb1is

port(

d1,d2,d3,d4,d5,d6:

instd_logic_vector(3downto0);

q:

instd_logic_vector(2downto0);

q1,q2,q3,q4,q5,q6:

outstd_logic_vector(3downto0));

end;

architecturebhvofb1is

signalqq1,qq2,qq3,qq4,qq5,qq6:

std_logic_vector(3downto0);

begin

 

process(q)

begin

if

q<"101"then

qq1<="0001";

qq2<="0010";

qq3<="0011";

qq4<="0100";

qq5<="0101";

qq6<="0110";

qq1<=d1;

qq2<=d2;

qq3<=d3;

qq4<=d4;

qq5<=d5;

qq6<=d6;

endif;

endprocess;

q1<=qq1;

q2<=qq2;

q3<=qq3;

q4<=qq4;

q5<=qq5;

q6<=qq6;

endbhv;

b2寄存器

libraryieee;

useieee.std_logic_1164.all;

entityb2is

port(q:

instd_logic_vector(2downto0);

d1,d2,d3,d4,d5,d6:

instd_logic_vector(3downto0);

q1,q2,q3,q4,q5,q6:

outstd_logic_vector(3downto0));

end;

architecturebhvofb2is

begin

process(q)

begin

ifq="000"thenq1<=d1;

elsifq="001"thenq2<=d2;

elsifq="010"thenq3<=d3;

elsifq="011"thenq4<=d4;

elsifq="100"thenq5<=d5;

elseq6<=d6;

endif;

endprocess;

endbhv;

(3)密码比较模块

把2个寄存器里的二进制数进行比较,如图

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycis

port(c1,c2,c3,c4,c5,c6:

instd_logic_vector(3downto0);

m1,m2,m3,m4,m5,m6:

instd_logic_vector(3downto0);

s_out:

outstd_logic);

end;

architecturebhvofcis

begin

process(c1,m1,c2,m2,c3,m3,c4,m4,c5,m5,c6,m6)

begin

if

c1=m1then

if

c2=m2then

if

c3=m3then

if

c4=m4then

if

c5=m5then

if

c6=m6then

s_out<='1';

else

s_out<='0';

endif;

endif;

endif;

endif;

endif;

endif;

endprocess;

endbhv;

 

(4)显示模块

本设计要求输入正确密码时,绿灯亮、红灯熄灭;当输入错误密码时,5S后红灯亮绿灯灭

LIBRARYIEEE;

USEIEEE.STD_LOGIC_1164.ALL;

USEIEEE.STD_LOGIC_ARITH.ALL;

USEIEEE.STD_LOGIC_UNSIGNED.ALL;

entityfis

port(s1,s2,s3,s4,s5,s6:

INSTD_LOGIC_vector(3downto0);

q:

inSTD_LOGIC_VECTOR(2DOWNTO0);

cout:

bufferstd_logic_vector(2downto0);

dig:

bufferstd_logic_vector(5downto0);

DEL:

OUTSTD_LOGIC_VECTOR(3DOWNTO0));

end;

architectureoneoffis

begin

process(q)

begin

ifq<="000"then

cout<=cout+'1';

endif;

caseqis

when"000"=>DEL<=s1;

dig<="011111";

when"001"=>DEL<=s2;

dig<="101111";

when"010"=>DEL<=s3;

dig<="110111";

when"011"=>DEL<=s4;

dig<="111011";

when"100"=>DEL<=s5;

dig<="111101";

when"101"=>DEL<=s3;

dig<="111110";

whenothers=>null;

endcase;

endprocess;

endone;

 

LED七段数码管

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitydis

port(keyin:

instd_logic_vector(3downto0);

cout:

instd_logic_vector(2downto0);

keyout:

outstd_logic_vector(6downto0));

endd;

architectureoneofdis

 

begin

process(keyin)

begin

ifcout<"101"then

casekeyinis

when"0000"=>keyout<="1000000";

when"0001"=>keyout<="1111001";

when"0010"=>keyout<="0100100";

when"0011"=>keyout<="0110000";

when"0100"=>keyout<="0011001";

when"0101"=>keyout<="0010010";

when"0110"=>keyout<="0000010";

when"0111"=>keyout<="1111000";

when"1000"=>keyout<="0000000";

when"1001"=>keyout<="0010000";

whenothers=>keyout<=null;

endcase;

endif;

endprocess;

endone;

 

密码锁输入模块的仿真

三.分析与总结

 

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

当前位置:首页 > 经管营销 > 经济市场

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

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