LMU ☀️ CMSI 2210
COMPUTER SYSTEMS ORGANIZATION
Exam 2

The test is open-everything with the sole limitation that you neither solicit nor give help while the exam is in progress.

ProblemYou gotOut of
115
210
310
410
510
610
715
810
910
TOTAL100
  1. Write the following using NAND operators only:
    1. $A + B$
    2. $A \oplus B \oplus C$
    3. $0$
    4. $ABCD + \overline{C}$
    5. $A\overline{B} \oplus \overline{B + C}$
  2. Write a logic formula of three variables, $A$, $B$, and $C$, that has the value 1 if and only if exactly one of the three variables is a 1.
  3. In logic there is an operation called material implication, defined as follows: $A \supset B$ if and only if there is no way that $B$ can be false when $A$ is true. Express $A \supset B$ in two different ways: (1) using only the NOT and OR operators, and (b) using only the NOT and AND operators.
  4. Suppose that memory address 8 contains the value 0xFFFFFFFF. What does this code fragment do? Don't explain individual instructions; explain at a high level what the overall effect of the code fragment is.
        XOR   8
        SUB   8
    
  5. On the simple computer, explain (at a high level) what happens to the accumulator if the following seven statements are executed in sequence:
        STORE 20
        STORE 21
        ADD 20
        ADD 20
        STORE 20
        ADD 20
        ADD 21
    
  6. Show the machine language for the following simple computer assembly language:
        X:    LOAD Y
              9023
        Z:    -70
              JGZ 9
              JLZ X
              MOD Z
        Y:    XOR X
    
  7. Write a complete program for the simple computer reads successive integer values from port 5, until the value read is a zero, and then writes the average of the nonzero values to port 10.
  8. One of the freshmen decided to "extend" the instruction set of the simple computer by adding sixteen new instructions, while keeping the basic word size of the machine 32 bits. How would such an extension affect the architecture of systems using this extended instruction set machine? (Hint: Think about memory and ports.)
  9. Suppose we wanted to write an assembly language that first read in a value from port 30, call it $n$, and then read in $n$ integers from port 31, storing them in successive memory locations starting at memory location 100. Can we do this on the simple computer? If so, give a program. If not, explain why not, and propose a new instruction (or instructions) for the computer that would enable it to be done.