Computer Organization 1
Computer Organization 1
Organization
(Solutions for Vol‐1_Classroom Practice Questions)
T arg et size
=
Basic size 02. Ans: (c)
Sol: Number of tag comparators needed
64 8
= Associativity = 4
16 4
Size of each comparator
=8
= number of tag bits = 16
ACE Engineering Publications Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar| Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag |Tirupati | Kukatpally| Kolkata
: 3 : CSIT‐Postal Coaching Solutions
03. Ans: (c) 08. Ans: (a)
Sol: Memory size = 4 K 16 = 212 16 Sol: Number of blocks = 256 KB/32B = 8 K
Number of Address lines = 12 Number of Sets with 4-way set-associative
Data lines = 16 = 8 K/4 = 2 K
8 K(16+1+2+1)-bits =160 K-bits
04. Ans: (b)
Sol: Number of cache blocks = 2c
09. Ans: 20
Associativity = 2
Sol: Associativity = 4
Mapping expression is K mod S
Cache Size = 16 KB
Where, K = M.M block Number and
Block size = 8 words = 32 bytes
S = Number of cache sets
Number of Cache sets Word size = 32 bits
Number of cache blocks Number of cache blocks
=
Associativity 16KB 214 B
= 5 = 29
2c 32B 2 B
c =
2 29
Number of cache sets = 27
K mod c 2 2
18. Ans: 14
40
Sol: HC + (1 – H)M = (0.8 5) + (0.2 50)
It uses 8 way set associative
= 14 ns
Tag size = 24 bits.
19. Ans: (a)
Sol: Final Tag
Tag Line offset Word offset
Tag 3 216
1110 001000000001 1111
21
40
Tag = E16 line = 20116
23. Ans: 76
20. Ans: (c)
Sol: When a block is referred first time in cache
Sol: The cache and main memory are divided
memory, it is known as compulsory miss
into blocks of 64 bytes each. The direct
and it will be loaded in the cache memory,
mapped cache consists of 32 blocks (mod
when a same block is referred in future i.e.
block i/32). The array is stored from main
2nd time onwards; then it is considered as
memory locations 1100 H. The array is
conflict miss.
placed in MM from 68 Block onwards. The
For first iteration, 4 conflict misses and for
total array consists of 2500 bytes, so they
each iteration from 2nd time onwards
require a total of 40 blocks. In the cache all
8 conflict misses occur.
the 32 blocks are filled and the remaining 8
Total number of conflict misses occur for
blocks are replacing the previous blocks. A
10 times = 4+ (89) = 76.
total of 40 data misses will occur during first
access. During the second access once again Conflict misses in first iteration
the 16 blocks are replaced for conflict 0, 128, 256, 128, (0), 128, (256), 128, 1,
misses, so 16 cache misses occur.
129, 257, 129, (1), 129, (257), 129.
Total numbers of cache misses
Total 4 times
= 40 + 16 = 56
P - highest clock cycle time = 2.2 ns. Total time needed for 20 instructions
Q - highest clock cycle time = 1 ns. = (5 + 20 –1) 22 ns = 24 22 ns
In ‘P’ pipeline new instruction fetching is
= 528 ns
stopped for 2 stage delays
Where in ‘Q’ pipeline new instruction For Efficient pipelined processor
fetching is stopped for 5 stage delays Tseg = 12 + 2 = 14 ns; k = 6, n = 20
Number of branch instructions = 20%.
Total time for 20 instructions
‘P’ total time is (0.8 2.2 ns)
(6 + 20 – 1) 14 ns = 350 ns.
+ (0.2 (2 +1))2.2 ns = 3.08 ns
‘Q’ total time is 0.8 1 ns tn 528
Speed up = =
te 350
+ (0.2 (5+1)) 1 ns = 2 ns
P 3.08 ns = 1.50857
=
Q 2 ns 1.51
= 1.54.
ACE Engineering Publications Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar| Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag |Tirupati | Kukatpally| Kolkata
: 10 : Computer Organization
22. Ans: 219 03. Ans: (d)
Sol: Number of stages = 5(IF, ID, OF, PO, WR), Sol: The given program is:
k=5 Instruction
n = 100, except PO, all stages take one clock Instruction Operation Size
In P.O stage (No. of words)
40 instructions take 3 clocks MOV R1,(3000) R1←M[3000] 2
LOOP:
35 instructions take 2 clocks R2←M[R3] 1
MOV R2,(R3)
and remaining 25 instructions take 1 clk ADD R2, R1 R2←R2+R1 1
If all instructions requires one clock in all MOV(R3), R2 M[R3]←R2 1
stages, total clocks required = (k + n – 1) INC R3 R3←R3+1 1
= 5 + 100 – 1 = 104 DEC R1 R1←R11 1
But, 40 instructions requires 3 clocks each Branch on not
BNZ LOOP 2
i.e. 40 instructions execution requires '80' zero
HALT Stop
more clocks and 35 instructions requires 2
clocks i.e. 35 instructions required 35 more
Let the data at memory 3000 is 10.
clocks.
So, total number of clocks required The contents of R3 are 2000.
= 104 + 80 + 35 = 219 The content of memory locations from 2000
to 2010 is 100.
4. CPU Organization The number of memory references for
accessing the data is
01. Ans: (b) Instruction Operation No. of memory references
Sol: The Value in register A is rotated through MOV R1(3000) R1←M[3000] 1
right 8 times. During each rotation MOV R2, (R3) R2←M[R3] 10(Loop is repeated 10 times)
operation, if carry flag is set the value of MOV (R3), R2 M[R3]←R2 10 (loop is repeated 10 times)
register B is incremented. After 8 rotations
B register contains the number of 1’s in Total number of memory references are: 21
register A.
04. Ans: (a)
02. Ans: (a)
Sol: As the memory locations are incremented 10
Sol: Extending the previous question, if the
times from 2000 to 2009, when the loop is
contents of register A is rotated right once
again, and then register A will retain its terminated R3 consists of 2010, whose value
value. Therefore the instruction at X will be will be 100(previous value) only.
RRC A, #1.
= 1020 cycles
Operation A1 A2 Operand
Speed up = 3502/1020 = 3.44
log2 40 log2 24 log2 24
15. Ans: (d) 6 5 5 xxx
Sol: Here R 2 will act as base or indexed register
and 20 is the displacement. 32 – 16 = 16