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]
(A) 100
(B) 200
(C) 400
(D) 500
Answer: (D)
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 there are 100 instructions,
We have a size of 425 byte, which can be stored in
500 byte memory from the given options.
Hence (D) 500 is the answer.
Quiz of this Question
Share your thoughts in the comments
Please Login to comment...