Design-exempel by Ingo Sander - KTHVariable-Entered Mapping (VEM) William Sandqvist [email protected]...
Transcript of Design-exempel by Ingo Sander - KTHVariable-Entered Mapping (VEM) William Sandqvist [email protected]...
System Control
COINRECEIVER
COIN_PRESENT
GT_1_EURO
EQ_1_EURO
LT_1_EURO
DEC_ACC
CLR_ACC
SYSTEMCONTROL
DROP
DROP_READY
CHANGER_READY
RETURN_10_CENT
DROP BOTTLE
COIN RETURN
William Sandqvist [email protected]
ACCUMU-LATOR
We will design the block,
System Control
Return only 10 cents coin.
Coin Reciever
COINRECEIVER
COIN_PRESENT
GT_1_EURO
EQ_1_EURO
LT_1_EURO
DEC_ACC
CLR_ACC
SYSTEMCONTROL
William Sandqvist [email protected]
The System Control unit controls a number of subsystems
from other suppliers. Coin Reciever. Drop Bottle. Coin
Return.
ACCUMU-LATOR
An ACCUMULATOR counts up the amount of paid coins.
• Signal COIN_PRESENT indicates that there are coins and the ”amount” is
indicated by the signals GT_1_EURO, EQ_1_EURO, LT_1_EURO.
• With the signals DEC_ACC and CLR_ACC the systemcontrol unit can
reduce the amount by 10 cents, or reset the ACCUMULATOR.
Coin Return
William Sandqvist [email protected]
SYSTEMCONTROL
CHANGER_READY
RETURN_10_CENT COIN RETURN
With a pulse on RETURN_10_CENT the coin return unit
will eject 10 cent, and signal CHANGER_READY when
this is done and the unit is ready for the next command.
Drop Bottle
William Sandqvist [email protected]
With a pulse on DROP the drop bottle unit will eject a
bottle, and signals DROP_READY when this is done and
the unit is ready for the next command.
SYSTEMCONTROL
DROP
DROP_READY
DROP BOTTLE
Block diagram
COINRECEIVER
COIN_PRESENT
GT_1_EURO
EQ_1_EURO
LT_1_EURO
DEC_ACC
CLR_ACC
System-styrning(SYSTEM
CONTROL)
DROP
DROP_READY
CHANGER_READY
RETURN_10_CENT
DROP BOTTLE
COIN RETURN
• Signal propertieso DROP_READY is active for a clockperiod after the bottle is ejected
o CHANGER_READY is active for a clockperiod after a 10 Cent coin is ejected
◦ Because of the mechanical properties the following signals are active and inactive for several clock periods: COIN_PRESENT (active for several clockperiods after the coin is inserted) DROP_READY (active for several clockperiods at bottle ejection) CHANGER_READY (inactive for several clockperiods at coin ejection )
Use a Moore-machine
William Sandqvist [email protected]
NEXT STATEDECODER STATE REGISTER
OUTPUTDECODER
State)
Clk
Inputsignals
Output signals
Construction of a state machine for the controller of a
vending machine
Assumptions
- Moore-Machine
- - Stateregister implemented with D-flip-flops
Function diagram for vending machine
William Sandqvist [email protected]
• Myntinkast
– 10 Cent, 50 Cent, 1 Euro
• Myntutkast
– 10 Cent
• Flaskpris
– 1 Euro
State diagram
We draw a
state diagram
from the
functional
diagram :
(a)
(b)
(c)
(d)
(e)
(f)
(g)
READYCHANGER _
CENTRETURN _10_
READYCHANGER_
EUROGT _1_
PRESENTCOIN _
PRESENTCOIN _
PRESENTCOIN _
PRESENTCOIN _
EUROLT _1_
EUROEQ _1_
READYDROP_
DROP
READYDROP _
ACCCLR _
ACCDEC _
State diagram
William Sandqvist [email protected]
Block schematic
William Sandqvist [email protected]
D
D
D
Next State Decoder
COIN_PRESENT
LT_I_EURO
EQ_I_EURO
GT_I_EURO
DROP_READY
CHANGER_READY
A
B
C
DA
DB
DC
A
B
C
Output
Decoder
DROP
CLR_ACC
DEC_ACC
Clk
Clk
Clk
RETURN_I0_CENT
Input signals Output signalsState register
State encoding
William Sandqvist [email protected]
Idea: Let the states that are close together in the state
diagram have codes with unit distance.
(b) next to (c)
(d) next to (e)
(a) next to (b)
(f) next to (g)AB
00 01 11 10
C
0 a Ø d f
1 b c e g
7 states 3 state variables A, B,
C are needed
The number of inputs is large, 6,
total there may be nine variables
in Karnaugh maps ???
(Ø = don’t care)
State encoding
(a)
(b)
(c)
(d)
(e)
(f)
(g)
READYCHANGER _
CENTRETURN _10_
READYCHANGER_
EUROGT _1_
PRESENTCOIN _
PRESENTCOIN _
PRESENTCOIN _
PRESENTCOIN _
EUROLT _1_
EUROEQ _1_
READYDROP_
DROP
READYDROP _
ACCCLR _
ACCDEC _
000
001
011
100110
111 101
State variables ABC, eg. in
state (c) is A = 0, B = 1 and
C = 1
CBAAB
00 01 11 10
C
0 a Ø d f
1 b c e g
(Ø = don’t care)
Coded state table?
William Sandqvist [email protected]
From the state diagram, you
can set up the following coded
state table.
How do we avoid the
complexity of nine variables?
Variable-Entered Mapping (VEM)
William Sandqvist [email protected]
A+ DA AB
00 01 11 10
C
0 0 Ø 1 1
1 0 EQ + GT 0 0
Variable-Entered Mapping can be helpful when you need Karnaugh diagrams with many
variables. You write functional expressions in the Karnaugh map.
Variables
Next state - DA
William Sandqvist [email protected]
A+ DA AB
00 01 11 10
C
0 0 Ø 1 1
1 0 EQ + GT 0 0
EQ : EQ_1_EURO
GT : GT_1_EURO
CAGTBAEQBADA A
Next state - DB
William Sandqvist [email protected]
B+ DB AB
00 01 11 10
C
0 0 Ø 1 0
1 CP EQ 0 1
EQ : EQ_1_EURO
CP : COIN_PRESENT
CBACPCBCBEQBADB B
Easy to miss!
Next state - DC
William Sandqvist [email protected]
C+ DC AB
00 01 11 10
C
0 CP Ø DR CR
1 1 0 0 1
CP : COIN_PRESENT
DR: DROP_READY
CR: CHANGER_READY
CBCRBA
DRCBCPCADC C
Output signals
William Sandqvist [email protected]
CBAACCDEC
CBACENTRETURN
ABCACCCLR
CABDROP
_
_10_
_
The output signals are
"pulses" which are
generated when passing
through the states d, f, e, g.
Implementation of the vending machine
William Sandqvist [email protected]
When they call from CocaCola, it's just for you all
”Digital Designers” to adopt the mission ...
”students must master the the design of simple
combinational and sequential digital systems”
You do that now!
William Sandqvist [email protected]
What will happen in state Φ?
William Sandqvist [email protected]
AB
00 01 11 10
C
0 a Ø d f
1 b c e g
ABC)010(
GTEQGTEQACAGTBAEQBAA ABC 101111)010(
ecdCBA ,,,111,011,110,0101
1...1111)010( EQBCBACPCBCBEQBAB ABC
DRCPCRDRCPC
CBCRBADRCBCPCAC
ABC
00001111)010(
What will happen in state Φ?
William Sandqvist [email protected]
ecdCBA ,,,111,011,110,0101
In Φ-state we are stuck, or
we go to (c) and then on. Or
we go to (d) and offers soft
drinks, or we go to (e) and
resets any previous payment.
Obviously, we need to purchase a reset circuit that ensures
that the machine always starts in (a) 000! Otherwise
we will have legitimate complaints from the customers!
RESET-generator
William Sandqvist [email protected]