
Page 1
University of California, Berkeley
College of Engineering
Computer Science Division
Electrical Engineering and Computer Science Department
Computer Science 150 R. H. Katz
Fall 2000
Problem Set #10/11 (Assigned 16 November, Due 1 December)
1. Introduction
Your task is to complete the high level design of a very simple 4-bit computer. This will involve designing
the datapath and a control state machine to the state diagram level to implement the instruction set. This is
a very good example of the kind of comprehensive question you can expect to find on the final examina-
tion.
The machine has a single accumulator (R0), a single bit carry register (C), four general purpose registers
(R0, R1, R2, R3), four accumulator oriented instructions (COMP, INC, CLC, ADC), three register-register
instructions (ADD, AND, XFER), two register-memory instructions (LOAD, STOR), and a conditional
branch instruction (BRN). These instructions are encoded in from one to three 4-bit instruction parcels.
The machine can address 256 x 4-bit words.
2. Instruction Set
Instructions are encoded in from one to three 4-bit words. Arithmetic instructions are encoded in a single
word: two opcode bits (X3X2) and two operand bits (X1X0). All arithmetic instructions use R0 as an accu-
mulator. The C register receives the carry-out of all 4-bit additions. The operand bits specify one of the four
on-chip registers. The COMP, INC, CLC and ADC instructions involve the Accumulator and Carry regis-
ters only, and use the operand bits to encode the four different operations.
Arithmetic Instructions
Op Code (Binary) Op Code (Symbolic) Function
00 X1X0ADD C, R[0] ← R[0] + R[X1X0]
01 X1X0AND R[0] ← R[0] AND R[X1X0]
10 00 COMP R[0] ← ~R[0]
10 01 INC C, R[0] ← R[0] + 1
10 10 CLC C ← 0
10 11 ADC C, R[0] ← R[0] + C
An opcode of 11 represents an extended instruction, and the remaining two bits of the word specify one of
the four remaining instructions. An instruction word of 1100 encodes a register transfer instruction. The
operands are encoded in the following word: the high order two bits identify the destination register, while
the low order two bits identify the source.
Register Transfer Instruction
Op Code (Binary) Op Code (Symbolic) Function
1100 Y3Y2Y1Y0 XFER R[Y3Y2]
← R[Y1Y0]
The remaining three instructions are encoded in three 4-bit words: 1 word for the extended op code, and
two words to identify the target address (memory extends from location 0 through location 25510).