The Gateway to Computer Science Excellence

+47 votes

Best answer

+15

|--------------------------------------- 32-bits -----------------------------------------------------------------|

opcode(6) | R1(5) | R2(5) | immediate operand =? |

6+5+5+x=32 bits

x=16 bits

0

Opcode tell no of distinct operation are their e.g add,sub etc .so why we using log40 as opcode 40 are the distinct instruction.

+1

There are 40 opcodes, it means, there will be 40 distinct operations like ADD, SUB, MUL etc...So in order to represent one operation, we need some bits right!!! If we have 4 distinct operations like ADD, MUL, DIV, SUB, we have to represent each operation with some bits, here we need two bits.

00-ADD

01-MUL

10-DIV

11-SUB

So we need log_{2}4 = 2 bits

Similarly, in this question, we have 40 distinct opcodes, so in order to name them in binary

we need log_{2}40 = 6 bits

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.4k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,737 questions

57,366 answers

198,496 comments

105,265 users