Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 51

Sequential Networks

Combinatorial Network

In Out Out = f (In)


N

Sequential Network

In Out Out = f (In, Q)


N, Q
Memory for Q
Q - state
Basic Definitions

Sequential machine
Automata
Automaton Finite
Deterministic
Mathematical model of a system
performing a class of mappings

Sequential network = Realization of Sequential machine


Features of Deterministic Mappings

1. | In | = d |Out | = d

2. In = rrr… r q1 Out = vvv…vOut(q1)


In = rrr…r q2 Out = vvv…vOut(q2)
3. Out = r1r2 r1 = Out
4. Out(r1r2) = q1q2 Out(r1) = q1 Out(r2) = q2
Basic Problems in Sequential Networks

1. Minimization of # of states
Equivalent states (completely defined automata)
Compatible states (incompletely defined automata)

2. State assignments and coding

3. Decomposition of automata
Combinational and Sequential Network
SN = Logic network with memory
Memory element = Flip-flop x1 z1
.. ..
CN – combinational network . .
xl CN zm
y1
SN – sequential network
yn
Out(CN) = f (Present In)
Out(SN) = f (Present In, Past In) M
Past In determines States of SN

Input variables x1, x2, ... , xl


State variables y1, y2, ... , yn
Output variables z1, z2, ... , zm
Elementary Automata
Mealy automata
M  (, Q, Z , f , g )
  σ1 ,..., σ l  -input signals |  |   
Q  q1 ,..., qn  - states
Z  z1 ,..., z m  - outputs
f : Q    Q funkcija stanja f (q(t ), σ(t ))  q(t  1)
g  Q  Z funkcija izlaza g (q(t ), σ(t ))  z (t )
Moore automata
f  Q  Q f (q(t ), σ(t ))  q(t  1)
g :Q  Z g (q (t ))  z (t )

Medvedev g (q(t ), σ(t ))  q(t )


Mealy and Moore Sequential Machines

# of combinations (State, In) if Mealy


# of different Out =
# of States, if Moore

(t) (t)
q(t) q(t)

CN M CN M CN

q(t+1) = f(q(t),(t)) q(t+1) = f(q(t),(t))


Z(t) = f(q(t),(t)) Z(t) = f(q(t))

Mealy Moore
Representation of Finite Automata

1. Functional description
State function f
Output function g

2. Transition table – State table

3. Transition graph – State diagram

4. Transition matrices
Representation of Binary Adder

xi si Mealy automata
yi
ci-1 ci

Inputs States
  xi , yi   00, 01, 10, 11 1. q0 - no carry
Outputs 2. q1 - carry
Z  0,1 Q  q0 , q1 
State Functions
f (q0 ,11)  q1 f (q1 , 01, 10, 11)  q1 q1 = carry
f (q0 , 00, 01, 10)  q0 f (q1 ,00)  q0 q0  carry

ci-1 xi yi ci si Z q0, 11
0 11
000 00 0 1 01 q1, 01, 10, 11 = q1
1 10
001 01 1 1 11
010 01 1
011 10 2
0 00 q0, 00, 01, 10
100 01 1
0 01 = q0
101 10 2 q1, 00
0 10
110 10 2 1 00
111 11 3
Output Functions
g (q0 , 00, 11)  0 g (q0 , 01, 10)  1 xi  yi  ci 1  z
g (q1 , 00, 11)  1 g (q1 , 01, 10)  0

g=0 q0, 00, 11


q0 0 00 g q , 01, 10 =0
0 11 1
q1 1 01
1 10

q0, 01, 10
g=1 q0 0 01 g q , 00, 11 =1
0 10 1

q1 1 00
1 11
Binary Adder
Assignment of states = Out Moore

00 q0 0 f (q00  q01 , 00)  q00 q00 , 00


 01 q0 qc,s
c - carry f (q00  q01 , 11)  q10 0  0  0  0
1
Z   q1 s
10  0
  q1 s - sum f (q  q , 01  10)  q c
11  1 00 01 01 0
ci-1 xi yi ci si
f (q10  q11 , 00)  q01

000 00 q00 f (q10  q11 , 11)  q11


