1997
1998
1 Performance : calculate CPI of the computer A and B which run the program below. A is faster/slower than B (in percent) ?
this program calculates M x N by repeat adding M, N times.
input M = 3, N = 2, the instruction set is S1.
load
r0 ZERO
mov r0 r3 ;; r3 store the
answer
load r1 M
load r2 N
jmp z exit
loop: add r3 r1
dec r2
jmp nz loop
exit: ...
.data
ZERO 0
M 3
N 2
timing of each instruction (unit in clock)
machine
A B
----------------------
load r M 4
6
mov r r 2
1
jmp c ads
taken 4
6
not taken 3 4
add r r 2
1
dec r 2
1
2 write the truth table of this circuit
OR( AND( a c ) AND( NOT (c ) b ) )
3 translate the following program into an assembly language of
S1 or M6800 or Intel 8086 (choose one).
a = 0
for i = 1 to 10 step 1
a = a + i
4 Micro Architecture : write micro step for the instruction
"compare indirect", cmp r1 ( r2 )
which means : get the value in R1 and compare it with the value
in the memory pointed by R2.
instruction format op:3, r1:3, r2:3, not-use:7
Figure of S1 micro architecture
5 Explain the term "horizontal microprogramming" (you must not write the answer longer than 5 lines)
6 draw the circuit in terms of AND, OR, NOT, FULL-ADDER of the 2 bit carry look ahead adder.
END
Mid term question Computer Organization 1998
Name ___________________________________________ ID ________________
Time 30 min. Do all questions.
1) From the following diagram, write a sequence of data flow that performs
:
Cn + C n-1 + . . . C1 and stores in
C. n = 3.
(Figure diagram of function units connected to registers)
2) Use S1 instruction set and write the following program into S1 assembly
language.
Program scan string to find a null character.
i = 0;3) Add a new instruction to S1 instruction set. Write down the micro-step for the instruction "move immediate to a register". Design the instruction format for this instruction.
while ( s[i] != 0 )
i = i + 1;
mov R1, #value ;; R1 = #value
END