FSM for digital Lock.doc

3
FSM for digital lock We want to develop a chip for a digital lock The keyboard for the digital lock is shown below Specifications of this digital lock Numbers 0 to 9 are represented by their corresponding binary values. A and B are represented by 1010 and 1011 Digital lock works in two modes o Day mode: Door opens on pressing ‘O’, or on entering the correct code. o Night mode: Door opens only on pressing the correct code. An external timer decides if it is day or night. o 0800 to 2000 is considered as day. An alarm turns on when a wrong key is pressed. The FSM (system) returns to its default position if o Keyboard is not pressed for 5 seconds o Alarm is ringing for 2 minutes. o For both the above two purposes, a ‘reset’ signal is received. Whenever a keyboard button is pressed, ‘press_kbd’ also turns 1. The code is “53A17”. The inputs and outputs of this automata are o In clk o In reset o In Day o In I[3 : 0] o In O o In press_kbd o Out door o Out Alarm FSM Design for the above problem Day O Key i clk rese alar door 4 Digi tal

description

mmm

Transcript of FSM for digital Lock.doc

Page 1: FSM for digital Lock.doc

FSM for digital lock We want to develop a chip for a digital lock The keyboard for the digital lock is shown below

Specifications of this digital lock Numbers 0 to 9 are represented by their corresponding

binary values. A and B are represented by 1010 and 1011 Digital lock works in two modes

o Day mode: Door opens on pressing ‘O’, or on entering the correct code.

o Night mode: Door opens only on pressing the correct code.

An external timer decides if it is day or night.o 0800 to 2000 is considered as day.

An alarm turns on when a wrong key is pressed. The FSM (system) returns to its default position if

o Keyboard is not pressed for 5 secondso Alarm is ringing for 2 minutes. o For both the above two purposes, a ‘reset’ signal is

received. Whenever a keyboard button is pressed, ‘press_kbd’ also

turns 1. The code is “53A17”. The inputs and outputs of this automata are

o In clko In reseto In Dayo In I[3 : 0]o In Oo In press_kbdo Out dooro Out Alarm

FSM Design for the above problem

Day

O

Key

i

clk reset

alarm

door4

Digital Lock

Page 2: FSM for digital Lock.doc

A = reset = 1 or key = 0 J =(i!= ‘0111’ or (O=’1’ and Day=’0’)) and Key=’1’

S = reset = 0 or key = 0

B = key = 1 and I = ‘0101’ and O = ‘0’ K = O=’1’ and Key = ‘1’ and Day = ‘1’ T = reset = 1C = key = 1 and I = ‘0011’ and O = ‘0’ L = O=’1’ and Key = ‘1’ and Day = ‘1’ U = reset = 1D = key = 1 and I = ‘1010’ and O = ‘0’ M = O=’1’ and Key = ‘1’ and Day = ‘1’ V = reset = 1E = key = 1 and I = ‘0001’ and O = ‘0’ N = O=’1’ and Key = ‘1’ and Day = ‘1’ W = reset = 1F = (i!= ‘0101’ or (O=’1’ and Day=’0’)) and Key=’1’

O = (O=’1’ and Key = ‘1’ and Day = ‘1’) or (key = 1 and I = ‘0111’ and O = ‘0’)

X = reset = 0

G = (i!= ‘0011’ or (O=’1’ and Day=’0’)) and Key=’1’

P = reset = 0 or key = 0 Y = reset = 0

H = (i!= ‘1010’ or (O=’1’ and Day=’0’)) and Key=’1’

Q = reset = 0 or key = 0 Z = reset = 1

I =(i!= ‘0001’ or (O=’1’ and Day=’0’)) and Key=’1’

R = reset = 0 or key = 0 AA = reset = 1

Outputs

E0 E1 E2 E3 E4

EA E5

A

B C D E

F G

H

I

J

K

L M NO

P Q R ST

U

VW

X Y

Z

AA

Page 3: FSM for digital Lock.doc

EA : Alarm = 1

E5: Door = 1

The remaining states have both the outputs equal to 0