Docsity

COA - MidTerm Exams with Solutions, Exams of Computer Fundamentals

Toggle sidebar
bg1
You are not allowed to ask any questions. In case of any confusion, state an
appropriate assumption. Hand writing must be legible. Good Luck!
Question 1. Give brief answers (not more than 4 lines) [2x5 = 10 Marks]
a) What are the two main steps involved in an instruction cycle? Instruction fetch and
execute
b) If the CPU needs to be alerted by the keyboard and the mouse at the same time, How the
CPU will handle interrupts from the keyboard and the mouse at the same time? There are
two ways: with priorities (high priority task will be handled first while the lower priority
will be suspended. After complete execution of the high priority task, control will be
transferred to the lower priority task).
c) Which cache mapping does not need a replacement algorithm? Direct Mapping
d) Which cache mapping scheme has the largest TAG? Associative Mapping
e) Only a microprocessor is accessing the memory via cache i.e. no other device is reading
from memory. Which cache write policy will you use and why. Write back, as it updates
memory only when a block from cache has to be replaced otherwise that block in memory
remains invalid. It does not matter as no other device is accessing memory.
Question 2: Following table A shows code of a microprocessor (MP) and
table B shows some data values: [5x5 = 25 Marks]
TABLE A:
No. Address (hex) Instruction Machine Code
(hex)
Comments
1 A188DDDD LOAD (1234A10D) F 1234A10D AC F0 D F contents of
location 1234A10D
2 A189DDDE ADD (1234B10D) 0 1234B10D AC F 0 D F AC + contents of
1234B10D
3 A18ADDDF JUMP D188DDDD E D188DDD PC F0 D F D188DDDD
4 D188DDDD SUB (1234E10D) 1 1234E10D AC F 0 D F AC โ€“ contents of
1234E10D
5 D189DDDE JUMP A188DDDD E A188DDD PC F 0 D F A188DDDD
TABLE B:
Address
(Hex)
Data (Hex)
1234A10D A
1234B10D 2
1234E10D 9
1234F10D F
Initially PC = A188DDDD (hex), AC = 1111(Hex)
Page 1 of 3
pf3

Partial preview of the text

Download COA - MidTerm Exams with Solutions and more Exams Computer Fundamentals in PDF only on Docsity!

You are not allowed to ask any questions. In case of any confusion, state an appropriate assumption. Hand writing must be legible. Good Luck! Question 1. Give brief answers (not more than 4 lines) [2x5 = 10 Marks]

a) What are the two main steps involved in an instruction cycle? Instruction fetch and

execute

b) If the CPU needs to be alerted by the keyboard and the mouse at the same time, How the

CPU will handle interrupts from the keyboard and the mouse at the same time? There are

two ways: with priorities (high priority task will be handled first while the lower priority

will be suspended. After complete execution of the high priority task, control will be

transferred to the lower priority task).

c) Which cache mapping does not need a replacement algorithm? Direct Mapping

d) Which cache mapping scheme has the largest TAG? Associative Mapping

e) Only a microprocessor is accessing the memory via cache i.e. no other device is reading

from memory. Which cache write policy will you use and why. Write back, as it updates

memory only when a block from cache has to be replaced otherwise that block in memory

remains invalid. It does not matter as no other device is accessing memory.

Question 2: Following table A shows code of a microprocessor (MP) and table B shows some data values: [5x5 = 25 Marks]

TABLE A:

No. Address (hex) Instruction Machine Code (hex)

Comments

1 A188DDDD LOAD (1234A10D) F 1234A10D AC F 0 D Fcontents of location 1234A10D

2 A189DDDE ADD (1234B10D) 0 1234B10D AC F 0 D FAC + contents of 1234B10D

3 A18ADDDF JUMP D188DDDD E D188DDD PC F 0 D FD188DDDD

4 D188DDDD SUB (1234E10D) 1 1234E10D AC F 0 D FAC โ€“ contents of 1234E10D

5 D189DDDE JUMP A188DDDD E A188DDD PC F 0 D FA188DDDD

TABLE B:

Address (Hex)

Data (Hex)

1234A10D A

1234B10D 2

1234E10D 9

1234F10D F

Initially PC = A188DDDD (hex), AC = 1111(Hex)

Page 1 of 3

For the above processor MP, after each instruction executes, show values of PC, AC and IR,

MAR, MBR registers.

No. PC IR MAR MBR (content at

MAR)

AC

1 A189DDDE F 1234A10D 1234A10D A A

2 A18ADDDF 0 1234B10D 1234B10D 2 C

3 D188DDDD E D188DDD A18ADDDF

(since no memory access in instruction, so we will consider the values updated during instruction fetch, i.e, MAR<-PC )

E D188DDD C

4 D189DDDE 1 1234E10D 1234E10D 9 3

5 A188DDDD E A188DDD D189DDDE E A188DDD 3

Question 3: A processor uses split caches for storing instruction and data with the

following characteristics. [25 Marks]

Main memory size = 16MB, Instruction cache capacity = 4Kwords

Data cache capacity= 16Kwords, Word size = 32bit, Block size = 4 words

a. If instruction cache uses direct mapping and data cache uses 8 way set associative

mapping. What would be the size of tag, set, line and word in bits for instruction and

data cache? [10 Marks]

Main Memory = 2s+w^ bytes = 2 24 bytes

S+w = 24

1 word = 32 bits = 4 bytes

1 block size = 4 words = 16 bytes = 2^4 bytes

=> w = 4

=> Number of blocks = 2 s+w/2w^ = 2 20

S=

Size of Instruction cache = 4K words = 4K x 4 bytes = 16K bytes = 2 14 bytes

=> No. of lines in I cache = 2 14 /2^4 = 2 10

Size of Data cache = 16K words = 16K x 4 bytes = 64K bytes = 2^16 bytes

No. of lines in D cache = 2^16 /2^4 = 2 12

No. of sets in D cache = 2^12 /8 = 2 9