Computer Organization & Architecture
Unit 7: Computer Arithmetic
From binary addition to floating-point magic โ master every arithmetic algorithm the CPU uses, trace them step-by-step, and conquer GATE numericals.
โฑ๏ธ 6 hrs theory + 4 hrs lab | ๐ฏ GATE ~3 marks | ๐ฅ๏ธ ARM Cortex Multiplier
๐ 30 MCQs (Bloom's Mapped) | 6 Numerical Problems | 5 GATE Practice Questions
Opening Hook โ How Your Phone Calculates a Bank EMI in Nanoseconds
๐ฆ โน10 Lakh Home Loan EMI โ Calculated in 0.000000003 Seconds
Open any banking app โ HDFC, SBI, ICICI โ and tap the EMI calculator. Enter โน10,00,000 loan, 8.5% interest, 20 years. In literally 3 nanoseconds, your phone shows โน8,678/month. How?
Inside your phone's ARM Cortex-A78 processor sits a dedicated hardware multiplier โ a circuit that multiplies two 64-bit numbers in a single clock cycle. That EMI formula needs multiplication, division, and exponentiation โ all done by computer arithmetic circuits we'll study in this chapter.
The same arithmetic unit inside India's Chandrayaan-3 navigation computer calculated trajectory corrections that landed Vikram exactly at the lunar south pole. The same Booth's multiplier algorithm running inside ISRO's onboard processors processed thousands of multiply operations per second to adjust thrust vectors.
What if YOU understood exactly how the CPU does math? Not just "it adds numbers" โ but the actual bit-level shift, add, complement, and overflow detection that makes digital arithmetic work? That's what this chapter delivers.
Learning Outcomes โ Bloom's Taxonomy Mapped (12 Outcomes)
| Bloom's Level | Learning Outcome |
|---|---|
| ๐ต Remember | LO1: State the rules for 2's complement representation and list the steps of Booth's algorithm |
| ๐ต Remember | LO2: Recall the IEEE 754 single-precision format โ sign bit, 8-bit exponent (bias 127), 23-bit mantissa |
| ๐ข Understand | LO3: Explain why 2's complement is preferred over sign-magnitude for hardware arithmetic |
| ๐ข Understand | LO4: Describe how overflow is detected in signed addition using carry-in and carry-out of the MSB |
| ๐ก Apply | LO5: Perform binary multiplication using the shift-and-add method with a complete trace table |
| ๐ก Apply | LO6: Execute Booth's algorithm for signed multiplication including negative operands |
| ๐ก Apply | LO7: Carry out restoring and non-restoring division with quotient and remainder |
| ๐ก Apply | LO8: Convert a decimal number to IEEE 754 single-precision floating-point format |
| ๐ Analyse | LO9: Compare restoring vs non-restoring division in terms of steps, complexity, and hardware cost |
| ๐ Analyse | LO10: Analyse Booth's algorithm's advantage when the multiplier has consecutive 1s or 0s |
| ๐ด Evaluate | LO11: Evaluate trade-offs between hardware multiplier (area/speed) vs software multiplication (flexibility) |
| ๐ด Create | LO12: Design and implement a Booth's multiplier simulator in Python |
Concept Explanation โ Computer Arithmetic from First Principles
1. 2's Complement โ Addition, Subtraction & Overflow
Why 2's Complement? Early computers used sign-magnitude (one bit for sign, rest for value). Problem: two representations of zero (+0 and โ0) and complex addition circuits. 2's complement solves both โ it has a single zero and lets us use the same adder circuit for both addition and subtraction.
๐ข 2's Complement Representation Rules
Positive numbers: Same as unsigned binary. E.g., +5 in 4 bits = 0101
Negative numbers: Invert all bits (1's complement) then add 1.
Range: โ2nโ1 to +2nโ1โ1. For 4 bits: โ8 to +7. For 8 bits: โ128 to +127.
Step-by-step: Find 2's complement of โ5 (4 bits)Step 1: Binary of +5 = 0101
Step 2: Invert bits โ 1010 (1's complement)
Step 3: Add 1 โ 1010 + 0001 = 1011
โด โ5 in 2's complement (4 bits) = 1011 โ
Hardware Adder/Subtractor Diagram
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ 4-BIT ADDER / SUBTRACTOR โ โ โ โ Aโ Aโ Aโ Aโ Bโ Bโ Bโ Bโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ M โ โ โ โ โ โ โ โ โ โ โ โ โผ โผ โผ โผ โผ โผ โผ โผ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ 4-BIT PARALLEL ADDER โ โ โ โ FAโ FAโ FAโ FAโ โ โ โ โ C_in โ M โ โ โ โโโโฌโโโโโฌโโโโโฌโโโโโฌโโโโโฌโโโโโโโโโโโโโโโโโโโ โ โ Cโ Sโ Sโ Sโ Sโ โ โ (C_out) โ โ โ โ M = 0 โ Addition: S = A + B โ โ M = 1 โ Subtraction: S = A + Bฬ + 1 = A โ B โ โ โ โ Overflow = CโโCโ (XOR of last two carries) โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Worked Example: 2's Complement Addition (+5) + (โ3) in 4 bits
๐ Given โ Find โ Solve
A = +5 = 0101, B = โ3
A + B using 2's complement addition
Step-by-step:Step 1: +5 = 0101
Step 2: โ3 โ +3 = 0011 โ invert = 1100 โ add 1 = 1101
Step 3: Add:
0 1 0 1 (+5)
+ 1 1 0 1 (โ3)
โโโโโโโโโ
1 0 0 1 0
โ
carry out (discard for 4-bit result)
Result = 0010 = +2 โ
Step 4: Overflow check โ Cโ (carry into MSB) = 1, Cโ (carry out of MSB) = 1 โ XOR = 0 โ No overflow โ
Answer: (+5) + (โ3) = +2 = 0010
Overflow Detection Rules
| Operation | Overflow Condition | Example (4 bits) |
|---|---|---|
| +ve + +ve = โve | Overflow โ | +5 + +4 = 0101+0100 = 1001 (looks like โ7!) |
| โve + โve = +ve | Overflow โ | โ5 + โ4 = 1011+1100 = 10111 โ 0111 (looks like +7!) |
| +ve + โve | Never overflows โ | Signs differ โ result always in range |
Answer: โ128 to +127 (โ2โท to 2โทโ1)
2. Multiplication โ Shift-and-Add Method
Binary multiplication is simpler than decimal multiplication. Since each bit is 0 or 1, each partial product is either zero (multiply by 0) or the multiplicand itself (multiply by 1), shifted to the appropriate position.
โ๏ธ Hardware Multiplier Block Diagram
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HARDWARE MULTIPLIER (n-bit) โ
โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ AC โ โ QR โ โ Qโโ โ โ
โ โ(Accumul.)โ โ(Multipli-โ โ(Extra bitโ โ
โ โ n bits โโโโโโ er) โโโโโโ for Boothโ โ
โ โ โ โ n bits โ โ 1 bit) โ โ
โ โโโโโโฌโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ ADDER โโโโโโโโโโโโโโโโโโโโ โ BR โ โ
โ โ(n-bit) โ โ(Multipli-โ โ
โ โโโโโโโโโโโโ โ cand) โ โ
โ โ n bits โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ SC โ โ Sequence Counter (logโn bits) โ
โ โ(counts โ Starts at n, decrements each step โ
โ โ down) โ โ
โ โโโโโโโโโโโโ โ
โ โ
โ Algorithm: Repeat n times: โ
โ If QRโ = 1 โ AC โ AC + BR โ
โ Shift right (AC, QR) combined โ
โ SC โ SC โ 1 โ
โ Product = {AC, QR} โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Worked Example: 5 ร 7 using Shift-and-Add (4-bit unsigned)
๐ Full Trace Table: 5 ร 7 = 35
Multiplicand (BR) = 7 = 0111, Multiplier (QR) = 5 = 0101
AC = 0000, QR = 0101, SC = 4
| Step | AC | QR | QRโ | Operation | SC |
|---|---|---|---|---|---|
| Init | 0000 | 0101 | 1 | โ | 4 |
| 1a | 0111 | 0101 | 1 | AC โ AC + BR (QRโ=1) | 4 |
| 1b | 0011 | 1010 | โ | Shift right {AC,QR} | 3 |
| 2a | 0011 | 1010 | 0 | No add (QRโ=0) | 3 |
| 2b | 0001 | 1101 | โ | Shift right {AC,QR} | 2 |
| 3a | 1000 | 1101 | 1 | AC โ AC + BR (QRโ=1) | 2 |
| 3b | 0100 | 0110 | โ | Shift right {AC,QR} | 1 |
| 4a | 0100 | 0110 | 0 | No add (QRโ=0) | 1 |
| 4b | 0010 | 0011 | โ | Shift right {AC,QR} | 0 |
Product = {AC, QR} = 0010 0011 = 32 + 2 + 1 = 35 โ
(5 ร 7 = 35)
0101 (two 1s), we did exactly 2 additions. Use this to quickly verify your trace!
3. Booth's Algorithm โ Signed Multiplication
Shift-and-add works for unsigned numbers, but what about signed numbers? Enter Andrew Booth's 1951 algorithm โ elegant, efficient, and still used in modern ARM processors.
โ๏ธ Booth's Algorithm โ Step-by-Step Rules
AC = 0 (n bits), QR = Multiplier (n bits), Qโโ = 0 (extra bit), BR = Multiplicand, SC = n
Repeat n times:1. Examine QRโ (LSB of QR) and Qโโ:
| QRโ | Qโโ | Operation |
|---|---|---|
| 0 | 0 | No operation (just shift) |
| 0 | 1 | AC โ AC + BR (add multiplicand) |
| 1 | 0 | AC โ AC โ BR (subtract multiplicand) |
| 1 | 1 | No operation (just shift) |
2. Arithmetic Shift Right {AC, QR, Qโโ} โ preserve the sign bit of AC!
3. SC โ SC โ 1. If SC โ 0, go to step 1.
4. Product = {AC, QR}
ASCII Block Diagram โ Booth's Hardware
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ BOOTH'S MULTIPLIER HARDWARE โ
โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโ โ
โ โ AC โโโโโบโ QR โโโโโบโ Qโโ โ โ
โ โ(Accumul.)โ โ(Multipli-โ โ(prevโ โ
โ โ n bits โ โ er) โ โ LSB)โ โ
โ โโโโโโฌโโโโโโ โโโโโโโโโโโโ โโโโโโโ โ
โ โ โ
โ โผ โโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโ โ DECISION LOGICโ โ
โ โ ADDER / โ โ โ โ
โ โSUBTRACTRโโโโโโโโโ QRโ Qโโ โ โ
โ โโโโโโฌโโโโโ โ 00 โ NOP โ โ
โ โ โ 01 โ ADD BR โ โ
โ โผ โ 10 โ SUB BR โ โ
โ โโโโโโโโโโโโ โ 11 โ NOP โ โ
โ โ BR โ โโโโโโโโโโโโโโโโโ โ
โ โ(Multipli-โ โ
โ โ cand) โ โโโโโ โ
โ โโโโโโโโโโโโ โSC โ โ Sequence Counter โ
โ โโโโโ โ
โ โ
โ After operation: Arithmetic Shift Right {AC, QR, Qโโ} โ
โ (Sign bit of AC is preserved during shift) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Worked Example: (โ6) ร 7 using Booth's Algorithm (5-bit)
๐ Full Trace Table: (โ6) ร 7 = โ42
Multiplicand (BR) = +7 = 00111, Multiplier (QR) = โ6
โ6 in 2's complement (5 bits): +6 = 00110 โ invert = 11001 โ +1 = 11010
โBR = โ7: invert 00111 = 11000 โ +1 = 11001
AC = 00000, QR = 11010, Qโโ = 0, SC = 5
| Step | AC | QR | Qโโ | QRโ,Qโโ | Operation | SC |
|---|---|---|---|---|---|---|
| Init | 00000 | 11010 | 0 | 0,0 | โ | 5 |
| 1: Check | 00000 | 11010 | 0 | 0,0 | NOP | 5 |
| 1: ASR | 00000 | 01101 | 0 | โ | Arith Shift Right | 4 |
| 2: Check | 00000 | 01101 | 0 | 1,0 | AC โ AC โ BR | 4 |
| 2: Sub | 11001 | 01101 | 0 | โ | AC = 00000+11001 | 4 |
| 2: ASR | 11100 | 10110 | 1 | โ | Arith Shift Right | 3 |
| 3: Check | 11100 | 10110 | 1 | 0,1 | AC โ AC + BR | 3 |
| 3: Add | 00011 | 10110 | 1 | โ | AC = 11100+00111 | 3 |
| 3: ASR | 00001 | 11011 | 0 | โ | Arith Shift Right | 2 |
| 4: Check | 00001 | 11011 | 0 | 1,0 | AC โ AC โ BR | 2 |
| 4: Sub | 11010 | 11011 | 0 | โ | AC = 00001+11001 | 2 |
| 4: ASR | 11101 | 01101 | 1 | โ | Arith Shift Right | 1 |
| 5: Check | 11101 | 01101 | 1 | 1,1 | NOP | 1 |
| 5: ASR | 11110 | 10110 | 1 | โ | Arith Shift Right | 0 |
Product = {AC, QR} = 11110 10110
This is a 10-bit 2's complement number. To verify: invert 1111010110 โ 0000101001 โ +1 โ 0000101010 = 32+8+2 = 42
Product = โ42 โ (โ6 ร 7 = โ42)
11001, after ASR it becomes 11100 (not 01100). Getting this wrong is the #1 error in GATE Booth's questions.
Hint: BR = +4 =
00100, QR = โ3 = 11101. Expected answer: โ12 = 11110 10100 (10-bit).
4. Restoring Division Algorithm
Division is the inverse of multiplication. The hardware divider repeatedly subtracts the divisor from the partial remainder. If the result is negative, we "restore" it (add the divisor back).
๐ Restoring Division โ Algorithm Steps
AC = 0 (n bits), QR = Dividend (n bits), BR = Divisor (n bits), SC = n
Repeat n times:1. Shift Left {AC, QR} by 1 bit
2. AC โ AC โ BR (subtract divisor)
3. If AC is negative (MSB = 1):
โ QRโ = 0 (quotient bit = 0)
โ AC โ AC + BR (restore)
If AC is positive or zero (MSB = 0):
โ QRโ = 1 (quotient bit = 1)
4. SC โ SC โ 1
Result:Quotient = QR, Remainder = AC
Worked Example: 7 รท 3 using Restoring Division (4-bit)
๐ Full Trace Table: 7 รท 3 โ Quotient = 2, Remainder = 1
Dividend (QR) = 7 = 0111, Divisor (BR) = 3 = 0011
โBR = 2's complement of 3: invert 0011 = 1100 โ +1 = 1101
AC = 0000, QR = 0111, SC = 4
| Step | AC | QR | Operation | SC |
|---|---|---|---|---|
| Init | 0000 | 0111 | โ | 4 |
| 1: SHL | 0000 | 111_ | Shift left {AC,QR} | 4 |
0001 | 110_ | (after shift: AC=0000โ1, QR=110_) | ||
| 1: Sub | 1110 | 110_ | AC โ AC โ BR = 0001+1101 | |
| 1: Check | 1110 | 1100 | AC < 0 โ QRโ=0, Restore | |
| 1: Restore | 0001 | 1100 | AC โ AC + BR = 1110+0011 | 3 |
| 2: SHL | 0011 | 100_ | Shift left {AC,QR} | 3 |
| 2: Sub | 0000 | 100_ | AC โ AC โ BR = 0011+1101 | |
| 2: Check | 0000 | 1001 | AC โฅ 0 โ QRโ=1 | 2 |
| 3: SHL | 0001 | 001_ | Shift left {AC,QR} | 2 |
| 3: Sub | 1110 | 001_ | AC โ AC โ BR = 0001+1101 | |
| 3: Check | 1110 | 0010 | AC < 0 โ QRโ=0, Restore | |
| 3: Restore | 0001 | 0010 | AC โ AC + BR = 1110+0011 | 1 |
| 4: SHL | 0010 | 010_ | Shift left {AC,QR} | 1 |
| 4: Sub | 1111 | 010_ | AC โ AC โ BR = 0010+1101 | |
| 4: Check | 1111 | 0100 | AC < 0 โ QRโ=0, Restore | |
| 4: Restore | 0010 | 0100 | AC โ AC + BR = 1111+0011 | 0 |
Wait โ let me recalculate more carefully. Let me redo with proper tracking:
| Step | AC (4-bit + sign) | QR | Action |
|---|---|---|---|
| Init | 00000 | 0111 | AC=0, QR=Dividend=7 |
| 1: SHL | 00000 | 1110 | Left-shift {AC,QR}: AC gets MSB of QR |
| 1: Sub | 11101 | 1110 | AC = 00000 โ 00011 = 11101 (neg) |
| 1: Result | 00000 | 1110 | Negative โ Qโ=0, Restore (AC+BR) |
| 2: SHL | 00001 | 1100 | Left-shift {AC,QR} |
| 2: Sub | 11110 | 1100 | AC = 00001 โ 00011 = 11110 (neg) |
| 2: Result | 00001 | 1100 | Negative โ Qโ=0, Restore |
| 3: SHL | 00011 | 1000 | Left-shift {AC,QR} |
| 3: Sub | 00000 | 1000 | AC = 00011 โ 00011 = 00000 (โฅ0) |
| 3: Result | 00000 | 1001 | Non-negative โ Qโ=1 |
| 4: SHL | 00001 | 0010 | Left-shift {AC,QR} |
| 4: Sub | 11110 | 0010 | AC = 00001 โ 00011 = 11110 (neg) |
| 4: Result | 00001 | 0010 | Negative โ Qโ=0, Restore |
Quotient = QR = 0010 = 2, Remainder = AC = 00001 = 1 โ
(7 รท 3 = 2 remainder 1)
5. Non-Restoring Division Algorithm
Why non-restoring? In restoring division, when AC goes negative, we restore (add BR back) and then in the next step shift left and subtract again. That's 2 additions for a failed step. Non-restoring division skips the restore โ if AC is negative, we add in the next step instead of subtracting. This saves one addition per negative step.
๐ Non-Restoring Division โ Algorithm
Same as restoring: AC = 0, QR = Dividend, BR = Divisor, SC = n
Repeat n times:1. Shift Left {AC, QR}
2. If AC is positive or zero: AC โ AC โ BR
If AC is negative: AC โ AC + BR
3. If AC is positive or zero โ QRโ = 1
If AC is negative โ QRโ = 0
4. SC โ SC โ 1
After loop:If AC is negative, restore it once: AC โ AC + BR
Quotient = QR, Remainder = AC
Worked Example: 7 รท 3 using Non-Restoring Division (comparison)
๐ Trace Table: 7 รท 3 (Non-Restoring)
QR = 7 = 0111, BR = 3 = 0011
| Step | AC (5-bit) | QR | Operation |
|---|---|---|---|
| Init | 00000 | 0111 | AC=0 (positive) |
| 1: SHL | 00000 | 1110 | Shift left |
| 1: Op | 11101 | 1110 | ACโฅ0 โ ACโBR = 00000โ00011 |
| 1: Qโ | 11101 | 1110 | AC<0 โ Qโ=0 |
| 2: SHL | 11011 | 1100 | Shift left |
| 2: Op | 11110 | 1100 | AC<0 โ AC+BR = 11011+00011 |
| 2: Qโ | 11110 | 1100 | AC<0 โ Qโ=0 |
| 3: SHL | 11101 | 1000 | Shift left |
| 3: Op | 00000 | 1000 | AC<0 โ AC+BR = 11101+00011 |
| 3: Qโ | 00000 | 1001 | ACโฅ0 โ Qโ=1 |
| 4: SHL | 00001 | 0010 | Shift left |
| 4: Op | 11110 | 0010 | ACโฅ0 โ ACโBR = 00001โ00011 |
| 4: Qโ | 11110 | 0010 | AC<0 โ Qโ=0 |
| Final | 00001 | 0010 | AC<0 โ Restore: AC+BR |
Quotient = 0010 = 2, Remainder = 00001 = 1 โ
โ Same result, fewer additions!
Restoring vs Non-Restoring โ Comparison
| Parameter | Restoring Division | Non-Restoring Division |
|---|---|---|
| Restore step | Required after every negative AC | Not required (skipped) |
| Operations per cycle | Up to 2 (subtract + restore) | Exactly 1 (add or subtract) |
| Speed | Slower (more additions) | Faster |
| Hardware complexity | Simpler control logic | Slightly more complex |
| Final correction | Not needed | May need one final restore if AC < 0 |
| GATE frequency | Very common (2โ3 marks) | Moderate (1โ2 marks) |
6. IEEE 754 Floating-Point Representation
Integers are fine for counting, but what about 3.14159 or 0.000001? That's where floating-point comes in. The IEEE 754 standard (1985, revised 2008) defines how every computer in the world stores decimal numbers.
๐ IEEE 754 Single-Precision Format (32 bits)
โโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ S โ Exponent โ Mantissa โ โ1b โ 8 bits โ 23 bits โ โโโโโผโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ31 โ 30 โโโโ 23 โ 22 โโโโโโโโโโโโโโโโ 0 โ โโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Value = (โ1)หข ร 1.Mantissa ร 2^(Exponent โ 127) S = 0 โ Positive S = 1 โ Negative Exponent: Biased by 127 (actual = stored โ 127) Mantissa: Fractional part after "1." (implicit leading 1)
Worked Example: Convert 13.75 to IEEE 754 Single Precision
๐ Step-by-Step: 13.75โโ โ IEEE 754
13.75 is positive โ S = 0
Integer part: 13 = 1101
Fractional part: 0.75 โ 0.75 ร 2 = 1.5 โ 1 | 0.5 ร 2 = 1.0 โ 1 | Done
0.75โโ = .11โ
โด 13.75 = 1101.11โ
1101.11 = 1.10111 ร 2ยณ
Move point 3 places left โ exponent = 3
Step 4: Biased exponentStored exponent = actual + bias = 3 + 127 = 130 = 10000010
After "1." โ 10111 padded to 23 bits โ 10111000000000000000000
S Exponent Mantissa 0 10000010 10111000000000000000000 Full: 0 10000010 10111000000000000000000 Hex: 0x41 5C 00 00
13.75โโ = 0 10000010 10111000000000000000000 (IEEE 754) โ
IEEE 754 Special Values
| Value | Sign | Exponent (8 bits) | Mantissa (23 bits) | Meaning |
|---|---|---|---|---|
| +0 | 0 | 00000000 | 00000...0 | Positive zero |
| โ0 | 1 | 00000000 | 00000...0 | Negative zero |
| +โ | 0 | 11111111 | 00000...0 | Positive infinity (e.g., 1/0) |
| โโ | 1 | 11111111 | 00000...0 | Negative infinity |
| NaN | 0 or 1 | 11111111 | non-zero | Not a Number (0/0, โโ1) |
| Denormalised | 0 or 1 | 00000000 | non-zero | Very small numbers near 0 |
10111..., the actual value is 1.10111.... This gives you 24 bits of precision from a 23-bit field (free extra bit!).
Approach: S=1, 27.625 = 11011.101โ = 1.1011101 ร 2โด, Exp = 4+127 = 131 = 10000011, Mantissa = 10111010...0
Answer:
0xC1DC0000
Learn by Doing โ 3-Tier Lab Structure
๐ข Tier 1 โ GUIDED LAB: Binary Arithmetic by Hand
Exercise 1: 2's Complement Conversions
Convert each to 8-bit 2's complement:
- +45 โ
00101101(verify: 32+8+4+1) - โ45 โ Invert
00101101=11010010, +1 =11010011 - โ128 โ
10000000(the most negative 8-bit number) - +127 โ
01111111(the most positive 8-bit number)
Exercise 2: Addition with Overflow Check
Add in 8-bit 2's complement. Check for overflow.
- (+100) + (+30) โ Does this overflow? (Hint: 130 > 127)
- (โ50) + (โ80) โ Does this overflow? (Hint: โ130 < โ128)
- (+100) + (โ30) โ Overflow? (Hint: signs differ โ never)
Exercise 3: Manual Binary Multiplication
Multiply 6 ร 5 using shift-and-add (4-bit). Draw the trace table.
Expected: Product = 30 = 00011110
0101 has two 1s โ 2 additions).
๐ก Tier 2 โ SEMI-GUIDED LAB: Booth's Algorithm Trace
Your Mission:
Trace Booth's algorithm for the following multiplications. Draw the complete table with AC, QR, Qโโ, Operation columns.
- Easy: (+3) ร (+4) = +12 (use 5-bit representation)
- Medium: (โ4) ร (+5) = โ20 (use 5-bit)
- Hard: (โ7) ร (โ3) = +21 (use 5-bit โ both operands negative!)
Hints:
- For (โ7) ร (โ3): BR = โ3 =
11101, QR = โ7 =11001 - Remember: Arithmetic shift right preserves the sign bit
- The QRโ,Qโโ decision: 10โsubtract, 01โadd, 00/11โNOP
๐ด Tier 3 โ OPEN CHALLENGE: Python Booth's Multiplier Simulator
Build a Python program that:
- Takes two signed integers as input
- Converts them to n-bit 2's complement
- Executes Booth's algorithm step-by-step
- Prints the trace table at each step (AC, QR, Qโโ, operation)
- Outputs the final product in both binary and decimal
Starter Code:
Python def booths_multiply(multiplicand, multiplier, n_bits=8): # Step 1: Convert to 2's complement def to_twos_comp(val, bits): if val >= 0: return format(val, f'0{bits}b') return format((1 << bits) + val, f'0{bits}b') # Step 2: Initialize registers AC = [0] * n_bits # Accumulator QR = list(map(int, to_twos_comp(multiplier, n_bits))) Q_minus1 = 0 BR = list(map(int, to_twos_comp(multiplicand, n_bits))) SC = n_bits print(f"Init: AC={''.join(map(str,AC))} QR={''.join(map(str,QR))} Q-1={Q_minus1}") # Step 3: YOUR CODE HERE # Implement the Booth's loop: # - Check QR[-1] and Q_minus1 # - Add/Subtract/NOP # - Arithmetic Shift Right # - Print trace at each step # Test booths_multiply(7, -6) # Expected: -42 booths_multiply(-3, -7) # Expected: +21
Practice Problems โ Diagrams, Numericals & GATE
Diagram-Based Questions (3)
๐ Diagram Q1: Draw the hardware block diagram for a 4-bit Booth's multiplier
Required components: AC register (4-bit), QR register (4-bit), Qโโ flip-flop, BR register (4-bit), Adder/Subtractor, Sequence Counter (SC), Control Logic, Arithmetic Shift Right circuit.
Show: Data paths between registers, control signals for add/subtract/shift, and the decision logic based on {QRโ, Qโโ}.
๐ Diagram Q2: Draw the IEEE 754 format layout with bit positions
Show the 32-bit layout with Sign (bit 31), Exponent (bits 30โ23), and Mantissa (bits 22โ0). Label the bias value (127), the implicit "1." convention, and mark which bit combinations represent +โ, โโ, NaN, and ยฑ0.
๐ Diagram Q3: Draw the flowchart for restoring division algorithm
Include: Start โ Initialize (AC=0, QR=Dividend, SC=n) โ Shift Left โ Subtract BR โ Check sign โ Branch (Restore or Set Qโ) โ Decrement SC โ Loop check โ Output Quotient and Remainder.
Numerical Problems (6)
๐ข Numerical 1: Booth's Multiplication โ (โ5) ร 3
Work it out: BR = 00011, QR = โ5 = 11011. Trace 5 steps. Product {AC,QR} should decode to โ15.
๐ข Numerical 2: Booth's Multiplication โ (โ4) ร (โ6)
Hint: BR = โ6 = 11010, QR = โ4 = 11100. Remember โBR = +6 = 00110.
๐ข Numerical 3: Restoring Division โ 11 รท 3
1011, Divisor = 3 = 0011
Expected: Quotient = 3 (0011), Remainder = 2 (0010)
Verify: 3 ร 3 + 2 = 11 โ
๐ข Numerical 4: Non-Restoring Division โ 15 รท 5
1111, Divisor = 5 = 0101
Expected: Quotient = 3 (0011), Remainder = 0
๐ข Numerical 5: IEEE 754 โ Convert โ27.625 to single precision
1. S = 1 (negative)
2. 27 = 11011, 0.625 = .101 โ 27.625 = 11011.101
3. Normalise: 1.1011101 ร 2โด
4. Exponent: 4 + 127 = 131 = 10000011
5. Mantissa: 10111010000000000000000
1 10000011 10111010000000000000000 = 0xC1DD0000
๐ข Numerical 6: IEEE 754 โ What decimal does this represent?
0 10000001 01000000000000000000000
S = 0 (positive), Exponent = 10000001 = 129, Actual = 129 โ 127 = 2
Mantissa = 1.01 (with implicit 1)
Value = (+1) ร 1.01โ ร 2ยฒ = 1.25 ร 4 = 5.0
Industry Application Questions (3)
๐ญ Industry Q1: ARM Cortex Multiplier
The ARM Cortex-A78 uses a modified Booth's encoding (radix-4 Booth) to reduce the number of partial products by half. If a standard 32-bit Booth's multiplication requires 32 cycles, how many cycles does radix-4 Booth require? Explain the trade-off.
Answer: Radix-4 examines 2 bits at a time โ 16 cycles (half). Trade-off: simpler control but needs a more complex partial product generator (ยฑ1ร, ยฑ2ร multiplicand).
๐ญ Industry Q2: GPU Floating-Point
NVIDIA's RTX 4090 GPU has 16,384 CUDA cores, each capable of performing one IEEE 754 single-precision multiply-add per cycle at 2.52 GHz. Calculate the theoretical peak FLOPS (Floating-Point Operations Per Second).
Answer: 16384 ร 2 (multiply+add) ร 2.52 ร 10โน = 82.6 TFLOPS
๐ญ Industry Q3: ISRO Navigation
Chandrayaan-3's onboard computer used fixed-point arithmetic for trajectory calculations instead of floating-point. Why might ISRO prefer fixed-point for space applications? What are the trade-offs?
Answer: Fixed-point is deterministic (no rounding surprises), uses less power, has predictable timing (critical for real-time control), and simpler hardware. Trade-off: limited range and precision compared to floating-point.
GATE Practice Questions (5)
11001011 is:(a) โ53 (b) โ52 (c) +203 (d) โ51
Answer: (a) MSB=1 โ negative. Invert: 00110100, +1 = 00110101 = 53. So value = โ53.
Answer: +45. (Both negative โ positive product. Trace carefully with ASR.)
10000100 represents an actual exponent of:(a) 132 (b) 5 (c) โ123 (d) 4
Answer: (b) 10000100โ = 132. Actual = 132 โ 127 = 5.
Answer: Quotient = 2 (
0010), Remainder = 3 (0011). Verify: 2ร5+3 = 13 โ
0 11111111 00000000000000000000000 represents:(a) +โ (b) โโ (c) NaN (d) Largest positive number
Answer: (a) +โ. When exponent = all 1s and mantissa = all 0s, it represents infinity. Sign bit 0 โ positive infinity.
MCQ Assessment Bank โ 30 Questions (Bloom's Mapped)
Remember / Identify (Q1โQ5)
In 2's complement representation, the range for an 8-bit number is:
- 0 to 255
- โ127 to +127
- โ128 to +127
- โ128 to +128
In Booth's algorithm, when QRโ = 1 and Qโโ = 0, the operation performed is:
- AC โ AC + BR
- AC โ AC โ BR
- No operation
- Shift left
The bias value in IEEE 754 single-precision floating-point is:
- 126
- 127
- 128
- 255
In restoring division, what operation is performed when the partial remainder becomes negative?
- Shift right and set quotient bit to 1
- Add divisor back (restore) and set quotient bit to 0
- Subtract divisor again
- Halt the operation
The 2's complement of the binary number 0001 (4 bits) is:
- 1110
- 1111
- 0001
- 1000
Understand / Explain (Q6โQ10)
Why is 2's complement preferred over sign-magnitude in hardware?
- It uses fewer bits
- It has a unique representation for zero and uses the same adder for add/subtract
- It can represent larger numbers
- It is easier for humans to read
In Booth's algorithm, why does the pair (0,1) trigger addition while (1,0) triggers subtraction?
- It's an arbitrary convention
- (0,1) marks the end of a block of 1s, (1,0) marks the beginning โ mimicking add-at-end, subtract-at-start
- It reduces hardware cost
- It's required for unsigned numbers only
What does the implicit leading "1" in IEEE 754 mantissa achieve?
- Saves 1 bit of storage, giving 24 bits of precision with a 23-bit field
- Makes the number always positive
- Prevents overflow
- Simplifies exponent calculation
Why does non-restoring division require a final correction step?
- Because the quotient might be wrong
- Because the remainder may be negative at the end, which needs to be corrected by adding the divisor
- Because the divisor changes during division
- It doesn't โ no correction is needed
Overflow in 2's complement addition occurs when:
- There is a carry out of the MSB
- Two numbers with different signs are added
- The carry into the MSB differs from the carry out of the MSB
- The result is zero
Apply / Calculate (Q11โQ17)
What is the 2's complement of โ42 in 8 bits?
- 00101010
- 11010110
- 11010101
- 10101010
Using shift-and-add, how many addition operations are needed to multiply by the number 01011010?
- 3
- 4
- 5
- 8
Convert 6.25 to IEEE 754 single-precision. What is the biased exponent?
- 127
- 128
- 129
- 130
In Booth's algorithm for (+7) ร (+3) using 4-bit, the first step checks QRโ=1, Qโโ=0. What operation is performed?
- Add BR to AC
- Subtract BR from AC
- No operation
- Complement QR
What is the result of adding 01110 and 00101 in 5-bit 2's complement?
- 10011 (overflow)
- 10011 (valid negative)
- 01011 (no overflow)
- Cannot determine
Using restoring division, divide 9 by 4 (4-bit). The quotient is:
- 0010 (2)
- 0011 (3)
- 0001 (1)
- 0100 (4)
The IEEE 754 representation of +โ is:
- 0 11111111 00000000000000000000000
- 0 00000000 00000000000000000000000
- 0 11111111 10000000000000000000000
- 1 11111111 00000000000000000000000
Analyse / Compare (Q18โQ22)
For the multiplier 11111110 (8-bit), Booth's algorithm performs how many add/subtract operations?
- 7 (one per 1-bit)
- 2 (one subtract at start, one add at end of the block)
- 6
- 8
Which division method requires more addition/subtraction operations on average?
- Non-restoring (it sometimes adds and subtracts in same step)
- Restoring (it needs an extra restore step for every negative remainder)
- Both require exactly the same number
- It depends on the dividend only
A system uses IEEE 754 single precision. Two numbers x = 1.0 ร 2ยฒยณ and y = 1.0 are added. What is the result?
- Exactly 8388609.0
- 8388608.0 (y is lost due to precision)
- Infinity
- NaN
Compare shift-and-add vs Booth's for multiplying by 01010101. Which is more efficient?
- Shift-and-add (fewer shifts)
- Booth's (fewer add/subtract operations)
- Both are equally efficient
- Neither works for this pattern
01010101, shift-and-add does 4 additions (four 1s). Booth's sees transitions 01,10,01,10,01,10,01,10 โ 4 subtracts + 4 adds = 8 operations! For alternating patterns, Booth's is actually worse. It excels with consecutive 1s.In a processor with a 3 ns multiply and 12 ns divide, what is the multiplication-to-division speed ratio?
- 4:1
- 1:4
- 3:1
- 1:3
Evaluate / Justify (Q23โQ26)
A designer must choose between a hardware multiplier (costs 10,000 gates, 1 cycle) and software multiplication (0 extra gates, 32 cycles). For a real-time audio DSP processing 44,100 samples/sec, which is justified?
- Software โ saves chip area
- Hardware โ 32-cycle latency would miss the real-time deadline
- Either works equally well
- Use a lookup table instead
IEEE 754 has both +0 and โ0. This causes problems for which operation?
- Addition
- Comparison (is โ0 == +0?)
- Multiplication
- Bit-shifting
For ISRO's satellite orbit calculation requiring 15 significant decimal digits, which format is appropriate?
- IEEE 754 single precision (32-bit)
- IEEE 754 double precision (64-bit)
- Fixed-point 16-bit
- BCD (Binary-Coded Decimal)
A student claims "Booth's algorithm always performs fewer operations than shift-and-add." Is this correct?
- Yes, always
- No โ for alternating bit patterns (like 010101), Booth's can do more operations
- No โ Booth's always does more operations
- They always do the same number
Create / Design (Q27โQ30)
To design an overflow detection circuit for an n-bit 2's complement adder, you need:
- An AND gate on the two MSBs
- An XOR gate between the carry-in and carry-out of the MSB position
- A NOT gate on the result MSB
- A comparator for the full result
You are designing a floating-point unit. To handle the special case of 0 รท 0, the output should be:
- +0
- +โ
- NaN (Not a Number)
- An error signal halting the CPU
To optimise Booth's algorithm for a multiplier like 00111100, how many add/subtract operations are needed?
- 4
- 2
- 6
- 8
You need to design a divider that completes in exactly n cycles regardless of inputs. Which algorithm should you choose?
- Restoring division
- Non-restoring division
- Repeated subtraction
- Newton-Raphson division
Short Answer Questions (8)
SA1: What is 2's complement and why is it used?
2's complement is a binary number representation where negative numbers are obtained by inverting all bits of the positive form and adding 1. It is used because:
- Single zero: Unlike sign-magnitude (which has +0 and โ0), 2's complement has only one zero representation
- Unified hardware: The same adder circuit handles both addition and subtraction (subtraction = adding the 2's complement)
- Simple overflow detection: XOR of the last two carries gives the overflow flag
Example: โ5 in 8-bit 2's complement: +5 = 00000101 โ invert โ 11111010 โ +1 โ 11111011
SA2: State the rules of Booth's algorithm. When does it add? When does it subtract?
Booth's algorithm examines two bits โ the current LSB (QRโ) and the previous LSB (Qโโ):
00โ No operation (middle of a block of 0s)11โ No operation (middle of a block of 1s)10โ Subtract multiplicand from AC (start of a block of 1s)01โ Add multiplicand to AC (end of a block of 1s)
After the operation, perform arithmetic shift right (preserving sign bit) on {AC, QR, Qโโ}. Repeat n times. Product = {AC, QR}.
SA3: How is overflow detected in 2's complement addition?
Overflow occurs when the carry into the MSB position (C_{n-1}) differs from the carry out of the MSB (C_n):
Overflow = C_{n-1} โ C_n
Intuitively: overflow happens when adding two positive numbers gives a negative result, or adding two negative numbers gives a positive result. Adding numbers of different signs never overflows.
SA4: What is the difference between arithmetic shift right and logical shift right?
Logical Shift Right (LSR): Fills the vacated MSB with 0. Used for unsigned numbers.
Arithmetic Shift Right (ASR): Fills the vacated MSB with the sign bit (preserves the sign). Used for signed numbers.
Example: 11010 (โ6 in 5-bit 2's complement)
- LSR โ
01101(+13 โ wrong! sign changed) - ASR โ
11101(โ3 โ correct! equivalent to รท2 with rounding toward โโ)
Booth's algorithm must use ASR to maintain correctness with signed numbers.
SA5: Explain the IEEE 754 single-precision format with field sizes.
IEEE 754 single precision uses 32 bits divided into three fields:
- Sign (S): 1 bit (bit 31). 0 = positive, 1 = negative.
- Exponent (E): 8 bits (bits 30โ23). Biased by 127. Actual exponent = E โ 127.
- Mantissa (M): 23 bits (bits 22โ0). Stores the fractional part after an implicit leading 1.
Value = (โ1)^S ร 1.M ร 2^(Eโ127)
Range: โ ยฑ1.18 ร 10โปยณโธ to ยฑ3.4 ร 10ยณโธ. Precision: ~7 decimal digits.
SA6: Why is non-restoring division faster than restoring division?
In restoring division, when the partial remainder goes negative, two operations are needed: (1) restore (add divisor back) and (2) proceed to next step. This means some cycles need 2 additions.
In non-restoring division, when the partial remainder is negative, we skip the restore and instead add in the next step (rather than subtract). This ensures exactly one operation per cycle.
However, non-restoring may require a final correction step if the remainder is negative at the end.
SA7: What are NaN and Infinity in IEEE 754? Give examples of operations that produce them.
Infinity (โ): Exponent = all 1s (255), Mantissa = all 0s. Produced by: 1.0 รท 0.0 = +โ, overflow of a very large computation.
NaN (Not a Number): Exponent = all 1s (255), Mantissa โ 0. Produced by: 0.0 รท 0.0, โ(โ1), โ โ โ, โ ร 0.
NaN has a special property: NaN โ NaN (it's not equal to anything, including itself). This is used in programming to detect invalid results: if (x != x) means x is NaN.
SA8: What is the "kirana shopkeeper" analogy for Booth's algorithm?
Imagine buying 9 packets of โน100 biscuits. Method 1 (shift-and-add): add โน100 nine times = 9 operations. Method 2 (Booth's): โน1000 โ โน100 = โน900 โ only 2 operations (one add + one subtract).
Booth's algorithm uses the same trick: instead of adding the multiplicand for each consecutive 1 in the multiplier, it subtracts at the start of a block of 1s and adds at the end. For a multiplier like 01111110 (six consecutive 1s), shift-and-add does 6 additions, but Booth's does only 1 subtract + 1 add = 2 operations.
Long Answer Questions (3)
LA1: Explain Booth's Algorithm with a complete trace for (โ7) ร (5). Draw the hardware block diagram. (10 marks)
Introduction: Booth's algorithm (1951) handles signed binary multiplication by detecting transitions in multiplier bits. It operates on 2's complement numbers and uses arithmetic shift right.
Hardware Components:
- AC (Accumulator): n-bit register, initialized to 0
- QR (Multiplier Register): holds the multiplier
- Qโโ: 1-bit flip-flop, initialized to 0
- BR (Multiplicand Register): holds the multiplicand
- SC (Sequence Counter): counts down from n
- Adder/Subtractor: performs AC ยฑ BR
Algorithm:
- Check QRโ and Qโโ: (1,0)โsubtract, (0,1)โadd, (0,0)/(1,1)โNOP
- Arithmetic shift right {AC, QR, Qโโ}
- Decrement SC. Repeat until SC = 0.
Trace for (โ7) ร 5:
BR = +5 = 01001 (5-bit), QR = โ7 = 11001, โBR = 10111
| Step | AC | QR | Qโโ | {QRโ,Qโโ} | Operation |
|---|---|---|---|---|---|
| Init | 00000 | 11001 | 0 | 1,0 | โ |
| 1 | 10111 | 11001 | 0 | โ | ACโBR (subtract) |
| 1 ASR | 11011 | 11100 | 1 | 0,1 | Shift right |
| 2 | 00100 | 11100 | 1 | โ | AC+BR (add) |
| 2 ASR | 00010 | 01110 | 0 | 0,0 | Shift right |
| 3 | 00010 | 01110 | 0 | โ | NOP |
| 3 ASR | 00001 | 00111 | 0 | 1,0 | Shift right |
| 4 | 11100 | 00111 | 0 | โ | ACโBR (subtract) |
| 4 ASR | 11110 | 00011 | 1 | 1,1 | Shift right |
| 5 | 11110 | 00011 | 1 | โ | NOP |
| 5 ASR | 11111 | 00001 | 1 | โ | Shift right |
Product = {AC,QR} = 11111 00001. Converting: invert 10-bit โ 0000011110, +1 โ 0000011111 = 31. Negative โ โ35.
Verification: โ7 ร 5 = โ35 โ
LA2: Compare Restoring and Non-Restoring Division with traced examples. (10 marks)
Restoring Division: After subtracting the divisor, if the partial remainder is negative, restore it by adding the divisor back. Set quotient bit = 0.
Non-Restoring Division: Don't restore. If remainder is negative, add (instead of subtract) in the next step. Saves one operation per negative remainder.
Key Differences:
| Aspect | Restoring | Non-Restoring |
|---|---|---|
| Operations/cycle (worst case) | 2 (sub + restore) | 1 (add or sub) |
| Control logic | Simpler | Needs sign-based decision |
| Speed | Slower | Faster |
| Final correction | Not needed | May need 1 restore at end |
Example (7รท3) was traced in Section C. Both methods produce Quotient = 2, Remainder = 1. Non-restoring reaches the same answer with fewer total additions.
Hardware: Both use AC (accumulator), QR (dividend/quotient), BR (divisor), and a shift-left mechanism. Non-restoring adds a MUX to select between add/subtract based on AC's sign bit.
LA3: Explain IEEE 754 floating-point format. Convert โ19.6875 to IEEE 754 single precision. (10 marks)
IEEE 754 Format: 32 bits = 1 sign + 8 exponent + 23 mantissa.
Value = (โ1)^S ร 1.M ร 2^(Eโ127)
Conversion of โ19.6875:
Step 1 โ Sign: Negative โ S = 1
Step 2 โ Integer part: 19 = 10011โ
Step 3 โ Fractional part: 0.6875:
- 0.6875 ร 2 = 1.375 โ 1
- 0.375 ร 2 = 0.75 โ 0
- 0.75 ร 2 = 1.5 โ 1
- 0.5 ร 2 = 1.0 โ 1
0.6875โโ = .1011โ
Step 4 โ Combined: 19.6875 = 10011.1011โ
Step 5 โ Normalise: 1.00111011 ร 2โด
Step 6 โ Biased exponent: 4 + 127 = 131 = 10000011โ
Step 7 โ Mantissa: 00111011000000000000000 (23 bits)
Final:
1 | 10000011 | 00111011000000000000000 S Exponent Mantissa
Hex: 0xC19D8000
Special Values: +โ (E=FF, M=0), โโ (S=1, E=FF, M=0), NaN (E=FF, Mโ 0), ยฑ0 (E=0, M=0), Denormalised (E=0, Mโ 0, implicit 0. instead of 1.)
Industry Spotlight โ A Day in the Life
๐ฉโ๐ป Ananya Rao, 29 โ VLSI Design Engineer at ISRO Satellite Centre (URSC), Bangalore
Background: B.Tech ECE from NIT Trichy. Fascinated by computer architecture from 2nd year. Did an internship at CDAC Trivandrum working on processor design. Cleared ISRO Scientist/Engineer exam in 2019.
A Typical Day:
9:00 AM โ Arrive at URSC, Bangalore. Morning team meeting to discuss progress on the onboard computer module for India's next Earth observation satellite.
10:00 AM โ Working on the arithmetic logic unit (ALU) design in Verilog HDL. Today's task: optimise the Booth's multiplier for lower power consumption. "Space-grade processors must work on solar power โ every milliwatt counts."
12:00 PM โ Run gate-level simulation of the 32-bit multiplier. Verify timing meets the 50 MHz clock requirement. "The same Booth's algorithm I studied in COA class โ now I'm implementing it in actual silicon."
2:00 PM โ Lunch at the ISRO canteen. Discuss radiation-hardened design techniques with a senior engineer. Space processors face cosmic ray bit-flips!
3:00 PM โ Design review with the verification team. They found a corner case: when both inputs are the most negative number (โ2ยณยน), the multiplier output overflows. Need to add overflow detection logic.
5:30 PM โ Document the design changes in the engineering notebook. Update the Verilog testbench with new test vectors.
6:30 PM โ Study session for upcoming M.Tech entrance (ISRO sponsors higher education). Reading about IEEE 754 floating-point unit design for future satellite navigation systems.
| Detail | Info |
|---|---|
| Tools Used Daily | Verilog HDL, Xilinx Vivado, ModelSim, MATLAB (for algorithm verification), Python |
| Entry Salary (ISRO SC/Engineer) | โน56,100/month (Level 10, 7th CPC) + DA + HRA โ โน10โ12 LPA |
| Mid-Level (5โ8 yrs) | โน15โ20 LPA + ISRO housing |
| Similar Roles | DRDO, CDAC, Qualcomm India (Hyderabad), Intel (Bangalore), Samsung Semiconductor |
| Key COA Topics Used | Booth's multiplication, ALU design, overflow detection, IEEE 754, pipeline hazards |
Earn With It โ GATE Coaching COA Section
๐ฐ Your Earning Path: GATE Coaching โ COA Arithmetic Section
Portfolio Piece: A comprehensive Computer Arithmetic study guide with hand-traced examples for Booth's, restoring division, and IEEE 754 โ exactly what GATE aspirants pay โน15,000โโน50,000 to coaching institutes for.
Earning Opportunities:
โข Online tutoring: Teach COA arithmetic on Chegg/Doubtnut/Toppr โ โน500โโน1,500/hour for solving GATE-level numerical questions
โข YouTube content: Create "Booth's Algorithm in 10 minutes" videos โ monetisable at 10K+ subscribers
โข Udemy course: "GATE COA: Computer Arithmetic Masterclass" โ 50 numerical problems with video solutions, price โน499โโน999
โข Freelance content: Write COA study material for Unacademy/BYJU'S/Physics Wallah โ โน2,000โโน5,000 per chapter
| Platform | What to Create | Earning Potential |
|---|---|---|
| Chegg / Bartleby | Solve COA numerical questions | โน200โโน500/question |
| YouTube | Booth's / IEEE 754 tutorials | โน5,000โโน20,000/month (at scale) |
| Udemy / Skillshare | Full COA arithmetic course | โน10,000โโน50,000/month |
| Instagram / Telegram | Daily GATE MCQ + solutions | Sponsorships โน5,000โโน15,000/month |
| Freelance Writing | Study notes for coaching platforms | โน2,000โโน5,000/chapter |
Chapter Summary
๐ Key Takeaways โ Computer Arithmetic
1. 2's Complement
- Negative numbers: invert all bits + add 1
- Range (n bits): โ2โฟโปยน to +2โฟโปยนโ1
- Overflow = C_in(MSB) โ C_out(MSB)
- Same adder works for both addition and subtraction
2. Shift-and-Add Multiplication
- For unsigned numbers only
- Check LSB of multiplier: if 1 โ add multiplicand; then shift right
- Number of additions = number of 1s in multiplier
- Product stored in {AC, QR}
3. Booth's Algorithm
- Works for signed numbers (2's complement)
- Examines bit pairs: (1,0)โsubtract, (0,1)โadd, othersโNOP
- Uses arithmetic shift right (sign-preserving)
- Efficient for multipliers with consecutive 1s
- Kirana shopkeeper analogy: 9ร100 = 10ร100 โ 1ร100
4. Restoring Division
- Shift left, subtract divisor, check sign
- If negative: restore (add back) + Qโ=0
- If positive: Qโ=1
- Verify: Dividend = Quotient ร Divisor + Remainder
5. Non-Restoring Division
- Skip restore; add (instead of subtract) next time if negative
- Faster: exactly 1 operation per cycle
- May need final correction
6. IEEE 754 Single Precision
- 32 bits: 1 sign + 8 exponent (bias 127) + 23 mantissa
- Value = (โ1)^S ร 1.M ร 2^(Eโ127)
- Special: โ (E=FF,M=0), NaN (E=FF,Mโ 0), ยฑ0 (E=0,M=0)
- Implicit leading 1 gives 24-bit precision from 23-bit field
Formula Quick Reference
| Formula | Usage |
|---|---|
โN = ~N + 1 | 2's complement negation |
Overflow = C_{n-1} โ C_n | Overflow detection |
Biased Exp = Actual + 127 | IEEE 754 exponent encoding |
Value = (โ1)^S ร 1.M ร 2^(Eโ127) | IEEE 754 to decimal |
Dividend = Q ร Divisor + R | Division verification |
Earning Checkpoint โ Self Assessment
| Skill | Practice Done? | Artefact Created | Earn-Ready? |
|---|---|---|---|
| 2's Complement Conversions | Conceptual | Hand-traced examples | โ Can solve GATE questions |
| Shift-and-Add Multiplication | Paper trace | Trace table for 5ร7 | โ Can explain in tutorials |
| Booth's Algorithm | Paper + Python | Trace table + simulator code | โ YouTube/Chegg content-ready |
| Restoring Division | Paper trace | Trace table for 7รท3 | โ Can teach doubt sessions |
| Non-Restoring Division | Paper trace | Comparison table | โ GATE coaching material |
| IEEE 754 Conversion | Numerical practice | Step-by-step solutions | โ Can create cheat sheets |
| Python Booth's Simulator | Coding lab | GitHub repository | โ Portfolio piece for jobs |
โ Unit 7 complete. You now understand how every CPU on Earth does arithmetic!
[QR: Link to EduArtha video tutorial โ Computer Arithmetic Algorithms]