Sequential Logical Circuits Flip Flops Case Study Sequential Locking
Sequential Logical Circuits Flip Flops Case Study Sequential Locking
Commercially available locks have more keys and require longer sequences, our goal here is to
display the general procedure, avoid huge number of tables and obtain a readable scheme.
Ing. Michal Lucki, PhD. 6
State diagram
There are two input variables a and b corresponding to
two buttons at the keyboard.
Internal state: A
The transitions A→A’ required to unlock: 00,10,11.
The outputs are Y1 and Y2:
1, 𝑢𝑛𝑙𝑜𝑐𝑘 𝑖𝑡
𝑌1 = ቊ
0, 𝑙𝑜𝑐𝑘𝑒𝑑
1, 𝑎𝑙𝑒𝑟𝑡
𝑌2 = ቊ
0, 𝑛𝑜 𝑎𝑙𝑒𝑟𝑡
1 1 4 4 2 00
2 4 4 3 2 00
3 3 3 3 3 10
4 4 4 4 4 01
A’
Transition table of a Moore machine containing
information on internal states and the outputs
3 3 3 3 3 10 3 → 11
11 11 11 11 11 10
4 → 10
4 4 4 4 4 01 10 10 10 10 10 01
A’ Q1’Q2’
Note that it is not the conversion from decimal to binary values. One can name the states using any symbols instead
of decimal numbers, and assign them any binary string. However, to make further processing easier, it is
recommended to assign code words of a Gray code to avoid swapping rows in future Karnaugh maps. Then, the
particular rows in a transition table will become neighbor rows in Karnaugh maps.
Ing. Michal Lucki, PhD. 9
We need to find hardware to
implement transient functions
(store/update 0s and 1s):
Flip-flops
with the focus on D-type flip-flop
RS latch (RS = reset, set)
Note that for a D-type flip-flop, D is identical to Q’ value. It makes the design simpler – to
implement any transition between Q and Q’ values, you must know what binary data at
D must be sent to it to trigger such transition. Practically, you know that D is equal to Q’.
This shortcut can be used only in D-type flip-flops.
Ing. Michal Lucki, PhD. 16
Let us go back to our desing
and use D-type flip-flops
We will use two D-type flip-flops, i.e. we can use 7474 TTL components.
Practically we specify data for D to implement Q-> Q’, but D = Q’
Transitions of a D-type
flip-flop (general).
D is same as Q’
Selection of HW components: D-type flip-flops
What value must be sent to D so that transition from Q to Q’ is observed?
ab ab ab
00 01 11 10 Y1Y2 Q1Q2 00 01 11 10
Q1Q2 Q1Q2 00 01 11 10
00 00 10 10 01 00 00 0 1 1 0 00 0 0 0 1
01 10 10 11 01 00 01 1 1 1 0 01 0 0 1 1
11 11 11 11 11 10
11 1 1 1 1 11 1 1 1 1
10 1 1 1 1 10 0 0 0 0
10 10 10 10 10 01
D1 D2
Q1’Q2’ D1 D2 𝐷1 = 𝑏 ∣ 𝑄1 ∣ 𝑎ത 𝑄2 ത
𝐷2 = 𝑄1 𝑄2 ∣ 𝑎 𝑄2 ∣ 𝑎 𝑏𝑄1
Note that for a D-type flip-flop, D is
Karnaugh maps for D1 and D2 function
identical to Q’ value.
implemented by two flip-flops.
This simplification works only for D-type flip-flop Ing. Michal Lucki, PhD. 18
Outputs
In synchronous designs, outputs depend only on the memory, not inputs.
Inputs go first to the memory and then at the next clock, the output is updated
based on the memory (flip-flops).
ab
Q1Q2 00 01 11 10 Y1Y2
Q1 Q1
Q2 0 1 0 1
00 00 10 10 01 00 Q2
0 0 0 0 0 1
Outputs do not
01 10 10 11 01 00
depend on a , b
1 0 1 1 0 0
11 11 11 11 11 10
Y1 Y2
10 10 10 10 10 01
𝑌1 = 𝑄1 𝑄2 𝑌2 = 𝑄1 𝑄2
Q1’Q2’
Note that outputs are functions of Functions of outputs of the lock.
internal memory ONLY (not the
function of inputs) Ing. Michal Lucki, PhD. 19
Final scheme of a machine
a b CLK CLR
CLR
& CLK Q1
D1 Q1 y1
&
CLR
y2
& &
CLK Q2
& D2 Q2
&
Synchronous sequential logical circuit for the designed finite state machine
Ing. Michal Lucki, PhD. 20
JK flip-flop
Note that for a D-type flip-flop, D is identical to Q’ value. It makes the design simpler – to implement any
transition between Q and Q’ values, you must know what binary data at D must be sent to it to trigger such
transition. Practically, you know that D is equal to Q’. So if you want the flip-flop to set a 1, send it a 1 at the D
input, if you want the flip-flop to set a 0, send it a 0 at the D input. This shortcut cannot be used for the
remaining flip-flops, you have to carefully check up with the above tables, what to send in order to achieve the
required updates at the output(s)
Note that inputs influence both: internal states and Note that inputs influence internal states only, outputs
outputs – without waiting for the update update of state are updated synchronously based on the updated state
information, i.e. without waiting for the next rising edge of information, i.e. when the next rising edge of a clock is
a clock (can be done in an aynchronous mode, during the detected (synchronously). Inputs influence outputs in
transition). Inputs influence outputs in two ways: directly one way: only through the internal states
and through the internal states Ing. Michal Lucki, PhD. 25
Binary adder solved as asynchronous
sequential Mealy machine
There are two internal states:
A1 – an addition without carry in (p = 0)
A2 – an addition with carry in (p = 1)
0 + 1 (or 1 + 0) + no carry in from the previous operation results in 1 without new carry in
0 + 1 (or 1 + 0) + carry in from the previous operation results in 0 with new carry in
1 + 1 + no carry in from the previous operation results in 0 with new carry in to the more significant bit
1 + 1 + carry in from the previous operation results in 1 with new carry in to the more significant bit
Ing. Michal Lucki, PhD. 26
Binary adder solved as sequential Mealy
machine
28
Thank you for your attention