The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+25 votes
4.8k views
A machine has a $32-bit$ architecture, with $1-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 ____________
asked in CO & Architecture by Veteran (115k points)
edited by | 4.8k views
0

what do 1-word long instructions mean?

0
one word instruction means .. the size of instruction is one word i.e. 32 bit.

3 Answers

+50 votes
Best answer
$64$ registers means $6$ bits $(\lceil \log_2 64 \rceil = 6)$ for a register operand. So, $2$ registers operand requires $12$ bits. Now, $45$ instructions require another $6$ bits for opcode $(\lceil \log_2 45 \rceil = 6)$. So, totally $18$ bits. So, 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$)
answered by Veteran (384k points)
edited by
0
Mode Opcode Operand

Assuming this is the Instruction format why is mode bit not used ?
as in 
1 bit for Mode 
then 6 bit for Opcode 
12 for Operand 
and then 13 the Operand ?


 

+2
why do we need a mode bit?
0
TO specify the mode as in immediate mode.
Is this Concept of mine wrong ?
+6
we don't need it and opcode can tell it.
0
I know this is silly but still, why 2 fields for operands are required when for immediate addressing mode we require only 1for  opcode 1 field for register and 1 field for the immediate operand i.e. for example

Mov R ,#25h

Or else if we consider only register mode then format is like

Mov A,R

???? It appears to me as if u have combined both this modes .please correct me if i am wrong
0
@Arjun Sir: They never mentioned that the word size was 32bit wide, how did you get the max length of one instruction ?
+2

@Dinesh 

It needs to support 45 instructions, which have an immediate operand in addition to two register operands

@vignesh

32-bit architecture, with 1-word long instructions

0
We dont need any mode bit. This simple instruction would look like below -

Opcode(6bit), Reg_Operand1(6bit), Reg_Operand2(6bit), Immediate Operand(14 bit)
0

sir if we had to show sing bit then it would be (213-1 ) ,(-1 because we represent instr 0 to 31), is im thinking correct?  ,

0
yes, but we also need to know how signed number is represented then (sign-magnitude, 2's complement etc)
0
Thanks
0
Mr. @Arjun please tell me what does this line "...It needs to support 45 instructions which have an immediate operand..." mean? Does it mean:

that the processor supports 45 different kinds of instructions and each instruction has one immediate operand,

or there are 45 instructions inside a single opcode? (never heard of it, but idk if that can happen),

or is the instruction 45 bits long,

 or something else?
0
@habedo007 it means there are 45 different kinds of instruction but to even refer any one of them we need 6 bits.
0
Why we are taking log on the number of registers to get the size of each register?
0

 It has 64 registers, each of which is 32 bits long

what that $32$ bits long means? Is it mean instruction size $32$ bits or register size 32 bits? 

0
Hi! After we have allocated 12 bits for registers, we are left with 20 bits and we need to represent 45 opcodes and unsigned int with them. Why can't we we say the answer is pow(2,20) - 45? Can opcode and int. Not share the bits?

It will be very helpful if someone clarifies this.
+3 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 

answered by Active (1.1k points)
0
how to know operand are 6 bit means register are 64 bit so what are relation between register and operand size .?
0

Instruction size if of 32 bits.

according to given information here we have 2 different types oprands and one opcode.

so first find register mode oprand bits, how -> given total 64 rigesters, take log(64)=6

now find opcode field bits, how -> given 45 types of instructions, take ceil{log(45)}=6

now find  immediate operand field bits, how -> total bits- other field bits

                                                                  = 32 - (6+6+6)    (2 times 6 bcz two register oprands given)

                                                                   = 14

*note: base of log is 2.

0
@mint why here we left other remaining bits for 45 instrustions means from 2^6=64

45 will b in use so some will left ...why we not use them ?
0 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) 

answered by Loyal (9.3k points)
0

Regina Phalange

if the immediate operand is a signed integer, then the maximum value of the immediate operand is....?? 

-2n-1  to (2n-1 -1)....???? 

OR

(-2n-1 -1)  to (2n-1 -1)....???

+1

-2n-1  to (2n-1 -1)

0
okk.. :) means we use 2's complement here to represent signed integer...
0
yes, as per my knowledge but i m not 100% sure, can you tag someone who can verify it?
+1

let me make u 100% sure.. :) I just go through this fact right now and sharing with you also...

  1. Unsigned: It consist only positive value i.e 0 to 255.

  2. Signed: It consist both negative and positive values but in different formats like

    • -1 to -128
    • 0 to +127

And this all explanation is about 8 bit number system.

ref: https://stackoverflow.com/questions/247873/signed-versus-unsigned-integers

0
Thank You :)
+1

signed = -(-2n-1 -1)  to (2n-1 -1).

2's complement = 2n-1  to (2n-1 -1)

1's complement = (-2n-1 -1)  to (2n-1 -1).

unsigned = (0)  to (2n -1).

0
Had it been 2-word long instruction ,the instruction length would be 64-bit long ?

@MiNiPanda
0

@HeadShot Yes. Then the no. of bits for operand would increase.

Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
47,925 questions
52,325 answers
182,360 comments
67,786 users