2080 7

BIT151 ยท 2080 ยท 5 marks

What is selective set logical operation? Draw the hardware circuit of selective set logical operation.

What is selective set logical operation? Draw the hardware circuit of selective set logical operation. [5]

Microprocessor and Computer ArchitectureChapter 4: Arithmetic and Logical OperationsSelective set logical operations

Quick answer

Selective Set is a logical operation that uses the OR operation to selectively set (force to 1) specific bits of a register (operand A) based on a mask operand (operand B), while leaving the remaining bits unchanged.

Selective Set Logical Operation

Definition

  • If a bit in the mask (B) = 1, the corresponding bit in the result is set to 1 (regardless of A).
  • If a bit in the mask (B) = 0, the corresponding bit in the result remains unchanged (retains the value of A).

The operation is defined as:

$$A \leftarrow A \text{ OR } B$$


Key Principle

AB (Mask)A OR B (Result)
000 (unchanged)
101 (unchanged)
011 (set to 1)
111 (set to 1)
  • Wherever B = 1, the bit is forced/set to 1.
  • Wherever B = 0, the bit is left as it is.

Example

Let A = 1010 0110 and B (mask) = 0000 1111

  A  =  1010 0110
  B  =  0000 1111
        ---------
A OR B= 1010 1111

The lower 4 bits are all set to 1 by the mask.


Hardware Circuit of Selective Set Operation

The circuit uses OR gates for each bit position. Each OR gate takes one bit from register A and the corresponding bit from mask B as inputs.

Bit position:    n-1          ...         1           0
                  |                       |            |
         A[n-1] --+--\              A[1] -+--\   A[0] -+--\
                  |   OR --> R[n-1]       |   OR->R[1]  |   OR --> R[0]
         B[n-1] --+--/              B[1] -+--/   B[0] -+--/

Detailed Single-Bit Circuit (for one bit position):

        A[i] ----\
                  [OR Gate] -----> Result R[i]
        B[i] ----/

Full n-bit Circuit Diagram:

A[n-1] ---|        A[1] ---|        A[0] ---|
          | OR|-->R[n-1]   | OR|-->R[1]     | OR|-->R[0]
B[n-1] ---|        B[1] ---|        B[0] ---|

  (Each bit position has one OR gate)
+-------+     +-------+     +-------+     +-------+
| A[n-1]|     | A[2]  |     | A[1]  |     | A[0]  |
+---+---+     +---+---+     +---+---+     +---+---+
    |              |              |              |
   [OR]           [OR]           [OR]           [OR]
    |              |              |              |
+---+---+     +---+---+     +---+---+     +---+---+
| B[n-1]|     | B[2]  |     | B[1]  |     | B[0]  |
+-------+     +-------+     +-------+     +-------+
    |              |              |              |
  R[n-1]         R[2]           R[1]           R[0]

Summary

FeatureDetail
OperationA OR B
Gate UsedOR Gate (one per bit)
Effect of B=1Sets corresponding bit to 1
Effect of B=0Leaves corresponding bit as-is
ApplicationSetting specific bits in a register without disturbing others

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.