27
Fundamentals of State Machines Satish kashyap. B www.satishkashyap.com

Lecture 2 - Types of State Machines - Design and Analysis

Embed Size (px)

Citation preview

Page 1: Lecture 2 - Types of State Machines - Design and Analysis

Fundamentals of State Machines

Satish kashyap. B

www.satishkashyap.com

Page 2: Lecture 2 - Types of State Machines - Design and Analysis

Every finite-state machine, therefore, contains a finite numberof memory devices, which store the information regarding the past input history.

Page 3: Lecture 2 - Types of State Machines - Design and Analysis
Page 4: Lecture 2 - Types of State Machines - Design and Analysis
Page 5: Lecture 2 - Types of State Machines - Design and Analysis

General Model for Mealy CircuitUsing Clocked D Flip-Flops

Page 6: Lecture 2 - Types of State Machines - Design and Analysis

General Model for Moore CircuitUsing Clocked D Flip-Flops

Page 7: Lecture 2 - Types of State Machines - Design and Analysis

Mealy vs. Moore Machines

• MEALY MACHINE

• Outputs depend on current state and present inputs

• Outputs have immediate reaction to inputs

• As inputs change, so does next state, doesn’t commit until clocking event

• Tend to have less states

• Less hardware

• May not be safer, when interconnecting state machines in asynchronous manner.

• Delay is less

• MOORE MACHINE

• Outputs depend on current state only

• Outputs have no immediate reaction to inputs , they always change one cycle later

• As inputs change, so does next state, doesn’t commit until clocking event

• Tend to have more states

• More logic (hardware) may be necessary to decode state into outputs

• Moore Machines are safer to use, when two machines are interconnected – asynchronous feedback

• Delay is more

Page 8: Lecture 2 - Types of State Machines - Design and Analysis

• Recognize– Mealy or Moore ?

D Q

QB

A

clock

out D Q

Q

D Q

Qclock

outA

B

D Q

Q

D Q

Q

A

B

clock

out

D Q

Q

D Q

Q

D Q

Q

D Q

Q

A

B

clock

out

Page 9: Lecture 2 - Types of State Machines - Design and Analysis

• Recognize– Mealy or Moore ?

Page 10: Lecture 2 - Types of State Machines - Design and Analysis

the output value of the serial adder cannot be specified merely in terms of theexternal input values

Page 11: Lecture 2 - Types of State Machines - Design and Analysis

Let A designate the state of the adder at ti if a carry 0 is generated at ti−1,and let B designate the state of the adder at ti if a carry 1 is generated at ti−1.

Each row of the state table corresponds to a state of the adder, and eachcolumn to a particular combination of the external input values x1 and x2. Eachentry of the table denotes the state to which a transition is made and the outputvalue associated with this transition.

Page 12: Lecture 2 - Types of State Machines - Design and Analysis

state diagram (or state graph)

alternate to the state table.

Clearly, both the state diagram and state table provide the same information regarding the operation of the adder, and one can be obtained directly from the other.

Page 13: Lecture 2 - Types of State Machines - Design and Analysis

The state of the delay element is specified by the value of its output y, which may assume either of two values, namely, y = 0 or y = 1.

Since the current input value Y of the delay is equal to its next output value, the input value is referred to as the next state of the delay, i.e, Y (t ) = y(t + 1).

y = 0 is assigned to A and y = 1 to B, the value of y at ti will correspond tothe value of the carry generated at ti−1.

The process of assigning the states of a physical device to the states of the serial adder is known as state assignment.

The output value y is referred to as the state variable , to distinguish it from the external primary input variables.

Page 14: Lecture 2 - Types of State Machines - Design and Analysis

A transition table is derived from a state table by the replacement of eachnext-state entry with the corresponding state of memory elements.

Page 15: Lecture 2 - Types of State Machines - Design and Analysis
Page 16: Lecture 2 - Types of State Machines - Design and Analysis

Design a one-input one-output sequence detector that produces anoutput value 1 every time the sequence 0101 is detected and an output value0 at all other times.

State diagram for a sequence (0101) detector.

Page 17: Lecture 2 - Types of State Machines - Design and Analysis

State diagram for a sequence (0101) detector.

Page 18: Lecture 2 - Types of State Machines - Design and Analysis

Output and excitation K-maps.

Page 19: Lecture 2 - Types of State Machines - Design and Analysis

Logic diagram of a sequence detector.

Page 20: Lecture 2 - Types of State Machines - Design and Analysis

The state assignment employed in Table 9.8 is not the only possible one.

Page 21: Lecture 2 - Types of State Machines - Design and Analysis

CIRCUIT DIAGRAM ….. ?

Page 22: Lecture 2 - Types of State Machines - Design and Analysis
Page 23: Lecture 2 - Types of State Machines - Design and Analysis
Page 24: Lecture 2 - Types of State Machines - Design and Analysis

Schematic diagram of a modulo-8 binary counter with T flip-flops.

Page 25: Lecture 2 - Types of State Machines - Design and Analysis
Page 26: Lecture 2 - Types of State Machines - Design and Analysis

Some more Examples

• Parity bit generator from ( kohavi )• Parity checker ( Roth )• Analyze different state machine block diagrams to draw their state

table or state diagram ( Roth )

Page 27: Lecture 2 - Types of State Machines - Design and Analysis