001 01
010 01
q01 f (q10  q11 , 01,10)  q10
011 10 q10
100
101
01
10
q01
g (q00 )  g (q10 )  0
q10
110 10 g (q01 )  g (q11 )  1
111 11 q11
Transition Table for Adder
x1,x2
q 00 01 11 10
q0 q0,0 q0,1 q1,0 q0,1
Mealy
q1 q0,1 q1,0 q1,1 q1,1
q(t) q(t+1) / Z
x1,x2
00 01 11 10 Z
q
q00 q00 q01 q10 q01 0
q01 q00 q01 q10 q01 1 Moore
q10 q01 q10 q11 q10 0
q11 q01 q10 q11 q10 1
q(t) / Z q(t+1)
Transition Graph for Adder
00/0 11/1
00/0
q0 q1 Mealy
00/1
01/0 01/0

00 00

q00 11 q10
01
11 Moore
00 00 11
01
q01 q11
00

01 11
Representation of Vending Machine

Word description of vending machine


Cost (drink) = 150 Change = 50
In = coins 100, 50 x1 , x2 x1 = 1, In = 100
x2 = 1, In = 50
Out = drink, change z1 , z2 z1 = 1, Out = drink
z2 = 1, Out = change
q0 – No money (initial state)
q1 – Received 50
q2 – Received 100
Transition Table for Vending Machine

Present Input x1x2


state 00 01 10
q0 q0,00 q1,00 q2,00
q1 q1,00 q2,00 q0,10
q2 q2,00 q0,10 q0,11

q0  x1x2 = 01 q1  z1z2 = 00
No money In = 50 Received 50 Out = 00

q2  x1x2 = 10 q0  z1z2 = 11
Received 100 In = 100 No money Out = drink and change
State Diagram for Vending Machine
00/00 01/00 00/00

q0 q1
10/10

10/00
10/11 01/10 01/00
q2

00/00
q0  x1x2 = 01 q1  z1z2 = 00
No money In = 50 Received 50 Out = 00
q2  x1x2 = 10 q0  z1z2 = 11
Received 100 In = 100 No money Out = drink and change
Complexity of Sequential Networks
Optimal coding possible if sequential network is simple

Algorithms for optimization of


Complexity (Majority of algorithms)
Propagation time

Complexity = f(Logic elements, Flip-Flops)

Two heuristic algorithms for nearly optimal networks


1. Minimization of expressions for MV variable binary f
2. Minimization of Hamming distance of codes for states
with high frequency of transitions
State Assignment
Different coding Different Complexity
Propagation time

If # of states = R, then min # of bits =  log2 R 

R=4 # of bits = 2 # of encodings = 24


y1 y2 y1 y2 y1 y2
q0 00 00 00
q1 01 11 10
q2 10 10 11
q3 11 01 01
Single Non-zero Bit Encoding

If # of states = R, then # of bits = R

Features
More FFs than in min encoding
Sequential network is faster

R=4 q0 = (1000)
q1 = (0100)
q2 = (0010)
q3 = (0001)
State Assignment (Example)

x1 x2
q 00 01 11 10 q y1 y2 y 3 y1 y2 y3 y1 y2 y3
1 1 4 3 1 1 001 000 000
2 1 4 4 1 2 010 001 001
3 1 4 5 8 3 011 010 011
4 1 4 6 8 4 100 011 010
5 8 8 7 8 5 101 100 110
6 8 8 8 8 6 110 101 111
7 1 1 1 1 7 111 110 101
8 1 1 2 1 8 000 111 100

Direct encoding
Direct Coding
x1 x2
q y1 y2 y3 00 01 11 10 x1 x2 y1 y2 y3
1 001 001 100 011 001 11 0 0 1
2 010 001 100 100 001 y2 11 1 0 0
3 011 001 100 101 000 11 1 0 1
4 100 001 100 110 000 11 0 0 0
5 101 000 000 111 000
6 110 000 000 000 000 Y2  x1 x2 y 2
7 111 001 001 001 001
8 000 001 001 010 001
x1 x2 ( y1 y 2 y3  y1 y 2 y3  y1 y 2 y3  y1 y 2 y3 ) x1 x2 ( y1 y2  y1 y2 )  x1 x2 y2

y1 y2
y1 y2
Functions for Different Assignments
Y1  y1 y 2 x2  y1 y 2 y3 x2  y1 y3 x1 x2  y1 y 2 x1 x2

