Homework 1 Solutions

22C:122, Fall 1998

Douglas W. Jones
  1. What is your E-mail address? (If you have more than one, give the address you'd prefer used for class purposes.)
    The answer depends on who you are!

  2. The Problem: Ignoring questions about I/O or word size, what features that you expect to find on a modern CPU were missing from the instruction set of the CDC 160?
    This machine is lacking many modern features, but the most severe fault appears to be the lack of a subroutine call instruction! This forces programmers to use awkward calling and return sequences.

    The limited addressing modes are of less importance; so long as there is an indirect mode (and the CDC 160 has a few such modes), then it is possible to do arithmetic on a pointer in memory to simulate indexing and other addressing modes. Similarly, the limited register set is not a major problem since low memory is easily used to serve purposes commonly dealt with using registers.

    The lack of any support for byte structure is also annoying; 6 bit bytes are adequate for many applications; 6 was the standard byte size in 1960, and the only support for 6-bit bytes on the 160 is very weak, a 6-bit circular shift.

    The lack of support for extended precision arithmetic is also a problem. There is no easy way to propagate carries to do multiword add and subtract operations.

    The lack of multiply and divide instructions and the lack of floating point support are no surprise on a very small computer. Software routines could easily perform these functions if the other deficiencies of the machine were dealt with.

  3. Here is the truth table for the ALU:
     function A B Cin | F Cout
    ------------------+--------
        000   - -  -  | 0  x     F = 0
                      |
        001   0 0  0  | 1  0     F = A - B
        001   0 0  1  | 0  1
        001   0 1  0  | 0  0
        001   0 1  1  | 1  0
        001   1 0  0  | 0  1
        001   1 0  1  | 1  1
        001   1 1  0  | 1  0
        001   1 1  1  | 0  1
                      |
        010   0 0  0  | 1  0     F = B - A
        010   0 0  1  | 0  1
        010   0 1  0  | 0  1
        010   0 1  1  | 1  1
        010   1 0  0  | 0  0
        010   1 0  1  | 1  0
        010   1 1  0  | 1  0
        010   1 1  1  | 0  1
                      |
        011   0 0  0  | 0  0     F = A + B
        011   0 0  1  | 1  0
        011   0 1  0  | 1  0
        011   0 1  1  | 0  1
        011   1 0  0  | 1  0
        011   1 0  1  | 0  1
        011   1 1  0  | 0  1
        011   1 1  1  | 1  1
                      |
        100   0 0  -  | 0  x     F = A xor B
        100   0 1  -  | 1  x
        100   1 0  -  | 1  x
        100   1 1  -  | 0  x
                      |
        101   0 0  -  | 0  x     F = A and B
        101   0 1  -  | 0  x
        101   1 0  -  | 0  x
        101   1 1  -  | 1  x
                      |
        110   0 0  -  | 0  x     F = A od B
        110   0 1  -  | 1  x
        110   1 0  -  | 1  x
        110   1 1  -  | 1  x
                      |
        011   - -  -  | 1  x     F = -1