Finite State Machine Model of the ALU Control Logic



Overview

The high-level state machine of the ALU is straightforward and simple. Many related states can be collapsed, letting simple control logic, based on the unique opcodes, run the finer details of each operation. For example, all two-operand operations other than multiplication follow the same path through the ALU. Various control signals must be asserted along the way during state transitions to guide the particular operations.

Originally, we intended for the control logic to have one READY signal, which it would assert when it was ready for a new opcode. If it saw an opcode that it did not recognize, it would assert an ERROR signal and continue to wait for a valid opcode. Otherwise, it would latch A on the next cycle and B on the cycle after that. After some consideration, it was decided that while this might be a most efficient implementation in an integrated environment where all the subsystems are working together perfectly, it might make testing and debugging on a workbench difficult. We decided to use pairs of READY signals and STROBE to make it possible to slow down the effective operation of the chip without slowing down the clock.

On each cycle where the ALU is waiting for an input, the control logic will present a prompt through the two READY signals. It will wait until it sees the appropriate response on the STROBE signals, and then it will latch the input on the next cycle. The table below shows the prompts and expected responses for each input.

input READY1.READY0 prompt STROBE1.STROBE0 response
opcode 11 11
A 01 01
B 10 10


State Enumeration


State Transition Table and Diagram

Each row in the table represents a particular operation's transitions through the ALU, ignoring any polling loops. The column represents the current state and the cell represents the next state. All operations are assumed to start in state idle. For example, an addition operation starts in state idle, moves to state loada, then loadb, then back to idle. If it is ever in any other state, a significant error has occurred.

State transition table
idle loada loadb mult1 mult2 mult3 mult4 mult5 mult6 mult7 mult8
single-operand loada idle
multiply loada loadb mult1 mult2 mult3 mult4 mult5 mult6 mult7 mult8 idle
other double-operand loada loadb idle
unknown opcode loada idle

State transition diagram


Control Logic Description File

The control logic of the ALU is implemented using a script called platool to build a magic file from a text file (called a meg file). The meg file contains a description of the finite state machine that should be implemented by the resulting PLA. Our meg file implements the finite state machine described above.

Credits