Y2  y2 x1 x2
Y3  y1 y3 x2  y1 y2 y3  y2 y3 x1 x2  y3 x1 x2  y1 x1 x2  y1 y2 y3 x1  y1 y2 y3 x1

Y1  y1 y2  y1 y2 x1
Y2  y1 y2  y2 x2  y1 x1 x2  y1 y2 x1 x2
Y3  y1 y 2 x2  y3 x1 x2  y1 x1 x2  y1 y 2  x1 x2  y 2 x1 x2

Y1  y1 y2  y2 x1
Y2  y1 x2
Y3  y3 x1 x2
Comparison of Different Assignments

C1 C2 C3
AND 12 11 4
OR 2 3 1
NOT 5 4 2
Gates 19 18 7
In 47 36 11
Algorithms for State Assignment

Exact minimum if SN simple

Heuristic algorithms

1. Minimization of auxiliary multiple-valued input


binary output functions

2. Analysis of transitions among states


d – Hamming distance
qi, qj – states with frequent transitions
If d (qi, qj) = small, then SN = simpler
Reduction of States

Sequential machine = SM
Specified
SM

Completely Incompletely

States

Equivalent Compatible
Completely Specified SM
Given SM, transition table  uniquely specified

SM with equivalent behaviour


0 1 0 1
q q
q0 q0/0 q1/0 q0 0 2
q0/0 q1/0

q1 q0/1 q1/1 q1 q2/1 q1/1


q2 q0/0 q1/0
In 0,1
States q0, q1 Alternate q0  q2
Out 0,1
Incompletely Specified SM
Compatible States
q1  q2 iff
1. When g(q1, r) and g(q2, r) specified, then g(q1, r) = g(q2, r)
2. If g unspecified, then g may be arbitrary.

Compatibility
1. Refleksive
2. Symmetric
3. Not necessarily transitive

Compatibility class = Set of compatible states Ci


Determination of Compatible States

Cover of (Q) = {C1,C2,…,Cq} where C1  C 2  ...  C q  Q

b  C1 , C 2 ,..., C q  = closed if Ci – compatibility cl

For each i  1,2,..., q and each σ  


 j  1,2,..., q f (Ci , σ)  C j

For an automat A and a closed cover b for A, factor automat A/b is


A / b  , b, Z , f ' , g ' f ' (Ci , σ)  C j g ' (Ci , σ)  g (Ci , σ)
g (Ci , σ)   or a singleton set, since Ci is a compatibility class

A/b covers A Out((A/b)(Ci)) = Out((A)(q)) qCi


Compatible States
0/-
0 1 Compatibility
R
R R,- 1,0
1/0 1/0 f (C1 , σ)  C2
1/0
1 2,0 R,0 0/1 f (C2 , σ)  C1
1 2
2 1,1 R,0 f (C1 , σ)  C2
0/0
f (C2 , σ)  C2
f ( R,0)  R, f (2,0)  1,1 f (1,1)  R,0 σ  
f (1,0)  R,0 f (2,1)  R,0 f ( R,1)  1,0

C1 C2 C2 C1 C1 C1
0 1 0/0
1/0
C1 C2,0 C1,0 C1 0/11/0 C2
C2 C1,1 C1,0
C1={R,1} C2={R,2}
Compatible States (Further)

f ( R,0)  R, f (2,0)  1,1


f (1,0)  2,0 f ( R,1)  1,0
f (1,1)  R,0 f (2,1)  R,0

C1 C2 C2 C1

0 1 1/0
C1 C2,0 C2,0 0/0

C2 C1 1/0 C2
C1,1 C1,0
0/1
Incompletely Specified SM

1. Specification of inspecified states


2. Minimization

Do not always produce minimum automata

0/- {0,1}
1/0 R 1/0
1/0 Specified SM cannot be minimized
0/1
1 2
0/0
Algorithm for Compatible States

A/b b(A) Exceptions Some particular case

Algorithm (Compatible States)


1. Determine Ci, i =1,…,q
2. Determine b

b – closed cover
Equivalent States
A - Completely specified
Compatibility Equivalence

Reflexive Reflexive
Symmetric Symmetric
Not transitive Transitive

q1  q2 iff g (q1 , r )  g (q2 , r )

Ci – equivalence classes
If q1  q2 then f (q1 , σ)  f (q2 , σ) σ  
{C }= Closed cover b Factor automat has minimum number of s
i
Algorithm for Equivalent States
l
q1  q 2 g (q1 , σ)  g (q2 , σ) |r|l l - equivalence

