159.233 Assignment 2 – The Superpico-computer!

Due 26th September 2003
There will be a penalty for late submission.



This assignment is concerned with the design of a microcoded control unit for a simple CPU. The Pico-computer described in the lecture notes has 8 simple instructions. The Superpico-computer also has 8 instructions, as follows:

Opcode

Name

Operand

Description

0

LDA

address

Load byte in memory at address given by operand into the Accumulator

1

ADD

address

Add byte in memory at address given by operand to the Accumulator

2

SUB

address

Subtract byte in memory at address given by operand from the Accumulator

3

STA

address

Store byte in Accumulator in memory at address given by operand

4

JPZ

address

If Accumulator is zero, fetch next instruction from address given by operand

5

JMP

address

Always fetch next instruction from address given by operand

6

JPC

address

If last Add or Sub operation caused a carry, fetch next instruction from address given by operand

7

HLT

none

Stop



An instruction that works well in an OIC is RSSB - Reverse Subtract and Skip on Borrow.

The CPU has 3 registers A, N and MAR the execution cycle is as follows.

  1. Fetch the current instruction into MAR using the address stored in PC.

  2. Add one to PC.

  3. Fetch data from memory at the address given by MAR and put it into N

  4. Perform the operation: A = N - A

  5. Store A in the memory at the address given in MAR

  6. If the subtract caused a borrow then add one to PC

To allow jumps, the program counter always appears to be stored in memory location 0.
To prevent having to read and write to location 0 to modify the PC, it is also stored in a register. This means that when MAR is zero, the PC should be read and written  instead of the memory. The file oic.lgf is available on the H drive and contains a complete datapath and control unit for the OIC. This file contains a simple test program but unfortunately no microcode for the control unit. Your task is to write the microcode so that the machine is as efficient as possible.

The oic contains the following logic devices:

To write the microcode you need to put the microprogram in the two ROMs at the top left of  the OIC. Select "conf" mode and click on a ROM to examine or change it's contents. Read the documentation if you don't know what to do! If your microcode does not work, then it may destroy the test program. If this happens, then you will have to reload the diagram. It is also possible to load and save data in the memory devices

Marks will be awarded for working OICs and also for fast OICs, you may change any of the hardware if you think it will help (get things working first before you try this!). Do not change the test program. The test program should print "Hello World" followed by 2 carriage returns and repeat this forever. If it does not do this, then your microcode does not work.

You will submit a single file containing your design.  No paper submissions will be accepted.


M Johnson 1997