in English suomeksi Study Circle Project

Computer Organization I, Autumn 2005, Study Circle Project PR 1

Report contents are defined in the Study Circle description and the report deadline 27.11.2005 at 23:55. o
  1. Design and implement one (1) practice problem.

    The topic for the practice problem is selected in the following manner:
    1. Take the day part of each participants birt date (E.g., number 5, if you were born 5.3.1988)
    2. Add up all day parts. (E.g., 5+13+8+25 = 51)
    3. Divide by four, take remainder and add one. (E.g., . "51 mod 4" +1 = 3+1 = 4)
    4. use the result to select the lecture numebr for your topic. (E.g., Lecture 4)

  2. Design and implement a ttk-91 program that includes the following parts:
    1. function Alusta(T, n, x, y, z), that initializes a 2D array T[n,n] so, that T[i,j] = i*x + j* y + z;
      1. T is call-by-reference parameter, the others are call-by-value parameters
      2. must have 1 < n ≤ 20, -20 ≤ x ≤ +21, -100 ≤ y ≤ +100 o, -1000 ≤ z ≤ +1000
      3. returns value 0, if all OK, and value ≠ 0, if some problem or error.
        (You can code the problem type into the return value, of you so wish.)
    2. function Tulosta(T, n, i, j), that prints the value of element T[i, j] in 2D-array T[n,n]
      1. T is call-by-reference parameter, the others are call-by-value parameters
      2. must have 1 ≤ n ≤ 20, 0 ≤ i < n, 0 ≤ j < n
      3. returns value 0, if all OK, and value ≠ 0, if some problem or error.
    3. function Summa (T, U, V, n), that computes the element-wise sum T = U+V, so that T[i,j] = U[i,j] + V[i,j]
      1. T, U, V are call-by-reference parameter, the others are call-by-value parameters
      2. must have 1 ≤ n ≤ 20
      3. returns value 0, if all OK, and value ≠ 0, if some problem or error.
    4. main program, where
      1. define 2D arrays A[2,2], B[2,2] and C[2,2] as well as E[5,5], F[5,5] and G[5,5]
      2. initializes with function Alusta() the array A so that A[i,j] = i + 2j + 1
      3. initializes with function Alusta() the array B so that B[i,j] = 2i + 40j - 23
      4. computes with function Summa() the array C so that C = A+B
      5. prints out values A[1,0], B[1,0] ja C[1,0] o
      6. initializes with function Alusta() the array E so that E[i,j] = i + j
      7. initializes with function Alusta() the array F so that F[i,j] = i - j
      8. computes with function Summa() the array G so that G=E+F
      9. reads index values for i and j from the user
      10. checks, that 0 ≤ i < 5 and 0 ≤ j < 5
      11. prints with function Tulosta() the values E[i,j], F[i,j], and G[i,j]
      12. repeats the previous three steps until pair (0,0) is given as input

Follow the recommended subroutine (function) call mechanisms given in the lectures.


Teemu Kerola