GATE 2008
185 questions
MCQ 1851-mark 52 · 2-mark 133
Questions 61–65 of 185
Consider a CPU where all the instructions require 7 clock cycles to complete execution. There are 140 instructions in the instruction set. It is found that 125 control signals are needed to be generated by the control unit. While designing the horizontal microprogrammed control unit, single address field format is used for branch control logic. What is the minimum size of the control word and control address register?
Answer: (D)
Every instruction takes 7 clock cycles, so the control unit has to give different sets of control signals. Each set is one microinstruction, so the control memory has 980 words.
With a single address field for branch control, the address of the next microinstruction is kept in the control word. To address 980 words we need bits, because and .
- Control address register: it holds an address of the control memory, so it is 10 bits.
- Control word: in horizontal microprogramming there is one bit for each control signal, so 125 bits, plus the 10-bit address field. That gives bits.
The sizes are 135 and 10.
Answer: (D)
With a single address field for branch control, the address of the next microinstruction is kept in the control word. To address 980 words we need bits, because and .
- Control address register: it holds an address of the control memory, so it is 10 bits.
- Control word: in horizontal microprogramming there is one bit for each control signal, so 125 bits, plus the 10-bit address field. That gives bits.
The sizes are 135 and 10.
Answer: (D)
Consider a computer with a 4-ways set-associative mapped cache of the following characteristics: a total of 1 MB of main memory, a word size of 1 byte, a block size of 128 words and a cache size of 8 KB.
While accessing the memory location 0C795H by the CPU, the contents of the TAG field of the corresponding cache line is:
While accessing the memory location 0C795H by the CPU, the contents of the TAG field of the corresponding cache line is:
Answer: (A)
Memory is 1 MB, so an address has 20 bits. A block has 128 words of 1 byte each, so the word (offset) field has 7 bits.
Cache lines . With 4 lines per set, sets , so the set field has 4 bits.
Tag bits .
Drop the last 7 bits (word): .
The last 4 of these bits, , are the set number. The first 9 bits, , are the tag.
Option (C) has only 8 bits, so it cannot be a 9-bit tag. Option (B) is the last 9 of the 13 bits, but the tag is the first 9.
Answer: (A)
Cache lines . With 4 lines per set, sets , so the set field has 4 bits.
Tag bits .
Drop the last 7 bits (word): .
The last 4 of these bits, , are the set number. The first 9 bits, , are the tag.
Option (C) has only 8 bits, so it cannot be a 9-bit tag. Option (B) is the last 9 of the 13 bits, but the tag is the first 9.
Answer: (A)
Consider a computer with a 4-ways set-associative mapped cache of the following characteristics: a total of 1 MB of main memory, a word size of 1 byte, a block size of 128 words and a cache size of 8 KB.
The number of bits in the TAG, SET and WORD fields, respectively are:
The number of bits in the TAG, SET and WORD fields, respectively are:
Answer: (D)
Main memory is 1 MB bytes, so an address has 20 bits. A word is 1 byte.
WORD field: a block has 128 words, so bits.
Number of blocks in the cache: .
Number of sets: 4 blocks per set, so sets. The SET field needs bits.
TAG field: bits.
So TAG, SET, WORD are 9, 4, 7.
Answer: (D)
WORD field: a block has 128 words, so bits.
Number of blocks in the cache: .
Number of sets: 4 blocks per set, so sets. The SET field needs bits.
TAG field: bits.
So TAG, SET, WORD are 9, 4, 7.
Answer: (D)
Consider a machine with a 2-way set associative data cache of size 64Kbytes and block size 16bytes. The cache is managed using 32 bit virtual addresses and the page size is 4Kbyts. A program to be run on this machine begins as follows:
The cache hit ratio for this initialization loop is
double ARR[1024][1024];
int i, j;
// Initialize array ARR to 0.0
for(i = 0; i < 1024; i++)
for(j = 0; j < 1024; j++)
ARR[i][j] = 0.0; The size of double is 8Bytes. Array ARR is located in memory starting at the beginning of virtual page 0xFF000 and stored in row major order. The cache is initially empty and no pre-fetching is done. The only data memory references made by the program are those to array ARR The cache hit ratio for this initialization loop is
Answer: (C)
The block size and each element takes
So one block holds elements.
The array has elements. The number of blocks needed .
In each block, the first element is a miss and the second is a hit, because two elements come in together.
Correct Answer:
So one block holds elements.
The array has elements. The number of blocks needed .
In each block, the first element is a miss and the second is a hit, because two elements come in together.
Correct Answer:
Consider a machine with a 2-way set associative data cache of size 64Kbytes and block size 16bytes. The cache is managed using 32 bit virtual addresses and the page size is 4Kbyts. A program to be run on this machine begins as follows:
Which of the following array elements has the same cache index as ARR[0][0]?
double ARR[1024][1024];
int i, j;
// Initialize array ARR to 0.0
for(i = 0; i < 1024; i++)
for(j = 0; j < 1024; j++)
ARR[i][j] = 0.0; The size of double is 8Bytes. Array ARR is located in memory starting at the beginning of virtual page 0xFF000 and stored in row major order. The cache is initially empty and no pre-fetching is done. The only data memory references made by the program are those to array ARR Which of the following array elements has the same cache index as ARR[0][0]?
Answer: (B)
The cache has 64 KB, 16 B blocks and 2 blocks per set, so the number of sets is .
A 32-bit address splits into 4 offset bits (16 B block), 11 index bits and 17 tag bits. The index is address bits 4 to 14.
So two addresses have the same index when their addresses differ by a multiple of bytes (a whole number of cache-size/2-way spans).
ARR starts at virtual address 0xFF000000 (page 0xFF000, offset 000). Element is at bytes (row major, 8 bytes per double). The base is a multiple of 32768, so only the distance from ARR[0][0] matters.
(A) ARR[0][4]: distance , index , not 0.
(B) ARR[4][0]: distance , index 0, same as ARR[0][0].
(C) ARR[0][5]: distance , index , not 0.
(D) ARR[5][0]: distance , and , index , not 0.
Answer: (B)
A 32-bit address splits into 4 offset bits (16 B block), 11 index bits and 17 tag bits. The index is address bits 4 to 14.
So two addresses have the same index when their addresses differ by a multiple of bytes (a whole number of cache-size/2-way spans).
ARR starts at virtual address 0xFF000000 (page 0xFF000, offset 000). Element is at bytes (row major, 8 bytes per double). The base is a multiple of 32768, so only the distance from ARR[0][0] matters.
(A) ARR[0][4]: distance , index , not 0.
(B) ARR[4][0]: distance , index 0, same as ARR[0][0].
(C) ARR[0][5]: distance , index , not 0.
(D) ARR[5][0]: distance , and , index , not 0.
Answer: (B)