ATM Complete Without Index
ATM Complete Without Index
ATM Complete Without Index
INTRODUCTION OF VLSI
1.1. Introduction
Very-large-scale integration (VLSI) is the process of creating integrated
circuits by combining thousands of transistor-based circuits into a single chip. VLSI
began in the 1970s when complex semiconductor and communication technologies
were being developed. The microprocessor is a VLSI device. The term is no longer as
common as it once was, as chips have increased in complexity into the hundreds of
millions of transistors.
1.2. Overview
The first semiconductor chips held one transistor each. Subsequent advances
added more and more transistors, and, as a consequence, more individual functions or
systems were integrated over time. The first integrated circuits held only a few
devices, perhaps as many as ten diodes, transistors, resistors and capacitors, making it
possible to fabricate one or more logic gates on a single device. Now known
retrospectively as "small-scale integration" (SSI), improvements in technique led to
devices with hundreds of logic gates, known as large-scale integration (LSI), i.e.
systems with at least a thousand logic gates. Current technology has moved far past
this mark and today's microprocessors have many millions of gates and hundreds of
millions of individual transistors.
At one time, there was an effort to name and calibrate various levels of largescale integration above VLSI. Terms like Ultra-large-scale Integration (ULSI) were
used. But the huge number of gates and transistors available on common devices has
rendered such fine distinctions moot. Terms suggesting greater than VLSI levels of
integration are no longer in widespread use. Even VLSI is now somewhat quaint,
given the common assumption that all microprocessors are VLSI or better.
As of early 2008, billion-transistor processors are commercially available, an
example of which is Intel's Montecito Itanium chip. This is expected to become more
commonplace as semiconductor fabrication moves from the current generation of 65
nm processes to the next 45 nm generations (while experiencing new challenges such
as increased variation across process corners). Another notable example is NVIDIAs
280 series GPU.
1
Size: Integrated circuits are much smaller-both transistors and wires are
shrunk to micrometer sizes, compared to the millimeter or centimeter scales of
discrete components. Small size leads to advantages in speed and power
consumption, since smaller components have smaller parasitic resistances,
capacitances, and inductances.
Speed: Signals can be switched between logic 0 and logic 1 much quicker
within a chip than they can between chips. Communication within a chip can
occur hundreds of times faster than communication between chips on a printed
circuit board. The high speed of circuits on-chip is due to their small sizesmaller components and wires have smaller parasitic capacitances to slow
down the signal.
Power consumption: Logic operations within a chip also take much less
power. Once again, lower power consumption is largely due to the small size
of circuits on the chip-smaller parasitic capacitances and resistances require
less power to drive them.
1.7. Applications
Electronic system in cars.
Digital electronics control VCRs
Transaction processing system, ATM
Personal computers and Workstations
Medical electronic systems etc.
Electronic systems now perform a wide variety of tasks in daily life.
Electronic systems in some cases have replaced mechanisms that operated
mechanically, hydraulically, or by other means; electronics are usually smaller, more
flexible, and easier to service. In other cases electronic systems have created totally
new applications. Electronic systems perform a variety of tasks, some of them visible,
some more hidden:
4
CHAPTER - 2
5
VERILOG HDL
Verilog HDL is a hardware description language that can be used to model a
digital system at many levels of abstraction ranging from the algorithmic-level to the
gate-level to the switch-level. The complexity of the digital system being modeled
could vary from that of a simple gate to a complete electronic digital system, or
anything in between. The digital system can be described hierarchically and timing
can be explicitly modeled within the same description.
The Verilog HDL language includes capabilities to describe the behavior-al
nature of a design, the dataflow nature of a design, a design's structural composition,
delays and a waveform generation mechanism including aspects of response
monitoring and verification, all modeled using one single language. In addition, the
language provides a programming language interface through which the internals of a
design can be accessed during simulation including the control of a simulation run.
The language not only defines the syntax but also defines very clear simulation
semantics for each language construct. Therefore, models written in
this language
many of its
operator symbols and constructs from the C programming language. Verilog HDL
provides an extensive range of modeling capabilities, some of which are quite difficult
to comprehend initially. However, a core subset of the language is quite easy to learn
and use. This is sufficient to model most applications.
2.1 History:
The Verilog HDL language was first developed by Gateway Design
Automation in 1983 as hardware are modeling language for their simulator product,
At that time, was a propnetary language. Because of the popularity of the, simulator
product, Verilog HDL gained acceptance as a usable and practical language by a
number of designers. In an effort to increase the popularity of the language, the
language was placed in the public domain in 1990. Open Verilog International (OVI)
was formed to promote Verilog. In 1992 OVI decided to pursue standardization of
Verilog HDL as an IEEE standard. This effort was successful and the language
became an IEEE standard in 1995. The complete standard is described in the Verilog
hardware description language reference manual. The standard is called std 13641995.
6
Verilog HDL also has built-in logic functions such as & (bitwise-and) and I
(bitwise-or).
7
2.3 SYNTHESIS:
Synthesis is the process of constructing a gate level net list from a registertransfer level model of a circuit described in Verilog HDL. Fig.2.2 shows such a
process. A synthesis system may as an intermediate step, generate a net list that is
comprised of register-transfer level blocks such as flip-flops, arithmetic-logic-units,
and multiplexers, interconnected by wires. In such a case, a second program called the
RTL module builder is necessary. The purpose of this builder is to build, or acquire
from a library of predefined components, each of the required RTL blocks in the userspecified target technology.
level. The logic gates used in the synthesized net lists are described in Appendix B.
The module building and logic optimization phases are not described in this book.
The above figure shows the basic elements of Verilog HDL and the elements
used in hardware. A mapping mechanism or a construction mechanism has to be
provided that translates the Verilog HDL elements into their corresponding hardware
elements as shown in Fig.2.3
CHAPTER 3
10
11
The ATM got smaller, faster and easier over the years. Thereafter, the history of ATMs
paused for over 25 years, until De La Rue developed the first electronic ATM, which
was installed first in Enfield Town in North London [2] on 27 June 1967 by Barclays
Bank. The first ATMs accepted only a single-use token or voucher, which was
retained by the machine. These worked on various principles including radiation and
low-coercively magnetism that was wiped by the card reader to make fraud more
difficult. The British engineer John Rose developed the idea of a PIN stored on the
card in 1965.
However, the modern, networked ATM was invented in Dallas, Texas, by Don
Wetzel in 1968. Wetzel was a department head at an automated baggage-handling
company called Ductal. In 1995 the Smithsonian's National Museum of American
History recognized Ductal and Wetzel as the inventors of the ATM. ATMs first came
into wide UK use in 1973; the IBM 2984 was designed at the request of Lloyds Bank.
3.2.2 System Design Review
Hardware Description
An ATM is typically made up of the following devices:
CPU (to control the user interface and transaction devices)
Magnetic and/or Chip card reader (to identify the customer)
PIN Pad (similar in layout to a Touch tone or Calculator keypad), often
manufactured as part of a secure enclosure.
Secure crypto processor, generally within a secure enclosure.
Display (used by the customer for performing the transaction)
Function key buttons (usually close to the display) or a Touch screen (used to
select the various aspects of the transaction)
Record Printer (to provide the customer with a record of their transaction)
Vault (to store the parts of the machinery requiring restricted access)
Housing (for aesthetics and to attach signage to)
Recently, due to heavier computing demands and the falling price of
computer-like architectures, ATMs have moved away from custom hardware
architectures using microcontrollers and/or application-specific integrated circuits to
adopting a hardware architecture that is very similar to a personal computer.
12
Many ATMs are now able to use operating systems such as Microsoft
Windows and Linux. Although it is undoubtedly cheaper to use commercial off-theshelf hardware, it does make ATMs vulnerable to the same sort of problems exhibited
by conventional computers.
13
Armored ATM: Armored ATMs are used primarily as outdoor ATMs. Such as
outdoor entertainment districts, outdoor flea markets, outdoor concert and
events, etc.
Host
Computer
Telephone network
ATM
Telephone network
complete secured control over the ATM operations. The ATM Controllers are working
on windows based operating systems, which also provide ease to designers for
programming and modeling its operation. ATM controllers are sophisticated chip
elements designed and programmed to make the transaction simple and user-friendly.
The ATM must be able to provide the following services to the customer:
A customer must be able to make a cash withdrawal from any suitable account
linked to the card, approval must be obtained from the bank before cash is
dispensed.
A customer must be able to make a deposit to any account linked to the card,
consisting of cash and/or checks in an envelope. The customer will enter the
amount of the deposit into the ATM, subject to manual verification when the
envelope is removed from the machine by an operator. Approval must be
obtained from the bank before physically accepting the envelope.
A customer must be able to make a transfer of money between any two
accounts linked to the card.
A customer must be able to make a balance inquiry of any account linked to
the card.
The ATM will communicate each transaction to the bank and obtain
verification that it was allowed by the bank. Ordinarily, a transaction will be
considered complete by the bank once it has been approved. In the case of a deposit, a
second message will be sent to the bank indicating that the customer has deposited the
envelope. If the customer fails to deposit the envelope within the timeout period, or
presses cancel instead, no second message will be sent to the bank and the deposit will
not be credited to the customer.
If the bank determines that the customer's PIN is invalid, the customer will be
required to re-enter the PIN before a transaction can proceed. If the customer is
unable to successfully enter the PIN after three tries, the card will be permanently
retained by the machine, and the customer will have to contact the bank to get it back.
If a transaction fails for any reason other than an invalid PIN, the ATM will display an
explanation of the problem, and will then ask the customer whether he/she wants to
do another transaction.
15
The ATM will provide the customer with a printed receipt for each successful
transaction, showing the date, time, machine location, type of transaction, account(s),
amount, and ending and available balance(s) of the affected account.
The ATM will have a key-operated switch that will allow an operator to start
and stop the servicing of customers. After turning the switch to the "on" position, the
operator will be required to verify and enter the total cash on hand. The machine can
only be turned off when it is not servicing a customer. When the switch is moved to
the "off" position, the machine will shut down, so that the operator may remove
deposit envelopes and reload the machine with cash, blank receipts, etc.
The ATM will also maintain an internal log of transactions to facilitate
resolving ambiguities arising from a hardware failure in the middle of a transaction.
Entries will be made in the log when the ATM is started up and shut down, for each
message sent to the Bank (along with the response back, if one is expected), for the
dispensing of cash, and for the receiving of an envelope. Log entries may contain card
numbers and amounts, but for security will never contain a PIN.
16
"on" position. The operator will be asked to enter the amount of money currently in
the cash dispenser, and a connection to the bank will be established. Then the
servicing of customers can begin.
using the machine, and then turns the operator switch to the "off" position. The
connection to the bank will be shut down. Then the operator is free to remove
deposited envelopes, replenish cash and paper, etc.
17
Session Case
A session is started when a customer inserts an ATM card into the card reader
slot of the machine. The ATM pulls the card into the machine and reads it. If the
reader cannot read the card due to improper insertion or a damaged stripe, the card is
ejected, an error screen is displayed, and the session is aborted. The customer is asked
to enter PIN, and is then allowed to perform one or more transactions, choosing from
a menu of possible types of transaction in each case.
After each transaction, the customer is asked whether he/she would like to
perform another. When the customer is through performing transactions, the card is
ejected from the machine and the session ends. If a transaction is aborted due to too
many invalid PIN entries, the session is also aborted, with the card being retained in
the machine. The customer may abort the session by pressing the Cancel key when
entering a PIN or choosing a transaction type.
Transaction Case
A transaction use case is started within a session when the customer chooses a
transaction type from a menu of options. The customer will be asked to furnish
appropriate details (e.g. account involved, amount). The transaction will then be sent
to the bank, along with information from the customer's card and the PIN the
customer entered.
If the bank approves the transaction, any steps needed to complete the
transaction (e.g. dispensing cash or accepting an envelope) will be performed, and
then a receipt will be printed. Then the customer will be asked whether he/she wishes
to do another transaction.
If the bank reports that the customer's PIN is invalid, the Invalid PIN
extension will be performed and then an attempt will be made to continue the
transaction. If the customer's card is retained due to too many invalid PINs, the
transaction will be aborted, and the customer will not be offered the option of doing
another.
18
19
of the reason for the failure of the transaction, and then the customer will be offered
the opportunity to do another.
20
withdraw from (e.g. checking) from a menu of possible accounts, and to choose a
amount from a menu of possible amounts. The system verifies that it has sufficient
money on hand to satisfy the request before sending the transaction to the bank. If not,
the customer is informed and asked to enter a different amount. If the transaction is
approved by the bank, the appropriate amount of cash is dispensed by the machine
before it issues a receipt. The dispensing of cash is also recorded in the ATM's log.
The customer pressing the Cancel key any time prior to choosing the dollar amount
can cancel a withdrawal transaction.
to (e.g. checking) from a menu of possible accounts, and to type in a amount on the
keyboard. The transaction is initially sent to the bank to verify that the ATM can
accept a deposit from this customer to this account. If the transaction is approved, the
machine accepts an envelope from the customer containing cash and/or checks before
it issues a receipt. Once the envelope has been received, a second message is sent to
the bank, to confirm that the bank can credit the customer's account - contingent on
manual verification of the deposit envelope contents by an operator later.
reports that the customer's transaction is disapproved due to an invalid PIN. The
customer is required to re-enter the PIN and the original request is sent to the bank
again. If the bank now approves the transaction, or disapproves it for some other
reason, the original use case is continued; otherwise the process of re-entering the PIN
is repeated.
Once the PIN is successfully re-entered, it is used for both the current
transaction and all subsequent transactions in the session. If the customer fails three
times to enter the correct PIN, the card is permanently retained, a screen is displayed
informing the customer of this and suggesting he/she contact the bank, and the entire
customer session is aborted.
21
set high to enable the 16-bit PIPO register to store the AccountNumber. In addition,
Signal
Flow
Data
Flow
PIN
StoreAccNu
m
4
in
o
e
PINentered
rese
4-Bitt
PIPO
out
Register
4
(to PIN
parser)
CISM
Sel
16-bit
2:1
1
Mux
LUT
1
6
CardNumber/
AccountNum
CardNumber
AccountNumb
er
en
in
1
6
rese
t
1
6
en
LockStatus
CheckStatus
CardPIN
out
(from PIN
parser)
1
6 0
Control State
Machine
16-Bit
PIPO
oe
out
Register
AccountNu
m (to
memory)
1
6
(Look
AccountNumb
er
CardNumb
er
enterPin signal is generated for the display to ask user for PIN.
-Up
Table
for 1
1
6
Account
Status)
Note : Clock and power from the common source is fed to all the
blocks and modules.
23
KeyEntered
Signal
Flow
Data
Flow
PIN
PARSER
Key = 0
CardPIN
Key = 1
(from Card
Information
in
enteredPIN
Storage
Module)
4
4
4-Bit SIPOout
e
n
rese(Left Shift)
t
o
e
Key =
Clear
e
n
Register
in
1
in
4-bit2
equality
Comparator
PINentered (to
Card
Information
Storage
Module)
in
1
2b1
1
enterPin
2-bit
in
2
MOD-4
rese
t
Key =
Enter
out
PINentered
Count
er
IPINcountCheck
tor
equality
e
Compara
n
PINequalit
y
Note : Clock and power from the common source is fed to all the
blocks and modules.
The AmountOut from the memory is stored in a 16-bit PIPO register in the fund
checker, and displayed. This amount is sent to the entered amount parser and display
whichOpti
on
KeyEntered
DepositSelect
ed
Key =
Enter
WithdrawSele
cted
Key =
Withdraw
TransactionSelec
tedCard
(to
Information
Storage Module)
Contro
l
NOselection
Key =
Clear
Signal
Flow
Data
Flow
reset
State
en
oe
16-Bit PIPO
FUND
CHECKE
R
in
ou
Register
t
1
6
AmountO
ut
1
6
oldBalance
(to
Entered Amount
Parser & Display)
Handsha
Machi
ke
ne
Memo
ry
Note : Clock and power from the common source is fed to all the
blocks and modules.
25
transaction. If high, CSM invalidates the transaction, else asks for verification from
user to proceed.
KeyEntered
Signal
Flow
Data
Flow
oldBalance
ENTERE
D
AMOUNT
PARSER
Key = 0
Key = 1
in
e
n
16-Bit SIPO
out
rese(Left Shift)
t
o
e
Key =
Clear
Register
(from Fund
enteredAmo Checker)
unt
1
1
y 6
x 6
bcin
16-bit
Adder
bco
sum_di
f
Subtractor
1
ut
6
Key =
Enter
AmountEntered
(to Card
Information
Storage Module)
enterDAmou
nt
newBalance
(to Memory
& Display)
OverflowUnderflo
w
verify
Signal
Flow
Data
Flow
KeyEntered
TransactionVal
id
Key = 1
TRANSACTIO
N VERIFIER
CancelTransacti
on
Key = 0
Note : Clock and power from the common source is fed to all the
blocks and modules.
CONTR
OL
STATE
MACHI
NE
27
CHAPTER 4
DESIGN OF AN ATM CONTROLLER
4.1 Introduction
Basically in this work controller for an ATM is created. There are many
different parts of the controller that is designed. First ATM controller should store the
important information from the Card Swiper. When the CardScanned line goes high, a
new card has been scanned and the data is valid on both the CardNumber line and the
PIN line. Next ATM controller must be able to parse an entered PIN. When the Key
Entered line goes high, at most one of the bits of Key will be high. A valid PIN is one
that matches the one stored from the card, so it is 4 bits long and contains 1s and 0s.
Once the PIN has been entered, the Enter key should be pressed. (If the Clear button
is pressed, the inputted PIN should be reset). 3 invalid PINs results in a Locking of the
account. When a PIN is invalid, the state machine should continue to try to get a new
PIN until 3 invalid ones have been entered.
Once a valid PIN is entered the user has an option to either withdraw or
deposit money. A deposit consists of getting the amount from the keypad and then
checking with memory to see if the current balance would overflow (16 bits) based on
the deposit amount. If the amount causes an overflow, the resulting balance is not
written back memory the anythingElse signal is asserted as well as the
InvalidTransaction signal. In the event that the transaction is valid, the user is taken
to a screen where they can verify the transaction and new balance (verify) from
which an Enter input sends a request to update the balance in memory and upon
completion prompts them with anythingElse
A withdraw works very similarly. A withdraw amount is entered from the
keypad and then the controller must get the current balance from memory and
determine if you can remove that much from the account. Again, if it is possible, the
new balance is written to memory, if not then nothing is written to memory and the
InvalidTransaction line goes high to the display, and then the controller should ask if
there is another transaction to be completed. When the is there another transaction?
(anythingElse) screen is up, the 0 is no and 1 is yes. 0 will return the user to
the initial state of waiting for a card to be swiped, and 1 returns them to the which
transaction? state.
28
Memory will set ReqDone to high when it is done locking the account
Memory will set ReqDone to high and have the current balance on
AmmountOut
Memory will set ReqDone to high when done writing the new value
that is valid on AmmountIn
PIN
CardScanne
d
TransactionSelec
ted
16
16 AccountNumb
LockStatus
er
CheckStatu
s
StoreAccNu
m
16
LUT
KeyEntere
d
CARD
INFORMATIO
N STORAGE
MODULE
PINenter CardPI
Key
{E,W,C}
AmountEnte
red
Key{0,1,C,E
}
ed
AccountNu
m
16
Req
4 N IPINcountChec
CONTROL
kPINequalit
PIN
yenterPi
PARSER n
FUND
CHECKER
STATE
MACHINE
DepositSelect
ed
NOselection
whichOpti
on
AmountOut
16
oldBalanc
OverflowUnderflow
e
enterWAmo
ENTERED
unt
enterDAmou
AMOUNT
nt
newBalan
16
Key
{0,1,C,E}4
16
(LOOK UP
TABLE)
Write
Loc
k
ReqDon
e
welcom
MEMORY
anythingEl
se InvalidTransacti
on
CardNumb
er
KE
Y
PA
D
Signal
Flow
Data
Flow
CARD
SWIPER
16
16
PARSER
Key
{0,1}
ce
TransactionVali
TRANSACTIO CancelTransacti
d
2
N VERIFIER onverify
ATM
CONTROLLER
16
16
Keystroke
codes
C : Clear
E : Enter
W : Withdraw
DISPLAY
Note : Clock and power from the common source is fed to all the
blocks and modules.
In all cases, and asks if he wants another transaction. If yes, which option is
asked for else, the ATM resets with a welcome signal, waiting for the next card to be
swiped. At every step, proper signals are generated to display the next instructions to
the user. The display section has a LUT defined for each signal w.r.t. which the
display screen changes. The signals that trigger the change of display are also used as
the internal control signal to activate various modules of the controller. This results
successful transactions every time, with elimination of any possibility of
miscalculation.
30
updating, the signal will goes to the anything else state S9 from which user will be
allowed to make more transaction by taking to state S5 else to the state S0.
Reset
IC=0
S0/
0
CS=0 IC=1
IPin=1
IPin=0
PM=
0
S4/
0
S6/
0
AE=
1
S7/
0
VT=1
OP=
1
AE=
0
1
S1/
0
CS=
1
S2/
0
AU=
1
S3/
0
PM=1
AU=
0
OP=0
S5/
0
MT=1
AE=
0
VT=0
S12/
0
AE=1
VT=0
S8/
0
TV=0
S10/0
S9/
0
TV=0
S13/
0
VT=1
MT=0
S14/
1
TV=1
S0
S11/1
TV=1
State Description
Scan Card
Scan Line
Storing information
Enter PIN
Count
Transaction type
Enter Deposit Amount
Deposit Check
Invalid
Anything Else
Deposit Verify
Updating Balance
Enter Withdraw
Amount
Withdraw Check
Withdraw Verify
Signal Description
Code
IC
CS
AU
PM
IPin
OP
AE
VT
MT
TV
Insert Card
Card Scan
Account Unlocked
PIN Matched
Invalid Pin Count
Option Select
Amount Entered
Valid Transaction
More Transaction
Transaction Verified
33
34
performed for withdraw operation in order to subtract the entered amount with the
previous balance. If the net balance is larger than 16-bits, then the transaction will
become invalid. In third always block, the output are declared with respect to the
state. Once the balance gets updated, the output signal is made to high.
4.6 Summary
37
CHAPTER - 5
INTRODUCTION & INSTALLATION OF XILINX ISE
12.3 ON WIN 7
5.1 Introduction
Xilinx's ISE is "Xilinx ISE is a software tool produced by Xilinx for synthesis
and analysis of HDL designs, which enables the developer to synthesize ("compile")
their designs, perform timing analysis, examine RTL diagrams, simulate a design's
reaction to different stimuli, and configure the target device with the programmer."
The goal of this lab/tutorial is to get the reader familiar with the process of
designing a simple digital electronic circuit, compiling it, and verifying it correct
behavior with a simulator. Knowledge of digital logic (basic gates, flip-flops, Moore
machines) is assumed. This lab is based on the excellent series of labs created for the
CoolRunner CPLD by Tiffany Liu in her Independent Study in the CS. Dept. at Smith
College.
File/New Project
Project Settings:
o
Device: XC2C257 (this is the marking on the CPLD on the actual kit)
Speed: -7
New Source
Click on top left icon (see image to the right) to add a new source to the
project.
in the Define Module window, add A and B as inputs, and Sum and Carry as
outputs.
Finish
You should then see the following template ready for you to complete:
16:36:46 04/16/2012
// Design Name:
// Module Name:
circuit2
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
39
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module circuit2(
input A,
input B,
output Carry,
output Sum
);
endmodule
module circuit2(
input A,
input B,
output Carry,
output Sum
);
and( Carry, A, B );
xor( Sum, A, B );
endmodule
First create a new simulation module: From the main menu, pick Project then
New Source.
Choose Verilog Test Fixture as the type of the module. Give it a meaningful
name, for example test.
Click Next and make sure that your original schematic module is selected.
the ISE will have generated a test module for us. It's almost what we need. We
just need to modify it a tad, as shown below:
);
initial begin
// Initialize Inputs
A = 0;
B = 0;
// Wait 100 ns for global reset to finish
#100;
// Add stimulus here
#10 A = 1;
#10 A = 0; B = 1;
#10 A = 1;
end
endmodule
A new window should open up, presenting a timing diagram. Use slider and
the magnifying glass + and - icons to zoom in on the marker at Time 100ns,
and see how Sum and Carry react to the changing A and B signals.
43
44
CHAPTER 6
SOURSE CODE IN VERILOG
// Verilog Code for ATM
module atm_fsm ( input clk, rst, insertcard, cardscan, acc_unlocked, deposit,withdraw,
amt_entered, valid_transaction, transaction_verified, more_transaction,
input [3:0] PIN, input [15:0] Amount,
output reg z );
reg [1:0] ipin_count; // invalid PIN counter
parameter [3:0] scan_card = 4'b0000,
scan_line = 4'b0001,
storing_info = 4'b0010,
enter_pin = 4'b0011,
count = 4'b0100,
transaction_type = 4'b0110,
enter_deposit_amount = 4'b0111,
dep_check = 4'b1000,
invalid = 4'b1001,
anything_else = 4'b1010,
dep_verify = 4'b1011,
updating_balance = 4'b1100,
enter_wd_amount = 4'b1101,
wd_check = 4'b1110,
wd_verify = 4'b1111;
reg [3:0] state,next;
reg [3:0] cardPIN=4'b1111;
reg [15:0] balance=16'b0001111111111000;
always @(posedge clk)
begin
if(rst) begin
45
state<=scan_card;
end
else
state<=next;
end
always @(negedge clk)
begin
case(state)
scan_card:if(insertcard) //S0
next = scan_line;
else begin
next = scan_card;
ipin_count = 2'b0;
end
scan_line:if(cardscan) //S1
next = storing_info;
else begin
next = scan_card;
ipin_count = 2'b0;
end
storing_info:if(acc_unlocked) //S2
next = enter_pin;
else begin
next = scan_card;
ipin_count = 2'b0;
end
enter_pin:if(PIN==cardPIN) //S3
next = transaction_type;
else begin
ipin_count = ipin_count+1;
next = count; end
count:
46
begin
if (PIN==cardPIN) //S4
next = transaction_type;
else
if(ipin_count != 3 ) begin
ipin_count = ipin_count+1;
next = count; end
else begin
next = scan_card;
ipin_count = 2'b0;
end
end
transaction_type:if(deposit) //S5
next = enter_deposit_amount;
else if (withdraw)
next = enter_wd_amount;
enter_deposit_amount:if(amt_entered)
//S6
next = dep_check;
else
next = transaction_type;
dep_check:if(Amount<=(~balance)) //S7
next = dep_verify;
else
next = invalid;
invalid : next = anything_else; //S8
anything_else:if(more_transaction) //S9
next = transaction_type;
else begin
next = scan_card;
ipin_count = 2'b0;
end
47
default : z=0;
endcase
end
endmodule
Output:
Fig.6.1 Output
49
CHAPTER - 7
In this case, the account gets locked due to the entry of invalid pin for three
times is shown in fig 3.1.
Invalid
PIN
Entered
Previous
Balance
Invalid PIN
Count
Starts
Account
Locked
The reset signal is set to low and hence process starts from scan card state. By
proper inputs given, the enter pin state can be reached. At this state, if invalid pin is
entered, the counter starts to work and when count exceeds three, account gets locked
which is clearly shown in Fig.7.1.
Case-2:
51
This case shows the overflow condition during deposit operation i.e. the
summation of entered amount and previous balance exceeds the 16- bits
representation.
Previous
Balance
Valid Pin
Entered
Entered
Amount
Overflow Occurs
leads to Invalid
State
The valid pin (1111) is entered that leads to transaction type from which
deposit is chosen. Once the amount is entered (65520) for deposit, the deposit check
process id carried out. During checking process, if it exceeds 16-bits, overflow
condition occurs and hence invalid state is obtained.
Case-3:
52
Here the amount cannot be withdrawn which is greater than the current
balance available in the account shown in Fig 7.3.
Previous
Balance
Withdraw Amount
Entered
53
Case-4:
Once the valid pin is entered, the deposit can be chosen from the transaction
type that is shown in Fig.7.4.
Here the valid pin (1111) is entered and the transaction type is obtained. From
which the deposit is chosen in which the user will be allowed to enter the amount
(240) that should be of 16-bits. Then the balance gets updated with the previous
balance (8184) and is verified (8424). Then more transaction can be performed
through anything else state.
Previous
Balance
Valid Pin
Entered
Amount
Deposited by
User
Balance
Updated
Amount Updated
and goes to
Anything Else
State
Case-5:
54
In this case, the amount can be withdraw from the current balance in the account by
user is shown in Fig.7.5.
Previous
Balance
Withdraw Amount
Updated
Balance
More Transaction
The Withdraw is chosen from the transaction type and amount is entered
(2032). The entered amount is checked and is verified. Once the verification is over,
the previous balance (8424) gets updated (6392). Then signal goes to anything else
state that leads to more transaction.
Thus providing the proper test cases can carry the various modes of operation
and those results are discussed.
55
has been chosen and the package as FG320 with the device speed such as -4. The
design of ATM Controller is synthesized and its results were analyzed as follows.
Logic Utilization
Logic Distribution
56
The device utilization summery is shown above in which its gives the details of
number of devices used from the available devices and also represented in %. Hence
as the result of the synthesis process, the device utilization in the used device and
package is shown above.
Timing Summary:
Speed Grade: -4
approximate while synthesize. After place and routing is over, we get the exact timing
summery. Hence the maximum operating frequency of this synthesized design is
given as 86.987 MHz and the minimum period as 11.496 ns. Here, OFFSET IN is the
minimum input arrival time before clock and OFFSET OUT is maximum output
required time after clock.
RTL Schematic:
The RTL (Register Transfer Logic) can be viewed as black box after
synthesize of design is made. It shows the inputs and outputs of the system. By
double-clicking on the diagram we can see gates, flip-flops and MUX.
57
IN
PU
TS
O
UT
PU
T
7.4 Summary
The developed ATM Controller design is modelled and is simulated using the
Modelsim tool.
The RTL model is synthesized using the Xilinx tool in Spartan 3E and their
synthesis results were discussed with the help of generated reports.
58
CHAPTER 8
CONCLUSION
8.1 Conclusion
Basically, ATM controller allows the user to interact with the memory and
hence the security level is increased. This also makes the transaction in account gets
easier. This work helps to understand the concept of Finite State Machine and
designing architecture of a system. The familiarization of the procedure to develop the
State Machine diagram of a system through system level analysis is improved. The
ATM block diagram is studied and the corresponding Moore Machine State diagram
is also analyzed. The FSM is modeled in Verilog HDL and verified for all the
appropriate scenarios.
The simulation results have been verified for the different appropriate test
cases. Hence the maximum operating frequency of this synthesized design is given as
86.987 MHz and the minimum time period as 11.496 ns.
59
BIBLIOGRAPHY
WEBSITES:
From Wikipedia
Google search
Howstuffworks.com
Engineersgarage.com
TEXTBOOKS:
60