bc(A) = {Ci} and Qmin = A/b


Algorithm (Qmin)
1
1. q1  q 2 g (q1 , σ)  g (q2 , σ) σ   1 - equivalent
l Read from state table
l 1 l 1
2. q1  q 2 iff q1  q 2 and f (q1 , σ)  f (q 2 , σ) σ  

l 1 l l i
Reccurence
3. If    then    i  l 1
l
4.   Converngence
i-equivalent is equivalent
Equivalent States (Example)

Binary messages coded such that there is no two 1,


nor four 0 in sequence. Find faulty messages.

  Z  0,1

g = 1 iff 1,2 = 1,1  1234 = 0,0,0,0

Q = {s000, s001, s010, s011, s100, s101, s110, s111}


Sequential Machine (Example)

q 0 1 In y Y
In y Y
s000 s000,1 s100,0 0 000 000 1 000 100
s001 s000,0 s100,0
s010 s001,0 s101,0 0 001 000
s011 s001,0 s101,0
0 010 001
s100 s010,0 s110,1
s101 s010,0 s110,1
s110 s011,0 s111,1 1

s111 s011,0 s111,1  ( s 000 ) ( s 001 , s 010 , s 011 ) ( s100 , s101 , s110 , s111 )

y Y/Z Equal Out for each In


Single state where Out=1 for In=0
Equivalency Classes (Example)
1
 ( s 000 ) ( s 001 , s 010 , s 011 ) ( s100 , s101 , s110 , s111 )
2 1
 Equal Out for | r | = 2 g (q1 , σ1σ 2 )  g (q2 , σ1σ 2 )

0 001 000
0 000 000 / 1 4-th 0

0 010 001 s001  s010

0 001 000 / 0 3-rd 0


2
 ( s 000 ), ( s 001 ), ( s 010 , s 011 ), ( s100 , s101 , s110 , s111 )
2 3
3    
 ( s 000 ), ( s 001 ), ( s 010 , s 011 ), ( s100 , s101 , s110 , s111 )
Minimized SM (Example)
q 0 1 1/0
0/1
q1 q1,1 q4,0 1/0
q2 q1,0 q4,0 q1 1/0 q2 0/0 q3 0/0 q4
q3 q2,0 q4,0
q4 q3,0 q4,1
0/0

q1 = s000
q2 = s001
q3 = s010, s011
q4 = s100, s101, s110, s111
Decomposition of Automata
1. Better understanding of the organisation of a system
2. Minimization of parts of the system
Minimization of the complete system is impossible

Decomposition

Serial Parallel

A1
A1 A2
A2
Serial Connection of Automata
A1  (Q1 , 1 , Z1 , f1 , g1 )
A2  (Q2 ,  2 , Z 2 , f 2 , g 2 ) Z1 = 2
1 A1 A2 Z2
 2  Z1 A
A  (Q1  Q2 , 1 , Z 2 , f , g ) A1 - Master
A2 - Slave
f ((q, p), σ)  ( f1 (q, σ), f 2 ( p, σ))
g ((q, p), σ)  g 2 ( p, g1 (q, σ))

A1·A2 = Serial decomposition (A) If A1A2realizes A

Serial decomposition (A) = Non-trivial if | Q(A1·A2) | < | Q(A) |


Serial Decomposition of Automata
D(Q) – Decomposition of Q
Decomposition (A) D(Q)

R  S1, S2 ,..., Sk , Si  Q
R = D(Q) if R = Cover(Q)
S1  S2  ...  Sk  Q, Si  Q, i  1,2,..., k
D(Q) = Allowed D(Q) if   , j  1,2,..., k  f ( Si ,  )  S j

D(Q) = Partition (Q) if Si , and Si  Sj 


Si  Partition (Q) = Block (Partition (Q))
Allowed Partition (Q) = SP-Partition
SP-Partition of States

C = A·B 
QA  q1, A , q2, A ,..., qt , A  QB  q1, B , q2, B , ..., qz , B 
QC  QA  QB
q 1, A , qB , qB  QB ,..., qt , A , qB , qB  QB  is a SP-partition (QC)

A - master B - slave yC – present state of C


