COMPUTER ARCHITECTURE
Spring Semester 2001

COMPUTER ARCHITECTURE - Spring 2001 Programming Assignments
(NOTE: Additional guidelines for each program will be provided in class.)
  1. PROG #2: SISD MACHINE ORGANIZATION - Simulating the von Neumann Architecture
    Write a program in Java that simulates the ALU (Arithmetic Logic Unit)
    portion of the standard von Neumann machine. Provide the ALU with six standard
    functions: LOAD N (AC = N), ADD N (AC = AC + N), OR N (AC = AC OR N),
    AND N (AC = AC AND N), NOT (AC = NOT(AC)) and STORE N (N = AC), where AC is
    the current value in the Accumulator, and N is a location in an array of characters
    called "Main Memory" that is already initialized.
    Consider the following example:
    Initial Main Memory M[10]      Program       Action        Accumulator (binary) 
    Address   Contents             LOAD 0        AC ="A"         01000001 
     0          "A"                OR  1         AC = AC | "B"   01000011
     1          "B"                AND 2         AC = AC & "C"   01000011 
     2          "C"                NOT           AC = ~(AC)      10111100 
     3 ... 9    "\0" (0)           ADD 0         AC = AC + "A"   11111101 
                                   STORE 3       M[3] = AC       11111101 (also in 3 now)
    
    The program that causes the accumulator to work should be read from a file
    with one instruction on each line. The output should print the binary value
    in the accumulator after each instruction is executed, since many of the
    possible values will not be printable characters.