edited by
18,179 views
49 votes
49 votes
A machine has a $32\text{-bit}$ architecture, with $1\text{-word}$ long instructions. It has $64$ registers, each of which is $32$ bits long. It needs to support $45$ instructions, which have an immediate operand in addition to two register operands. Assuming that the immediate operand is an unsigned integer, the maximum value of the immediate operand is ____________
edited by

6 Answers

Best answer
97 votes
97 votes
$64$ registers means $6$ bits $(\lceil \log_2 64 \rceil = 6)$ for a register operand. So, $2$ register operands require $12$ bits. Now, $45$ instructions require another $6$ bits for opcode $(\lceil \log_2 45 \rceil = 6)$. So, totally $18$ bits. Now we have $32 - 18 = 14$ bits left for the immediate operand. So, the max value will be $2^{14} - 1 = 16383$ (as the operand is unsigned we do not need a sign bit and with $14$ bits we can represent from $0$ to $2^{14} -1$)
edited by
7 votes
7 votes
Instruction 32 bit = (6+6+6+14) bit 
⌈log45⌉=6 bit opcode R1 ⌈log64⌉=6 bit R2 ⌈log64⌉=6 bit remaining 14 bit oprand

It needs to support 45 instructions,   means types of instruction supported is of45 

2 votes
2 votes

1 Word = 32 bits

Each instruction has 32 bits

To support 45 instructions, opcode must contain 6-bits

Register operand1 requires 6 bits, since the total registers
are 64.

Register operand 2 also requires 6 bits.

14-bits are left over for immediate Operand Using 14-bits,
we can give maximum 16383,

Since 2^14=16384(from 0 to 16383) 

1 votes
1 votes

Answer : 16383

no. of bits for 45 instructions / opcode = ⌈$\log _{2}45$⌉ = 6

no. of bits for each register operand = ⌈$\log _{2}64$⌉ =6

6 (opcode) 6 (r1) 6 (r2) p  (immediate)

no. of immediate operand bits = no. of bits for machine - (6 + 6 + 6 )

no. of immediate operand bits = 32 - 18 = 14 bits 

for max value of immediate operand you have to put all 1's in all 14 immediate bits 

so, max value of immediate operand  = $2^{14}$-1 = 16383

Answer:

Related questions