9
Lecture X Algorithmic State Machines

Algorithmic State Machines. 1) Create an algorithm, using pseudocode, to describe the desired operation of the device. 2) Convert the pseudocode into

Embed Size (px)

Citation preview

Page 1: Algorithmic State Machines.  1) Create an algorithm, using pseudocode, to describe the desired operation of the device. 2) Convert the pseudocode into

Lecture XAlgorithmic State Machines

Page 2: Algorithmic State Machines.  1) Create an algorithm, using pseudocode, to describe the desired operation of the device. 2) Convert the pseudocode into

159.233 Computer Architecture

1) Create an algorithm, using pseudocode, to describe the desired operation of the device.2) Convert the pseudocode into an ASM chart.3) Design the datapath based on the ASM chart.4) Create a detailed ASM chart based on the datapath.5) Design the control logic based on the detailed ASM chart.

State Machine Design Steps

Page 3: Algorithmic State Machines.  1) Create an algorithm, using pseudocode, to describe the desired operation of the device. 2) Convert the pseudocode into

159.233 Computer Architecture

ASM Charts

Command lines (outputs), listed in the square boxes,

are true (1) when the controller is in that

state false (0) otherwise.

Outputs listed in rounded boxes are only asserted if

that path is taken

Status lines (inputs) are tested in diagonal boxes.

The two paths leading away from the test will be labeled with either T or F.

Page 4: Algorithmic State Machines.  1) Create an algorithm, using pseudocode, to describe the desired operation of the device. 2) Convert the pseudocode into

159.233 Computer Architecture

Each state starts in a square box and lasts until you reach the next square box

Everything within a state happens simultaneously

ASM Charts

The state machine goes from one state to another on the tick of a clock

Page 5: Algorithmic State Machines.  1) Create an algorithm, using pseudocode, to describe the desired operation of the device. 2) Convert the pseudocode into

159.233 Computer Architecture

ASM Charts

Page 6: Algorithmic State Machines.  1) Create an algorithm, using pseudocode, to describe the desired operation of the device. 2) Convert the pseudocode into

159.233 Computer Architecture

How to implement an State Machine?1. Use a register to store the present state number2. Use some combinatorial logic to calculate what the next state should be.3. On the tick of the clock transfer that new state into the register4. repeat indefinitely

Finite State Machine

Page 7: Algorithmic State Machines.  1) Create an algorithm, using pseudocode, to describe the desired operation of the device. 2) Convert the pseudocode into

159.233 Computer Architecture

Which state will it start in?◦ To make sure we don’t start in a state that could lead to

self-destruction, we make sure we always start in state 0◦ Hold ‘Reset’ line asserted when power is first applied,

deasserting Reset only after a little time has elapsed

Finite State Machine

Page 8: Algorithmic State Machines.  1) Create an algorithm, using pseudocode, to describe the desired operation of the device. 2) Convert the pseudocode into

159.233 Computer Architecture

Pseudocode:

Bit-counter example

Page 9: Algorithmic State Machines.  1) Create an algorithm, using pseudocode, to describe the desired operation of the device. 2) Convert the pseudocode into

159.233 Computer Architecture

Design datapath Need a n-bit left-to-right shift register with parallel load

and Enable signals Need a log2n-bit counter with parallel load and Enable A n-input NOR gate to tell when A=0.

Bit-counter example