GATE | GATE-CS-2016 (Set 2) | Question 41
Consider a processor with 64 registers and an instruction set of size twelve. Each instruction has five distinct fields, namely, opcode, two source register identifiers, one destination register identifier, and a twelve-bit immediate value. Each instruction must be stored in memory in a byte-aligned fashion. If a program has 100 instructions, the amount of memory (in bytes) consumed by the program text is ____________
[Note that this was originally a Fill-in-the-Blanks question]
Explanation: One instruction is divided into five parts,
- (1): The opcode- As we have instruction set of size 12, an instruction opcode can be identified by 4 bits, as 2^4=16 and we cannot go any less.
- (2) & (3): Two source register identifiers- As there are total 64 registers, they can be identified by 6 bits. As they are two i.e. 6 bit + 6 bit.
- (4): One destination register identifier- Again it will be 6 bits.
- (5): A twelve bit immediate value- 12 bit.
Adding them all we get,
= 4 + 6 + 6 + 6 + 12 = 34 bit = 34/8 byte = 4.25 byte
As given Each instruction must be stored in memory in a byte-aligned fashion,4.25 is not byte alignment, memory address should be 0,1,2,3,4,5,6,7…….. so it should be 5 bytes.
As there are 100 instructions, we have a size of 5*100= 500 bytes.
Hence (D) 500 is the answer.
Quiz of this Question
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.