Controller Description

A single Programmable Logic Array handles all control signals for the CPU. The PLA uses a two-phase clock (LINK) to avoid races, where inputs are read on clockA and outputs change with clockB. There are 14 states, 10 inputs, and 29 outputs.

States

There are basically two loops in normal PLA execution. The first is used to load instructions into data memory. The second executes those instructions.
Loading Mode
Due to pin limitations, we could not read all 8 bits of an instruction at once. Therefore, two passes are used: first the opcode is loaded into the lower bits of a buffer register, then the 4-bit opcode is stored to the upper bits of this register. In the next cycle, this entire instruction is copied into an 8-bit memory location. Finally, the Program Counter (PC) is incremented to indicate where the next instruction will be stored. Then the PLA returns to a WAIT state until the next opcode is ready; when the user has the desired bits at the input pads, she asserts the ENTER signal to trigger the PLA.

Execution Mode
The PC asserts a flag when its value is 10012, indicating that 10 instructions have been loaded and causing the PLA to move into its instruction-execution loop. In EXECUTION mode, 4 stages are repeated: Instruction Fetch, Instruction Decode, Operand Fetch, and Execution.

IF takes three cycles, first to put the desired instruction into a buffer register, the to move the low bits of that into the IR, which holds the opcode, and finally, the upper 4-bit operand is moved into the TP register. ID determines if the instruction requires a memory access, in which case the address of the data must be moved to the MA to address Data Memory. Otherwise, the instruction moves directly into the execution stage. If it is an ALU instruction that requires and operand from memory, the operand is fetched using the address that was loaded into the MA in the previous stage. Finally, all the preliminary work has been done, the instruction is Executed.

The instruction execution loop continues until a RIP instruction is decoded, signifying that new instructions are to be loaded into the IM, returning the PLA to Loading Mode.

Other States
A HALT instruction indicates program completion and sends the PLA to a Halt state.
The only other ways to break out of the loops are due to errors. Segmentation Faults can occur either on IM or DM accesses. If an instruction branches to an invalid address, or there is no RIP or HALT at the end of an instruction block, the PLA will attempt to fetch an instruction from a memory location that does not exist. Additionally, an error could occur if an operand is attempted to be fetched from a non-existent data location. Note that all of these errors are due to problems in the software.
There could potentially be a problem loading more than ten instructions, but should not occur if the hardware is functioning correctly.
Once in a Fault or Halted state, the PLA must be restarted.

Inputs

Two of the PLA inputs come from the user. RESTART initializes the PLA and ENTER indicates that an input nibble is ready to be stored in the IM buffer register.
The rest of the inputs come from the CPU hardware. The PC sends signals both that it has completed loading 10 instructions and that it contains an illegal address. The MA similarly has a signal to indicate out-of-bounds access. The ALU's ZEROFLAG is used by the PLA to determine branch behavior. Finally, the instruction opcode is input to the PLA in order to decode the instruction and assert the appropriate control signals.

Outputs

The outputs of the PLA control every aspect of the CPU that needs to happen at a particular instant in time. This includes clearing registers at the beginning of execution, enabling registers to drive the bus such that only one is driving at any moment, and loading registers so they receive the correct data.
Additionally, the PLA has outputs that are used for debugging and program profiling purposed. These are brought to the pads so that users may know what whether the PLA is in Loading Mode, in a Halted state, or has branched.


This is a Group Project for Elec422.
Members:
Rebecca Ma | Jill Nelson | Deborah Watt

Back to Table of Contents