All Exams Test series for 1 year @ ₹349 only
Question

A Computer uses a memory unit with 256K word of 32 bits each. A binary instruction code is stored in one word of memory. The instruction has four parts: an indirect bit, an operation code and a register code part to specify one of 64 registers and an address part. How many bits are there in operation code, the register code part and the address part?

The correct answer is

7, 6, 18

Analyzing Computer Instruction Format Bits

The question asks us to determine the number of bits allocated to different parts of a computer instruction: the operation code, the register code part, and the address part. We are given the total size of the memory, the size of each memory word, and the structure of the instruction code.

Understanding the Instruction Structure

We are told that a binary instruction code is stored in one word of memory. The memory unit has words of 32 bits each. Therefore, each instruction is 32 bits long.

The instruction is divided into four parts:

  1. An indirect bit
  2. An operation code (Opcode)
  3. A register code part
  4. An address part

The total number of bits for these four parts must sum up to the total instruction length, which is 32 bits.

Calculating Bits for Each Part

Indirect Bit

The question explicitly states there is an indirect bit. This typically occupies 1 bit.

Indirect bit bits = 1

Register Code Part

The register code part is used to specify one of 64 registers. To uniquely identify one out of 64 items, we need a certain number of bits. The number of bits required is given by $\text{log}_2(\text{number of items})$.

Number of registers = 64

Register code bits = $\text{log}_2(64)$

Since $2^6 = 64$, $\text{log}_2(64) = 6$.

Register code part bits = 6

Address Part

The address part is used to address memory locations. The memory unit has 256K words. First, let's convert 256K words into the total number of words.

$1\text{K} = 1024$ words.

$256\text{K} = 256 \times 1024 = 262144$ words.

To address one of the 262144 memory locations, we need a certain number of bits for the address part. Similar to the register code, the number of bits required is $\text{log}_2(\text{total number of memory words})$.

Total memory words = 262144

Address part bits = $\text{log}_2(262144)$

We know that $2^{10} = 1024$ and $2^8 = 256$.

So, $262144 = 256 \times 1024 = 2^8 \times 2^{10} = 2^{(8+10)} = 2^{18}$.

Therefore, $\text{log}_2(262144) = 18$.

Address part bits = 18

Operation Code (Opcode)

The operation code specifies the operation to be performed. The bits for the opcode are the remaining bits after allocating bits for the indirect bit, register code, and address part from the total instruction length.

Total instruction bits = 32

Bits used by other parts = Indirect bit bits + Register code part bits + Address part bits

Bits used by other parts = $1 + 6 + 18 = 25$ bits.

Operation code bits = Total instruction bits - Bits used by other parts

Operation code bits = $32 - 25 = 7$ bits.

Summary of Bit Allocation

Let's summarize the number of bits for each part of the computer instruction:

  • Operation code: 7 bits
  • Register code part: 6 bits
  • Address part: 18 bits

The question asks for the number of bits in the order: operation code, the register code part, and the address part.

This order corresponds to 7, 6, 18.

Comparing with Options

Let's compare our calculated values (7, 6, 18) with the given options:

  • Option 1: 7, 7, 18 (Incorrect - Register code is 6, not 7)
  • Option 2: 18, 7, 7 (Incorrect - Order and values are wrong)
  • Option 3: 7, 6, 18 (Correct - Matches our calculated values)
  • Option 4: 6, 7, 18 (Incorrect - Opcode is 7, not 6; Register code is 6, not 7)

Our calculation confirms that the number of bits are 7 for the operation code, 6 for the register code part, and 18 for the address part.

Instruction Part Calculation / Basis Number of Bits
Total Instruction Length Memory word size 32
Indirect Bit Given 1
Register Code Part To specify 64 registers ($\text{log}_2(64)$) 6
Address Part To address 256K words ($\text{log}_2(262144)$) 18
Operation Code Remaining bits (32 - 1 - 6 - 18) 7

Revision Table: Computer Instruction Bits

Concept Explanation Calculation
Instruction Length Determined by memory word size where instruction is stored. 32 bits (given)
Register Code Bits Number of bits needed to uniquely identify one out of 'N' registers. $\text{log}_2(\text{Number of registers})$
Address Part Bits Number of bits needed to uniquely identify one out of 'M' memory locations. $\text{log}_2(\text{Total memory locations})$
Operation Code Bits Remaining bits after allocating for other parts (control bits, registers, address) in the instruction format. Total bits - (Sum of bits for other parts)

Additional Information: Computer Instruction Format

A computer instruction is a command that tells the computer's CPU what operation to perform. Instructions are typically stored in memory and fetched by the CPU during program execution. The format of an instruction defines how the bits of the instruction are organized into functional parts.

  • Opcode (Operation Code): This is the most crucial part, specifying the type of operation to be performed (e.g., Add, Subtract, Load, Store). The number of bits in the opcode determines the maximum number of distinct operations a computer can perform ($2^{\text{number of opcode bits}}$).
  • Address Part (Operand Address): This part specifies the memory address or the register number of the data (operands) that the operation will use. The number of bits depends on the size of the main memory or the number of registers.
  • Mode bits: These bits specify the addressing mode, which determines how the operand's effective address is calculated (e.g., direct, indirect, immediate, register). In this question, an "indirect bit" is explicitly mentioned, indicating a specific addressing mode related to indirection.
  • Register Code Part: This part identifies which CPU register is involved in the operation, either as a source of an operand or a destination for the result. The number of bits depends on the total number of general-purpose registers in the CPU.

Different computer architectures have varying instruction formats. The format significantly impacts the CPU design and the efficiency of program execution. Fixed-length instructions, like the 32-bit format described, are common in RISC (Reduced Instruction Set Computer) architectures, while variable-length instructions are found in CISC (Complex Instruction Set Computer) architectures.

Was this answer helpful?

Important Questions from Instruction Format - Teaching

  1. The following program is stored in the memory unit of the basic computer. Give the content of accumulator register in hexadecimal after the execution of the program.

    Location

    Instruction

    010

    CLA

    011

    ADD 016

    012

    BUN 014

    013

    HLT

    014

    AND 017

    015

    BUN 013

    016

    C1A5

    017

    93C6

  2. A micro instruction format has micro operation field which is divided into 2 subfields F1 and F2, each having 15 distinct microoperations, condition field CD for four status bits, branch field BR having four options used in conjunction with address field AD. The address space is of 128 memory words. The size of micro instruction is:

  3. A computer uses a memory unit of 512 K words of 32 bits each. A binary instruction code is stored in one word of the memory. The instruction has four parts: an addressing mode field to specify one of the two-addressing mode (direct and indirect), an operation code, a register code part to specify one of the 256 registers and an address part. How many bits are there in addressing mode part, opcode part, register code part and the address part?

  4. Which of the following is not an example of pseudo‐instruction?

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App