Paper and Pencil Computer

Basic structure:
In the diagram of a computer, this one has only four components:

  1. Inputs - only a keyboard
  2. CPU - a really simple one, but we will look at it in detail
  3. Outputs - only a monitor
  4. Primary storage - 32 bytes of RAM (not 32MB!)
  5. Secondary storage - well, something had to go. No secondary storage.

ppcarchb.gif (5103 bytes)

The CPU:
The Central Processing Unit has two parts; the Control Unit and the the Arithmetic and Logic Unit. The Control unit follows the same cycle, time after time, but very quickly. Here is the basic cycle (the "Master Diagram"):

ppcmstr.gif (5111 bytes)

When the Control Unit fetches an instruction, it gets the value from memory and places it in the Instruction Register (IR). The memory fetch gets one byte, so the IR is one byte. Here is how it is used:

ppcir.gif (2116 bytes)

There is another number contained in the Program Counter (PC). When the Control unit goes to fetch an instruction, it fetches the contents from from the memory location at the address contained in the PC.

Next, the Arithmetic and Logic Unit, or ALU. This has the logic gates that do the arithmetic. It contains the Accumulator (AC). This is location in which the CPU does all of its arithmetic.

 

 

 

 

 

Instruction Set:
A CPU's Instruction Set is the collection of all of the instructions it can execute or carry out. Each CPU has it's own instruction set. Here is the instruction set for the Paper and Pencil Computer.

Mnemonic Operation Code What the instruction does
ADD 001 Add the contents of the Referenced Memory Location (RML) to the current value in the accumulator (AC). This sum replaces the value in the Accumulator. The contents of the RML are not changed.
SUB 010 Subtract the contents of the Referenced Memory Location (RML) from the current value in the accumulator (AC). This difference replaces the value in the Accumulator. The contents of the RML are not changed.
LOAD 011 Load a copy of the contents of the Referenced Memory Location (RML) into the Accumulator (AC). This replaces the previous value in the AC, but leaves the contents of the RML unchanged.
STORE 100 Store a copy of the contents of the Accumulator in the Referenced Memory Location (RML). This replaces the previous value in the RML, but leaves the contents of the AC unchanged.
READ 101 Read a value from the Keyboard (make up a number between 0 and 255) and store the value in the Referenced Memory Location (RML). This replaces the previous value in the RML.
DISPLAY 110 Display the contents of the Referenced Memory Location (RML) on the monitor screen. This leaves the contents of the RML unchanged.
JUMPIF 111 If the contents of the Accumulator (AC) are greater than zero, load the address of the Referenced Memory Location (RML) into the Program Counter (PC). This forces the program to jump to the RML on the next instruction. The contents of the AC are unchanged.
STOP 000 Halt the execution of the program. This is the end.