L 9 State Assignment and gate implementation States

  • Slides: 23
Download presentation
L 9 – State Assignment and gate implementation

L 9 – State Assignment and gate implementation

States Assignment o Rules for State Assignment Application of rule Gate Implementation o Ref:

States Assignment o Rules for State Assignment Application of rule Gate Implementation o Ref: text Unit 15. 8 o o 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 2

Rules for State Assignment o o o Situation: You have arrived at the reduced

Rules for State Assignment o o o Situation: You have arrived at the reduced state table and no further state reduction can be made. Does it matter how you assign the binary encoding to the states – YES!!! But how to do it!!! 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 3

Guidelines for State Assignment o o o o To try all equivalent state assignments,

Guidelines for State Assignment o o o o To try all equivalent state assignments, i. e. , and exhaustive exploration of all possible state assignments. This is a n-p complete problem. Do not panic!!! (where does this come from? ) There are guidelines that help 1. States which have the same next state for a given input should be given adjacent assignments. 2. States which are the next states of the same state should be given adjacent assignments. And third 3. States which have the same output for a given input should be given adjacent assignments. 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 4

The starting state o Assign the starting state to the “ 0” square on

The starting state o Assign the starting state to the “ 0” square on an assignment map. (An assignment map looks much like a K-map for logic minimization. ) 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 5

Reason for assign “ 0” o Reasons for assigning “ 0” as the starting

Reason for assign “ 0” o Reasons for assigning “ 0” as the starting state: n n The clear input on Flip Flops can be used for initialization. The clear input can also be used on a reset. The alternative is error prone – using a combination of preset and clears to set a specific value can lead to implementation errors. A good practice even when using FPGAs. 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 6

Guidlines o o Adjacency conditions from Guideline 1 and those from Guideline 2 that

Guidlines o o Adjacency conditions from Guideline 1 and those from Guideline 2 that are required 2 or more times should be satisfied first. Example – Guideline 1 for the table S 0, S 2, S 4, and S 6 should be made adjacent as they all have S 1 as the next state on a 0 input. S 3 and S 5 should have adjacent assignment. S 4 and S 6 should have adjacent assignment. 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 7

Using guidelines o From the state table find the following groupings: n n 1.

Using guidelines o From the state table find the following groupings: n n 1. (S 0, S 1, S 3, S 5) (S 4, S 6) (S 0, S 2, S 4, S 6) 2. (S 1, S 2) (S 2, S 3) (S 1, S 4) (S 2, S 5)2 x (S 1, S 6)2 x 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 8

Two possible ways of satisfying the guidelines are: n n 1. (S 0, S

Two possible ways of satisfying the guidelines are: n n 1. (S 0, S 1, S 3, S 5) (S 4, S 6) (S 0, S 2, S 4, S 6) 2. (S 1, S 2) (S 2, S 3) (S 1, S 4) (S 2, S 5)2 x (S 1, S 6)2 x 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 9

Next state maps o o Next state maps may help choose the better assignment.

Next state maps o o Next state maps may help choose the better assignment. Look at the next state given current state and input and how this will simplify K-maps for logic. 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 10

Choose an assignment o o Choose an assignment and implement in gates. Using the

Choose an assignment o o Choose an assignment and implement in gates. Using the left assignment map get the next state map below with encoding. Map the encoding to K-maps 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 11

Implement in gates o Notes on implementation n n All F/F outputs are used

Implement in gates o Notes on implementation n n All F/F outputs are used 6 gates are needed for next state generation only 1 of which is 3 inputs. 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 12

Another example o Example 15 -16 in text n n Use guidelines Next states

Another example o Example 15 -16 in text n n Use guidelines Next states (b, d) (c, f) (b, e) (a, c) Next state of a state (a, c)2 x (d, f) (d, b) (b, f) (c, e) But is state table minimum? 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 13

Assignment map o o State table is not minimum but will continue The two

Assignment map o o State table is not minimum but will continue The two assignment maps are 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 14

Transition table o Resulting in a transition table of and equations of 9/2/2012 –

Transition table o Resulting in a transition table of and equations of 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 15

Next state generation K-maps o The K-maps for next state generation are 9/2/2012 –

Next state generation K-maps o The K-maps for next state generation are 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 16

Another example o From our previous work. 9/2/2012 – ECE 3561 Lect 9 Copyright

Another example o From our previous work. 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 17

Use guidlines o Same next state n o (S 0, S 1, S 5)

Use guidlines o Same next state n o (S 0, S 1, S 5) (S 2, S 4) (S 0, S 2, S 4) (S 1, S 3, S 5) Next state pairs n (S 1, S 4) (S 1, S 2)2 x (S 3, S 4)2 x (S 2, S 5) 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 18

The assignment map o o Choose S 0 as the “ 0” state and

The assignment map o o Choose S 0 as the “ 0” state and then use guidelines A possible solution 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 19

Next State Table o o Enter the state assignment onto the table Then generate

Next State Table o o Enter the state assignment onto the table Then generate K-maps and generate logic 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 20

The K maps o Generate the K maps n Next State logic A (2

The K maps o Generate the K maps n Next State logic A (2 gates) B (1 gate) C (2 gates) 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 21

K map for the output Z o o o 3 gates for the output

K map for the output Z o o o 3 gates for the output (2 -3 input AND) (1 OR) Total logic count n n n 3 D F/Fs 2 – 3 input AND gates 3 – 2 input AND gates 2 – 2 input OR gates 1 – 3 input OR gate 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 22

Lecture summary o Have seen several examples of implementation from the statement of the

Lecture summary o Have seen several examples of implementation from the statement of the problem (specification) to implementation. 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne De. Groat, ECE, OSU 23