Docsity

Control Unit and Finite State Machines in Digital Systems, Exercises of Digital Systems Design

Partial preview of the text

Download Control Unit and Finite State Machines in Digital Systems and more Exercises Digital Systems Design in PDF only on Docsity!

Control UnitControl

Unit

-^ Binary information in a digital system such as^ microprocessor can be classified as either dataor control information. •^ Data is manipulated in a datapath by micro-operations. •^ These operations are implemented with adders/ subtractors, shifters, registers, multiplexers^ and buses.•^ Control Unit provides signals that activates

p^

g

various operations in the datapath.

Control UnitControl

Unit

-^ Control Unit is a sequential circuit with statesth t di t t

t^

l^ i^ l

f^ th

t

that dictate control signals for the system.• At a given time, the state of the sequential circuit activates the prescribed set ofoperations. • Using Status Signals, Control inputs and itscurrent state, Control Unit determines its nextt t^

hi h th

i^

t^ l^ i^

l

state which then gives new control signals.

Control Signals

CONTROL UNIT

DATAPATH

Status Signals

ControlSignals

DataOutputs

ControlOutputs

DataInputs

Types of ControllersTypes

of Controllers

-^ Controllers are of two types:^ ¾^ Hardwired Finite State Machine based Controllers ¾^ Hardwired

Finite State Machine based Controllers. ¾^ Micro-programmed Architecture based Controllers. • Hardwired FSM:

N

¾^ FSM is a sequential system with N Flip-flops and has 2

N

possible states, so the number od possible states is

finite_._

¾^ FSM can be described using Bubble Diagrams (StateDiagrams) or Algorithmic State Machine Charts (ASM)Diagrams) or Algorithmic State Machine Charts (ASM). • Micro-programmed Control Unit: ¾^ The control units binary control values are stored as

y words in a ROM. ¾ Each word in the control contains a micro-instruction. ¾ A sequence of micro-instructions constitutes a micro-q program. • We will be considering only State Machine based Controllersdescribed using State Diagrams.

g^

g

Finite State Machines: DesignA^

h

Approach •^ Observe and clearly understand the given specifications^ of the State Machine.•^ Obtain an abstract specification of the FSM. •^ Choose a State Machine Type and Perform necessaryState minimization.D^

St t^ Di

b

d^

th^

ifi^ ti^

d

-^ Draw a State Diagram based on these specifications andperform necessary State Assignment.•^ Choose FF type to implement FSM state register•^ Choose FF type to implement FSM state register.•^ Implement the FSM.

FSMs: Synthesis with Verilog

y^

g

-^ Main bodies^ ¾^ Ports and internal signals : input, output, clock, reset, curr_state,next_state.

_ ¾ State codes : specified as parameters for readability ¾ Next state logic : sensitive to changes in inputs and the currentstate signals (largest block in the FSM). (*) But, the state is notchanged here but in the state registerschanged here, but in the state registers. ¾ State change : the state is changed on the active edge of theclock. ¾ Output logic : sensitive to the current state or state/input, and

NextState^

¾^ Output

logic : sensitive to the current state or state/input, andsets/resets output signals.

always @^ ( curr_state

or^ in1^ or^ in2 ) begin

always @ (posedge

clock ) begin

StateLogic

Statechange

begincase ( curr_state

St0:.. .St1:.. .St2:^ begin if (

in1 )

g curr_state = next_state; end l @ (^

t t^ i 1 OutputLogic

St2:^ begin if (

in1 )^ next_state=St0; else^ next_state=St1; end default:^ next state=St0;

always @ (

curr_state^ or

in or^ in2.. .)^ beginif ( curr_state=St

t1 1’b Logic

default:^ next

_state=St0; endcaseend

out1=1’b1;^ else^ out1=1’b1;^ end

Finite State Machines: TypesFinite

State Machines: Types Moore Machine

Mealy Machine

Combinational
Combinational

Inputs^

Outputs Inputs

Logic^
Logic

FFs

FFs

Nextstate Presentstate

Presentstate

Nextstate

sstate

state

O t^ t

state^

state

CombinationalLogic

Outputs

Finite State Machines: Example^ •^ Count four ones coming out on a serial line?^ ¾^ M

l^ M^

hi

Finite

State Machines: Example ¾ Mealy Machine

0/0 St0St0^ St St^

St St

St^

Finite State Machines: ExampleFinite

State Machines: Example

¾^ Moore Machine

(^00) St0/

1 St1/ St4/

St2/ St3/

Our Processor : Abstract Model

IDLE
ADD

JMP<i^ di

Each^

State^

is

connected

to^ each

other state

ADD

other^ state. SUB

JMP

ADDI
BEQ
SUBI
BNEQ
LD
ST

docsity.com