←Back to Subject
Notes
Notes
Study material and explanations
Diagrams
Diagrams
Visualize concepts easily
Mnemonics
Mnemonics
Tricks to remember faster
One Night Prep
One Night Prep
Short and focused revision
Revision
Revision
Quick summary and key points
Important Questions
Important Questions
Practice most relevant questions
Notes

Arithmetic, Logic & Shift Micro-operations (ALU Design)

Study material and explanations for Unit 3

Arithmetic, Logic, and Shift Micro-operations (ALU Design)

What are Micro-operations? (In Simple Words)

No matter how complex a computer program or game is, the CPU breaks every instruction down into tiny, atomic hardware steps called Micro-operations.

  • A Micro-operation is an elementary operation performed on data stored inside registers during a single clock cycle.
  • The Arithmetic Logic Unit (ALU) executes these micro-operations.
The Four Classes of Micro-operations
1. Register Transfer
Copies binary data from one register to another (`R₂ ← R₁`)
2. Arithmetic
Performs math: addition, subtraction, increment, decrement
3. Logic
Performs bitwise Boolean tests: AND, OR, XOR, NOT
4. Shift
Slides data bits left or right for quick multiplication or division

1. Arithmetic Micro-operations

The basic math operations include:

  • Add: R₃ ← R₁ + R₂
  • Subtract (via 2’s complement): R₃ ← R₁ + R₂' + 1
  • Increment (Add 1): R₁ ← R₁ + 1
  • Decrement (Minus 1): R₁ ← R₁ - 1

The 4-Bit Arithmetic Circuit:

Built using 4 Full Adders and 4 Multiplexers.
By changing the two select lines (S₁, S₀) and the carry-in (Cin), this single circuit performs 8 distinct operations:

Select S₁ Select S₀ Cin Hardware Output Equation Math Operation
0 0 0 D = A + B Add
0 0 1 D = A + B + 1 Add with Carry
0 1 0 D = A + B' Subtract with Borrow
0 1 1 D = A + B' + 1 Subtract (A - B)
1 0 0 D = A Transfer A directly
1 0 1 D = A + 1 Increment A
1 1 0 D = A - 1 Decrement A
1 1 1 D = A Transfer A directly

2. Logic Micro-operations and Bit Manipulation

Logic micro-operations treat each bit in a register independently (no carry is passed between columns).

💡 Real-Life Indian Student Analogy:
Think of marking attendance on a register page.
You mark each student’s checkbox one-by-one without affecting other rows.
Bit-manipulation does the exact same thing to individual bits!

Four Essential Bit-Manipulation Tricks:

  1. Selective Set (Uses OR): Turns chosen target bits into 1 without changing the other bits.
    • Example: 1010 OR 0100 = 1110 (Bit 2 is forced ON).
  2. Selective Clear (Uses AND with Inverted Mask): Forces chosen target bits to 0.
    • Example: 1111 AND 1011 = 1011 (Bit 2 is cleared to 0).
  3. Selective Complement (Uses XOR): Inverts only the chosen bits (flips 0 to 1, and 1 to 0).
    • Example: 1010 XOR 0011 = 1001 (Last 2 bits flipped).
  4. Masking (Uses AND): Wipes an entire half of a register to 0 while keeping the rest untouched.
    • Example: 1101 0101 AND 0000 1111 = 0000 0101.

3. Shift Micro-operations

Shift Operation Comparison
Logical Shift
Slides all bits. Puts a fresh 0 into the empty end.
shl (Shift Left) and shr (Shift Right).
Circular Shift (Rotate)
The bit pushed out of one end loops right back into the opposite end. No bit is lost!
Arithmetic Shift
Used for signed numbers.
Right Shift: Keeps the sign bit (MSB) unchanged.
Left Shift: Multiplies the number by 2.

Detecting Overflow in Arithmetic Shift Left:

When you shift a signed number left, you double its value.

  • If the number becomes too large for the register, the sign bit flips incorrectly!
  • The CPU detects this Overflow using an XOR gate on the two leftmost bits:
    V = Rₙ₋₁ ⊕ Rₙ₋₂
  • If V = 1, an overflow error flag is set.

💡 DAVV Exam Preparation Tips

5-Mark Question: “Explain Selective Set, Selective Clear, Selective Complement, and Masking operations with binary examples.”

  • Name the required logic gate for each operation:
    • Selective Set → OR gate
    • Selective Clear → AND gate with inverted mask
    • Selective Complement → XOR gate
    • Masking → AND gate with 0000 1111 mask
  • Give a short 4-bit binary calculation example for each.

10-Mark Question: “Design an Arithmetic Circuit that performs addition, subtraction, increment, and decrement using Full Adders and Multiplexers. Provide its function table.”

  • Draw the block diagram: Multiplexers control whether B, B’, 0, or 1 feed into the Full Adders.
  • Present the full 8-row truth table for S₁, S₀, Cin.
  • Clearly show how 2’s complement subtraction A + B' + 1 works.