Professional Documents
Culture Documents
USE ieee.std_logic_1164.all ;
ENTITY main IS
arm : in std_logic;
END main ;
TYPE State_type IS
(DISARMED,ARMED,SET1,EXIT_DELAY,ENTRY_DELAY,SET2) ;
BEGIN
PROCESS
BEGIN
CASE state IS
ELSE
END IF ;
count := 0;
ELSE
count := count + 1;
END IF;
ELSE
END IF;
ELSIF
ELSE
END IF ;
WHEN SET1 =>
ELSE
END IF ;
count := 0;
ELSE
count := count + 1;
END IF;
ELSE
END IF;
ELSE
state <= SET2;
END IF;
END CASE ;
END PROCESS ;
END behv ;
This is the code which I tried to do. I could compile it successfully but there is a
basic mistake so I am not able to simulate it at all. In the whole design all other
bits and pieces have been given by the tutor. Just MAIN, this is controller we
have to design it.
We have been given the FSM and ASM for the same system to design the
controller.
The crystal on the hardware is 25 MHz which gives 40ns time period but for the
KEYPAD scanning we require 10 to 20 ms scanning period. We are using simpad
to do simulation using keyad.
Hence the clock frequency comes down to 200Hz that gives time period of 5ms.
So for simulating we can give pin value over 7 to 8 clock cycles to read the scan
and know the pin.
Now for 10 seconds delay what I thought the counter is the best thing to
consider.
The code will give you some idea and I am sending the brief having FSM and ASM
for the projects.
We add all the files in project and then create symbols and attach them to get
the whole circuit.
s im in [ 3 . . 0 ] IN P U T s i m i n [ r3o . w. 0s ] [ 3 . . 0 ]
VC C
c o ls [ 2 . .0 ]
c o ls [ 2 . .0 ] O U TPU T
in s t 6
O U T PU T k ey w r
O U T P U T c lk o u t
fsm 3a
key pad3
k e y w rP I N O K O U T P U T P IN O K
c lo c k g e n L F c lk g e n
r o w s [ 3k .e. y0 ]v a l [ 3 . . 0 ] d a ta [3 ..0 ]
c lk in IN P U T c l k c i nl k o u t c l k _ ci nl k 2 0 0 c lk 2 0 0 key wr
VC C
c o ls [ 2 . . 0 ]
in s t 2
in s t 3
in s t in s t 4
m a in
c lk le d O U T P U T le d
zo n e [3 ..0 ] IN P U T z o n e [ 3l e . d. 01 ] O U T P U T le d 1
VC C
a rm
in s t 7
This is normal block diagram for the Intermediate level alarm system.