In: Computer Science
A digital computer has a memory unit with 32 bits per word. The instruction set consists of 122 different operations. All instructions have an operation code part (opcode) and an address part (allowing for only one address). Each instruction is stored in one word of memory.
a) How many bits are needed for the opcode?
b) How many bits are left for the address part of the instruction?
c) What is the maximum allowable size for memory?
d) What is the largest unsigned binary number that can be accommodated in one word of memory?
First of all we will see the instruction format. Each word consists of opcode and operand.
Opcode | operand address |
Opcode is responsible for the different operations and operand refers the address of operands.
a)
Given that instruction set consists of 122 different operations. To represent these 122 different operations we need log2(122) bits.
Therefore log2(122) = 6.931 7 bits.
b)
From part a) it is clear that opcode takes 7 bits and word length is 32 bits.
Therefore remaining bits for address part (operands) = 32 bit - opcode = 32 bit - 7 bits = 25 bits.
c)
From part b) it is clear that we have 25 bits for operands. which means we have 225 different operands and each takes 32 bit long word.
Therefore maximum allowable size for memory = 225 * 32 bits = 128 Mb.
d)
The largest unsigned number that can be represented with 'n' bit word is 2n - 1.
Therefore with 32 bit long word we can have 232 - 1 = .