A Block ( yC) Z(QC) = SP-partition(QC)
B yC
SP-partition and Factor SM
Known an SP-partition, then master automat is
the factor autmat for this partition
Z(QC) A=C/Z

Number of states in the master automat is


equal to the number of blocks in the partition
| QA | = # Blocks in Z(QC)
  , j  1,2,..., k  f ( Si ,  )  S j QA

Number of states of the slave is equal to the number of


elements in the largest block
| QB | = # Elements of largest Block
Serial Decomposition (Example)

Parity bit for three-bit words Parity(W) |W|=3


Out = 1 if # 1 is odd, else Out = 0
001 011 010 110 111 1…
000 100 000 100 000 1…

q 0 1 Q = {A, B, C, D, E, F, G}
A B,0 C,0 Z(Q) = {(A), (B, C), (D, E), (F, G)}
B D,0 E,0
0 1
C E,0 D,0
D F,0 G,0 (A) P1 P2, P2 P2, P2 g (A) = y
E G,0 F,0 (B, C) P2 P3, P3 P3, P3
F A,0 A,0 (D, E) P3 P4, P4 P4, P4 T(A)
G A,1 A,1 (F, G) P4 P1, P1 P1, P1
Serial Decomposition (Parity Bit)
| Largest block | = 2 | QB | = 2 QB = {q1, q2}
q q1 q2
QC = QA·QB fC = ? gC = ?
P1 A A
P2 B C f((q1, p1), 0)
P3 D E q 0 1
(P1, q1) A A B,0 C,0
P4 F G
B D,0 E,0
fA(A,0) = B C E,0 D,0
D F,0 G,0
gA(A,0) = 0
E G,0 F,0
F A,0 A,0
(P2,q2) B f((q1, p1), 0) = q1
G A,1 A,1
g(q1, p1), 0) = 0
Serial Decomposition (States)

0 1
P1 P2 P3 P4 P1 P2 P3 P4
q1 q1,0 q1,0 q1,0 -,0 q1 q2,0 q2,0 q2,0 -,0
q2 q1,0 q2,0 q2,0 -,1 q2 q2,0 q1,0 q1,0 -,1

T(B)
Parallel Connection of Automata
A1  (1 , Q1 , Z 1 , f 1 , g 1 )
A2  (2 , Q2 , Z2 , f 2 , g2 )
A  A1  A2  (1  2 , Q1  Q2 , Z1  Z2 , f , g )
f ((q1, q2 ), ( x1x2 ))  ( f1 (q1, x1 ), f 2 (q2 , x2 ))
g ((q1, q2 ), ( x1, x2 ))  ( g1 (q1, x1 ), g2 (q2 , x2 ))

A1·A2 = Parallel decomposition (A)

Parallel decomposition (A) = Non-trivial if | Q(A1 ·A2) | < | Q(A) |


Parallel Decomposition of Automata

A1, A2 = Master Two SP-parttions

P1, P2 = SP-partitions (Q) Bi = Block(P1) Bj = Block(P2)

P1·P2 = Partition(Q) Bk = Block(P1·P2) Bk = Bi  Bj

P1 = {(1,2), (3,4,5,6,7,8)} P2 = {(1,2,3,4), (5,6,7)}


P1·P2 = {(1,2(, (3,4), (5,6,7)}
Partitions of the Set of States
If | Block(P(Q)) | = 1, then Partition P = 0-partition (Q)

A = A1·A2 = Parallel decomposition (A) if P1, P2 | P1·P2 = 0

q 0 1 Z P1 = {(1,2,3), (4,5,6)} = {A,B} = {Block(P1)}


1 4 3 0 P2 = {(1,6), (2,5), (3,4)} = {C, D, E} = {Block(P2)}
2 6 3 0
3 5 2 1 q 0 1 Z
q 0 1
4 2 5 0 C E E 0
A B A
5 1 5 0 D C E 0
B A B
6 3 4 0 E D D 1
A(P1) A(P2)
Determination of Outputs

g(q) = g1(Block(P1)(q)) ·g2(Block(P2)(q)) q  Block(Pi)

q=3 g(3) = g1(Block(P1)(3)) ·g2(Block(P2)(3))

g(3) = g1(A) ·g2(E) = 1·1 = 1

q=4 g(4) = g1(Block(P1)(4)) ·g2(Block(P2)(4))


g(4) = g1(B) ·g2(E) = 0·1 = 0

You might also like