Interview Question on CPU design

mg
Written by
1
A CPU has a memory unit with 32-bit instructions and a register file with 32 registers. The instruction set consists of 95 different operations. The instruction consists of an opcode, a two register file addresses, and an immediate operand part. Each instruction is stored in one word of memory.

(a) How many bits are needed for the opcode part of the instruction?
(b) How many bits are needed to indicate the registers?
(c) How many bits remain for the immediate operand part?
(d) If the immediate operand is always a memory address, what is the maximum number of words that can be addressed in memory?
(e) What are the largest and smallest algebraic values of signed 2’s complement binary numbers that can be accommodated as an immediate operand?

Post a Comment

1Comments

Your comments will be moderated before it can appear here. Win prizes for being an engaged reader.

  1. (a) The number of bits needed for the opcode part of the instruction is determined by the number of different operations in the instruction set. In this case, there are 95 different operations, so we need at least 7 bits to represent all of them. However, since 2^7 = 128, which is more than 95, we can represent all the operations with 7 bits.

    (b) The register file has 32 registers, which can be represented using 5 bits (2^5 = 32).

    (c) The remaining bits for the immediate operand part can be calculated as follows: 32-bit instruction - 7 bits for opcode - 2 x 5 bits for register addresses = 15 bits.

    (d) If the immediate operand is always a memory address, then the maximum number of words that can be addressed in memory is determined by the number of bits used to represent the memory address. In this case, we have 15 bits for the immediate operand, so the maximum number of words that can be addressed is 2^15 = 32,768 words.

    (e) Since the immediate operand is signed 2's complement, the largest and smallest algebraic values that can be accommodated are determined by the number of bits used to represent the immediate operand. In this case, we have 15 bits for the immediate operand, so the largest algebraic value that can be accommodated is (2^14) - 1 = 32,767, and the smallest algebraic value that can be accommodated is -2^14 = -32,768.

    ReplyDelete
Post a Comment

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn more
Ok, Go it!