Docsity

Modulo 6 Counter: Design and Implementation, Slides of Computer Science

Partial preview of the text

Download Modulo 6 Counter: Design and Implementation and more Slides Computer Science in PDF only on Docsity!

FSM Design & Implementation

CT101 – Computing Systems

FSM Design

• This presentation deals with front to end

design of finite state machines, both Mealy

and Moore types.

• Design example is provided for a modulo 6

counter

Modulo 6 Counter – State table

• For each state examine what

happens for all possible

values of the inputs

  • In state S0 input U can be

either 0 or 1

  • If U=0 the state machine

remains in state S0 and outputs

C=1 and V2V1V0=

  • If U=1 the state machine goes

in state S1, outputs C=1 and

V2V1V0=

• In the same manner, each

state goes to the next state if

U=1 and remains in the same

state if U=

Present State

U Next State

C V2V1V

S0 0 S0 1 000

S0 1 S1 0 001

S1 0 S1 0 001

S1 1 S2 0 010

S2 0 S2 0 010

S2 1 S3 0 011

S3 0 S3 0 011

S3 1 S4 0 100

S4 0 S4 0 100

S4 1 S5 0 101

S5 0 S5 0 101

S5 1 S0 1 000

Modulo 6 Counter - Mealy state diagram

  • The outputs are represented on the arcs as

CV2V1V

FSM Implementation

  • Converting a problem to equivalent state table and state

diagram is just the first step in the design process

  • The next step is to design the system hardware that

implements the state machine.

  • This section deals with the process involved to design the

digital logic to implement a finite state machine.

  • First step is to assign a uniquely binary value to each of the

state that the machine can be in. The state must be encoded

in binary.

  • Next we design the hardware to go from the current state

to the correct next state. This logic converts the current

state and the current input values to the next state values

and stores that value.

  • The final stage would be to generate the outputs of the

state machine. This is done using combinatorial logic. Docsity.com

Assigning State Values

• Each state must be assigned to a unique binary

value; for a machine with n states we have [log 2 n]

bits;

• For the modulo 6 counter example, we have six

states. We will assign state value 000 to S0, 001 to

S1, and so on, up to 101 to S5.

Mealy and Moore Machine

Implementations

  • The current state value is stored into the

register

  • The state value together with the machine

inputs, are input to a logic block (CLC)

that generates the next state value and

machine outputs

  • The next state is loaded into the register

on the rising edge of the clock signal

Mod 6 Counter – Mealy

Implementation

  • The logic block (CLC) is

specific to every system and

may consist of combinatorial

logic gates, multiplexers,

lookup ROMs and other

logic components

  • The logic block can’t include

any sequential components,

since it must generate its

value in one clock cycle

  • The logic block contains two

parts:

  • One that generates the outputs

(f function, CLC1)

  • One that generates the next

state (g function, CLC2)

Generating the Next State

• Since the Mealy and Moore machines must

traverse the same states under the same

conditions, their next state logic is identical

• We will present three methods to generate

the next state logic:

– (i) Combinatorial logic gates

– (ii) Using multiplexers

– (iii) Using lookup ROM

• To begin with, we need to setup the truth

table for the next state logic

Modulo 6 Counter - Next State Logic (i)

  • The system inputs and the

present states are the inputs

of the truth table

  • Next state bits are the

outputs

  • We have to construct a

Karnaugh map for each

output bit and obtain its

equation

  • After that we design the

logic to match the equations

Present State P2P1P

U Next State N2N1N 000 0 000 000 1 001 001 0 001 001 1 010 010 0 010 010 1 011 011 0 011 011 1 100 100 0 100 100 1 101 101 0 101 101 1 000

Modulo 6 Counter – Next State Logic (ii)

  • An alternative approach to design the next state logic is to

use multiplexers.

  • Each input to the multiplexer corresponds to the next state

under one possible value of the system inputs; the inputs

drive the input signals of the multiplexer

  • For the modulo 6 counter, we use the U input to drive the

multiplexer; U is choosing one of two possible next states,

the next state if U=0 and the next state if U = 1

  • To determine the inputs of the multiplexer we begin with

splitting the truth table into multiple truth tables, one for

each possible value of the system inputs

  • Then we follow the procedure we have used to obtain the

next state using combinatorial logic gate

Modulo 6 Counter – Next State Logic (ii)

  • Initial truth table is broken into two tables:
    • One for U=
    • One for U=
  • Create Karnaugh maps from these tables to obtain the equations for

N2, N1 and N0 when U=0 and when U=

Present State P2P1P

Next State N2N1N 000 000 001 001 010 010 011 011 100 100 101 101

Present State P2P1P

Next State N2N1N 000 001 001 010 010 011 011 100 100 101 101 000

U = 0 U = 1

Modulo 6 Counter – Next State Logic (ii)

Next state logic implementation using multiplexers and logic

gates. Please note that using multiplexers simplifies the

combinatorial logic circuitry Docsity.com

Modulo 6 Counter – Next State Logic (iii)

  • Another approach to generate the next state logic for a FSM is to use a lookup ROM.
  • In this approach, the present state values and inputs are connected to the address bus of a ROM; the next state is obtained from the ROM outputs
  • The correct value must be stored in each location of the ROM to ensure proper operation