Arithmetic Instructions Option for Term Project

CS-350: Computer Organization

© 1999 Charles Abzug

 

 

NOTE that your term paper, as well as your slide presentation, must describe in detail your test data, as well as the rationale for your selection of test data.

Multiplication Instructions:

Write a Beboputer Assembly Language program to carry out the functions implied by each of the C language statements listed below. In each case:

      1. define memory locations to hold both the input values that the program needs to execute and the output values;
      2. treat all input variables as double-precision numbers (i.e., as two-byte integers), and make the output variables as big in terms of multiple-precision as they need to be to hold all possible outputs;
      3. code the entire program yourself, i.e., do NOT make use of the subroutines packaged with the Beboputer simulator; and
      4. design sets of test data that can be used to ascertain whether or not your program is functioning correctly, load each set of test data into your input locations using either the hex keypad or the Memory Walker, run your program with the test data, read your results from the Memory Walker, and record them. You are not required to perform any output operations, such as outputting the result of the arithmetic operation to the LED display.
      5. For each set of test data on which you run your program, examine and also record the contents of the Status Register (Z, N, C, and V bits only).

  1. B = A * 1610; (Two's-Complement arithmetic)
  2. B = A * 2310; (Two's-Complement arithmetic)
  3. C = A * B; (Two's-Complement arithmetic, but with input variable B only single-precision)

 

Array-Processing Instructions:

Write a Beboputer Assembly Language program to carry out the functions implied by each of the C language statements listed below. In each case:

      1. define memory locations to hold both the input values that the program needs to execute and the output values;
      2. treat all input variables as triple-precision numbers (i.e., as three-byte integers), and make the output variables as big in terms of multiple-precision as they need to be to hold all possible outputs;
      3. code the entire program yourself, i.e., do NOT make use of the subroutines packaged with the Beboputer simulator; and
      4. design a set of test data that can be used to ascertain whether or not your program is functioning correctly, load each set of test data into your input locations using either the hex keypad or the Memory Walker, run your program with the test data, read your results from the Memory Walker, and record them. You are not required to perform any output operations, such as outputting the result of the arithmetic operation to the LED display.

For (I=1; I<=N; I++)

C[I] = A[I] + B[I]; (A, B, and C are to be related to each other by the rules of Two's-Complement arithmetic.)

N can have any appropriate value within the limits that can be stored in one byte.

Structure your program as a main routine to execute the loop, and a separate subroutine, called from the main program, that performs the calculation for each loop iteration.

During each loop iteration, determine what should be the correct values for the four status flags (Z, N, C, and V), and record them as they would appear in the Status Register in the form of an array D[I].