Computer Architecture, Solved Problems
Computer Architecture, Solved Problems
Computer Architecture, Solved Problems
v.01 2018/19
1. Minicomputers in the eighties (eg. DEC PDP-11) had 18 address signals and of course, the 18-bit address
bus. Answer the following questions:
Solution:
2. Write down a signed decimal number with a value of -25 in 8-bit fixed point presentation in each of the
four 8-bit modes for the presentation of signed numbers. Do the same also with the number 33. Write
resulting presentations as binary and hexadecimal numbers. Consider, how to perform addition of these
numbers in binary form for each presented mode.
addition: it is necessary to take into account the sign => additional complexity...
b) the presentation with offset
𝑉(𝑏) = ∑𝑛−1 𝑖
𝑖=0 𝑏𝑖 2 − 2
𝑛−1
tudi (2𝑛−1 − 1) -128 .. 127 (-127..128)
addition: the result includes two offsets, so one offset has to be subtracted separately
c) ones’ complement
𝑉(𝑏) = ∑𝑛−1 𝑖 𝑛
𝑖=0 𝑏𝑖 2 − 𝑏𝑛−1 (2 − 1) -127 .. 127
25(10) = 11001(2)
addition: in case of carry from place n-1 , 1 has to be added to result; on the other hand, sign bit can
be treated the same as the other (value) bits ...
d) two's complement
𝑉(𝑏) = ∑𝑛−1 𝑖 𝑛
𝑖=0 𝑏𝑖 2 − 𝑏𝑛−1 (2 ) -128 .. 127
25(10) = 00011001(2)
11100110(2)
+00000001(2)
=11100111(2)
4,75(10) = 100,11(2)
s=0
m = 1,0011
exp = 2
IEEE 754:
s exp+127 m
1 8 23
s=0
mantissa it always in a form of 1, ???, the implicit bit (1,) is not part of the presentation:
m = 0011
s=0
exp+127=10001001(2) =137,
therefore exp=10 , m=1,111101011 (2)
2^0*m*2^exp
1*1,111101011*2^10
11111010110 (2) = 2006 (10)
4. We want to compare the computers R1 and R2, which differ that R1 has the machine instructions for the floating-
point operations, while R2 has not (FP operations are implemented in the software using several non-FP
instructions). Both computers have a clock frequency of 400 MHz. In both we perform the same program,
which has the following mixture of commands:
FP addition 16% 6 20
FP multiplication 10% 8 32
FP division 8% 10 66
Non - FP instructions 66% 3 3
Solution:
Computer R1:
𝑓𝐶𝑃𝐸 400∗106
MIPS =
𝐶𝑃𝐼∗106
= 4,54∗106
= 88,1
Computer R2:
f𝐶𝑃𝐸 400∗106
MIPS =
CPI∗106
= 13,66∗106
= 29,28
Computer R1:
Number_of_instructions 12000
𝑪𝑷𝑼time = = 6
= 136,2 ∗ 10−6 = 136,2 𝜇𝑠
𝑴𝑰𝑷𝑺 ∗ 𝟏𝟎𝟔 88,1 ∗ 10
Computer R2:
Number_of_instructions 12000
𝑪𝑷𝑼time = 𝟔
= 6
= 410 ∗ 10−6 = 410 𝜇𝑠
𝑴𝑰𝑷𝑺 ∗ 𝟏𝟎 29,28 ∗ 10
Solution:
𝑁
𝑆(𝑁) =
1 + (𝑁 − 1) ∗ 𝑓
FP unit must be active 63.15% of the time so that the computer's performance is 2.5 times faster.
6. The computer has a main memory access time of 60 ns. We want to reduce this time to 20 ns by adding
cache. Determine how fast the cache must be (access time) if we can expect a 90% probability of a hit.
tag=60 ns
ta=20 ns
H=90%=0,9
tap=?
ta=tap+(1-H)×tag
tap=ta-(1-H)×tag
tap=20×10-9 [s] –(1-0,9)×60×10-9 [s]=20×10-9-6×10-9=14×10-9 [s] =14 [ns]
7. In a computer with cache, we have the average number of clock periods per instruction equal to 4, if there are no
misses in the cache.
a) What is the real number of clock periods per instruction, if the probability of miss in the cache is 10%?
For the replacement of the block (line) in the cache, we need 5 clock periods for read and 10 for write
accesses. Assume that each instruction requires an average of 2 memory accesses and that 20% of all are
write accesses.
CPII=4
(1-H)=10%=0,1
MI=2
NR=5
NW=10
PW=0,2
PR=0,8
CPIR=CPII+MI×(1-H)×miss_penalty
CPII=4
MI=2
(1-H)=0,05
miss_penalty =6
CPIR=?
CPIR=CPII+MI×(1-H)× miss_penalty
CPIR=4+2×0,05×6=4,6
8. On a computer with a 32-bit memory address and the length of the memory location of 1 byte is
installed set-associative cache. Cache size is 16 KB, block (line) size is 16 Bytes, set associative cache
is 4-way.
n=32
M=16KB=24KB=214B
block=B=16B=2 4B
E=4=22
M=S×E×B
S=M÷(E×B)=2 14÷(22×24)=214-6=28=256 sets
b) Which bits in the memory address determine the address of the set?
31 11 4 3 0
address of
the set
c) Into which set is mapped the content of the memory address 10FFCFF(HEX)?
1 0001 31 11 43 0
2 0010 00000001000011111111110011111111
3 0011
4 0100
5 0101
6 0110 set address
7 0111
8 1000
9 1001
A 1010 Address belongs to set 207.
B 1011
C 1100
D 1101
E 1110
F 1111
9. A computer with virtual memory has an access time tomain memory 50 ns, the time to transfer a block from
the virtual into main memory is 10 ms. The probability for the page-fault is 10-6.
What is the average access time, if the page-table is in the main memory?
tag=50ns
tB=10ms
(1-H)=10-6
ta=?
ta=tag+tag+(1-H)×tB
ta=50×10-9+50×10-9+10-6×10×10-3=
=100×10-9+10×10-9=110×10-9=110 [ns]
a) How many bits is the length of page descriptor, if in addition to the frame number (FN), additional parameters
occupy another 6 bits?
n=38
f=32
page size = 16 KB=2p=214B
num_pages x page_descriptor
2243B x = 220× 243B x = 24× 3MB = 16 × 3MB = 48MB page-table size in main memory.