Week 5-2: Binary Arithmetic and Arithmetic Circuits Study Guide

Course Information and Learning Outcomes

  • CLO2: Understand number systems and convert numbers from one system to another to find equivalent values.

  • CLO3: Describe the functioning of various fundamental combinational and sequential components of digital circuits, writing truth tables and their corresponding Boolean equations.

  • CLO4: Solve Boolean equations for a given circuit using simplification techniques, specifically Boolean algebra and Karnaugh map (K-map) techniques.

  • CLO5: Use manufacturers' data sheets, application notes, and other sources of technical information to design digital circuits.

  • CLO6: Write truth tables for a given digital control problem to develop a Boolean equation that leads to a functional simplified digital circuit, and verify circuit functions by simulation models.

  • CLO7: Verify the functioning of various digital circuits by wiring on breadboards in the laboratory and by developing simulation models using Proteus software.

  • CLO8: Communicate the results and observations of laboratory work clearly using industry-standard terminology.

  • CLO10: Understand the basic concepts of microcontrollers and Field-Programmable Gate Arrays (FPGAs) to develop simple applications.

Fundamentals of Number Systems

  • Definition: Number systems are structured methods for representing numbers using a consistent, standardized set of symbols or digits. They serve as the foundational bedrock of mathematics and computing, providing the structure required for data processing and arithmetic computation.

  • Key Number Systems in Computing:

    • Decimal (Base 1010): Everyday counting system employing digits 00 through 99.

    • Binary (Base 22): Foundational computing system utilizing two digits, 00 and 11, which directly correspond to the physical ON/OFF, HIGH/LOW, or TRUE/FALSE states of electronic switches in digital hardware.

    • Octal (Base 88): Uses digits 00 through 77; primarily used to simplify binary representations by condensing three-bit groups (23=82^3 = 8).

    • Hexadecimal (Base 1616): Uses digits 00 through 99 and letters AA through FF; widely used in computing for memory addressing and condensing four-bit binary nibbles (24=162^4 = 16).

Classification of standard number systems

Binary System Architecture and Positional Notation

  • Positional Weight Principle:

    • The binary system is a Base 22 positional numeral system.

    • Integer column weights are positive powers of two that increase from right to left, starting with 20=12^0 = 1.

    • Fractional column weights are negative powers of two that decrease from left to right, starting immediately following the binary point with 2−1=0.52^{-1} = 0.5.

  • Integer Bit Positions and Column Weights:

    • Bit position 00 (Least Significant Bit [LSB]): 20=12^0 = 1

    • Bit position 11: 21=22^1 = 2

    • Bit position 22: 22=42^2 = 4

    • Bit position 33: 23=82^3 = 8

    • Bit position 44: 24=162^4 = 16

    • Bit position 55 (Most Significant Bit [MSB] in a 6-bit integer): 25=322^5 = 32

  • Fractional Bit Positions and Column Weights:

    • First position right of binary point: 2−1=0.52^{-1} = 0.5

    • Second position right of binary point: 2−2=0.252^{-2} = 0.25

    • Third position right of binary point: 2−3=0.1252^{-3} = 0.125

    • Fourth position right of binary point: 2−4=0.06252^{-4} = 0.0625

    • Fifth position right of binary point: 2−5=0.031252^{-5} = 0.03125

Number System Conversions

  • Binary-to-Decimal Conversion Procedure:

    • Step 1: Multiply each bit by its corresponding positional column weight (2n2^n), moving right-to-left for the integer portion and left-to-right for the fractional portion.

    • Step 2: Calculate the sum of all individual products to obtain the equivalent decimal quantity.

  • Binary-to-Decimal Worked Examples:

    • Example 1 (Integer): Convert the binary value 1012101_2 to decimal:

      • Identify positional components: Bit 2=12 = 1, Bit 1=01 = 0, Bit 0=10 = 1.

      • Apply positional weights: (1×22)+(0×21)+(1×20)(1 \times 2^2) + (0 \times 2^1) + (1 \times 2^0).

      • Evaluate powers: (1×4)+(0×2)+(1×1)=4+0+1=510(1 \times 4) + (0 \times 2) + (1 \times 1) = 4 + 0 + 1 = 5_{10}.

      • Subscripts explicitly identify the radix (Base 22 vs. Base 1010).

    • Example 2 (Fractional): Convert the binary value 100101.012100101.01_2 to decimal:

      • Integer expansion: (1×25)+(0×24)+(0×23)+(1×22)+(0×21)+(1×20)=32+0+0+4+0+1=3710(1 \times 2^5) + (0 \times 2^4) + (0 \times 2^3) + (1 \times 2^2) + (0 \times 2^1) + (1 \times 2^0) = 32 + 0 + 0 + 4 + 0 + 1 = 37_{10}.

      • Fractional expansion: (0×2−1)+(1×2−2)=0+0.25=0.2510(0 \times 2^{-1}) + (1 \times 2^{-2}) = 0 + 0.25 = 0.25_{10}.

      • Sum: 37+0.25=37.251037 + 0.25 = 37.25_{10}.

  • Decimal-to-Binary Conversion Procedure (Repeated Division-by-2):

    • Step 1: Divide the integer decimal value by 22.

    • Step 2: Record the resulting integer quotient and record the remainder (00 or 11).

    • Step 3: Repeat division using the quotient until the quotient reaches 00.

    • Step 4: Read the recorded remainders in reverse order (from the final division step to the initial division step, corresponding to bottom-to-top / MSB-to-LSB).

  • Decimal-to-Binary Worked Examples:

    • Example 3: Convert decimal 131013_{10} to binary:

      • Division 1: 132=6\frac{13}{2} = 6, Remainder = 11 (LSB)

      • Division 2: 62=3\frac{6}{2} = 3, Remainder = 00

      • Division 3: 32=1\frac{3}{2} = 1, Remainder = 11

      • Division 4: 12=0\frac{1}{2} = 0, Remainder = 11 (MSB)

      • Read sequence in reverse order: 110121101_2.

Repeated division-by-2 method converting decimal 13 to binary
*   **Example 4:** Convert decimal 491049_{10} to binary:
    *   Division 1: 492=24\frac{49}{2} = 24, Remainder = 11 (LSB)
    *   Division 2: 242=12\frac{24}{2} = 12, Remainder = 00
    *   Division 3: 122=6\frac{12}{2} = 6, Remainder = 00
    *   Division 4: 62=3\frac{6}{2} = 3, Remainder = 00
    *   Division 5: 32=1\frac{3}{2} = 1, Remainder = 11
    *   Division 6: 12=0\frac{1}{2} = 0, Remainder = 11 (MSB)
    *   Read sequence in reverse order: 1100012110001_2.

Binary Addition and Overflow

  • Elementary Addition Rules:

    • 0+0=00 + 0 = 0 (Sum = 00, Carry = 00)

    • 1+0=11 + 0 = 1 (Sum = 11, Carry = 00)

    • 0+1=10 + 1 = 1 (Sum = 11, Carry = 00)

    • 1+1=1021 + 1 = 10_2 (Sum = 00, Carry = 11)

  • Carry Bit Generation and Propagation:

    • A carry bit is produced whenever the sum in a bit column equals or exceeds the radix value (22).

    • When adding 1+11 + 1, the result is 10210_2; a 00 is recorded in the current sum column, and a carry of 11 is propagated to the next higher-order column to the left.

    • When the carry is 00, recording it is optional; when the carry is 11, it must be explicitly included in the computation of the adjacent column.

Binary addition recap table highlighting Carry logic as AND and Sum logic as XOR
  • Worked Binary Addition Examples:

    • Example 5 (4-bit binary addition): Add 11012+101121101_2 + 1011_2:

      • Bit 0: 1+1=01 + 1 = 0, Carry 11

      • Bit 1: 0+1+(Carry 1)=00 + 1 + (\text{Carry } 1) = 0, Carry 11

      • Bit 2: 1+0+(Carry 1)=01 + 0 + (\text{Carry } 1) = 0, Carry 11

      • Bit 3: 1+1+(Carry 1)=11 + 1 + (\text{Carry } 1) = 1, Carry 11

      • Final accumulated result: 11000211000_2

  • Overflow in Digital Addition:

    • Definition: Overflow occurs when the numerical result of an arithmetic operation exceeds the fixed bit width or storage capacity of the destination register.

    • In a fixed nn-bit system, any carry generated out of the most significant bit (n−1n-1) is classified as an overflow bit and cannot be accommodated within the allocated nn-bit word.

    • Example 6 (4-bit addition with overflow): Add 11112+000121111_2 + 0001_2:

      • Bit 0: 1+1=01 + 1 = 0, Carry 11

      • Bit 1: 1+0+(Carry 1)=01 + 0 + (\text{Carry } 1) = 0, Carry 11

      • Bit 2: 1+0+(Carry 1)=01 + 0 + (\text{Carry } 1) = 0, Carry 11

      • Bit 3: 1+0+(Carry 1)=01 + 0 + (\text{Carry } 1) = 0, Carry 11

      • The 4-bit storage register retains 000020000_2, while the fifth bit (11) represents an overflow condition (true total value is 100002=161010000_2 = 16_{10}).

Four-bit binary addition diagram displaying a 4-bit register value of 0000 and an overflow bit of 1
  • Additional Practice Additions:

    • 01012+01102=101120101_2 + 0110_2 = 1011_2 (510+610=11105_{10} + 6_{10} = 11_{10})

    • 01002+01112=101120100_2 + 0111_2 = 1011_2 (410+710=11104_{10} + 7_{10} = 11_{10})

    • 11012+00102=111121101_2 + 0010_2 = 1111_2 (1310+210=151013_{10} + 2_{10} = 15_{10})

    • 11012+00112=1000021101_2 + 0011_2 = 10000_2 (1310+310=161013_{10} + 3_{10} = 16_{10}, producing a 5-bit result)

Binary Subtraction and Borrow Mechanics

  • Elementary Subtraction Rules:

    • 0−0=00 - 0 = 0 (Carry/Borrow = 00, Result = 00)

    • 1−0=11 - 0 = 1 (Carry/Borrow = 00, Result = 11)

    • 1−1=01 - 1 = 0 (Carry/Borrow = 00, Result = 00)

    • 0−10 - 1: Requires a borrow with carry from the next higher-order column.

  • Borrowing Procedure:

    • When subtracting a 11 from a 00, a borrow of 11 is pulled from the adjacent higher column to the left.

    • A borrow of 11 from the adjacent column contributes a numeric weight of 22 (10210_2, equivalent to two 11s) into the current column.

    • The current column operation becomes 102−1=110_2 - 1 = 1.

    • If the adjacent left column is 00, borrowing propagates leftward across intermediate zero-valued columns until a column containing a 11 is reached.

  • Worked Binary Subtraction Examples:

    • Example 7: Subtract 011120111_2 from 100121001_2 (910−7109_{10} - 7_{10}):

      • Bit 0 (rightmost): 1−1=01 - 1 = 0.

      • Bit 1: 0−10 - 1 requires a borrow. Looking left, Bit 2 is 00, so borrowing propagates from Bit 3 (11).

      • Borrow sequence: Bit 3 (11) becomes 00, lending 10210_2 to Bit 2. Bit 2 keeps a value of 11 and lends 11 (10210_2) to Bit 1.

      • Bit 1 calculation: 102−1=110_2 - 1 = 1.

      • Bit 2 calculation: Leftover 1−1=01 - 1 = 0.

      • Bit 3 calculation: Leftover 0−0=00 - 0 = 0.

      • Final result: 001020010_2 (2102_{10}).

    • Example 8: Solve 11002−101021100_2 - 1010_2 (1210−101012_{10} - 10_{10}):

      • Bit 0: 0−0=00 - 0 = 0.

      • Bit 1: 0−10 - 1 requires a borrow. Bit 2 (11) decrements to 00, lending 10210_2 to Bit 1.

      • Bit 1 calculation: 102−1=110_2 - 1 = 1.

      • Bit 2 calculation: Leftover 0−0=00 - 0 = 0.

      • Bit 3 calculation: 1−1=01 - 1 = 0.

      • Final result: 001020010_2 (2102_{10}).

Logic Gates in Digital Arithmetic

  • Arithmetic Circuits: Hardware sub-systems constructed from logic gates designed to compute fundamental binary arithmetic functions (addition and subtraction).

  • AND Gate:

    • Function: Outputs HIGH (11) if and only if all input lines are HIGH (11).

    • Boolean Equation: X=A⋅BX = A \cdot B

    • Truth Table:

      • A=0,B=0  ⟹  X=0A = 0, B = 0 \implies X = 0

      • A=0,B=1  ⟹  X=0A = 0, B = 1 \implies X = 0

      • A=1,B=0  ⟹  X=0A = 1, B = 0 \implies X = 0

      • A=1,B=1  ⟹  X=1A = 1, B = 1 \implies X = 1

  • OR Gate:

    • Function: Outputs HIGH (11) when at least one input line is HIGH (11).

    • Boolean Equation: X=A+BX = A + B

    • Truth Table:

      • A=0,B=0  ⟹  X=0A = 0, B = 0 \implies X = 0

      • A=0,B=1  ⟹  X=1A = 0, B = 1 \implies X = 1

      • A=1,B=0  ⟹  X=1A = 1, B = 0 \implies X = 1

      • A=1,B=1  ⟹  X=1A = 1, B = 1 \implies X = 1

  • XOR (Exclusive-OR) Gate:

    • Function: Outputs HIGH (11) if one input is HIGH and the other is LOW (inputs are distinct).

    • Boolean Equation: X=A⊕BX = A \oplus B

    • Truth Table:

      • A=0,B=0  ⟹  X=0A = 0, B = 0 \implies X = 0

      • A=0,B=1  ⟹  X=1A = 0, B = 1 \implies X = 1

      • A=1,B=0  ⟹  X=1A = 1, B = 0 \implies X = 1

      • A=1,B=1  ⟹  X=0A = 1, B = 1 \implies X = 0

Half Adder Architecture and Design

  • Definition: A combinational circuit that adds two single-bit binary inputs (AA and BB) and produces two outputs: a sum bit (SUMSUM) and a carry-out bit (COUTC_{\text{OUT}}). It lacks the hardware capability to accept a carry-in from a preceding stage.

  • Component Architecture:

    • An XOR gate generates the sum: SUM=A⊕BSUM = A \oplus B.

    • An AND gate generates the carry-out: COUT=A⋅BC_{\text{OUT}} = A \cdot B.

  • Truth Table:

    • Input A=0A = 0, Input B=0  ⟹  COUT=0B = 0 \implies C_{\text{OUT}} = 0, SUM=0SUM = 0

    • Input A=0A = 0, Input B=1  ⟹  COUT=0B = 1 \implies C_{\text{OUT}} = 0, SUM=1SUM = 1

    • Input A=1A = 1, Input B=0  ⟹  COUT=0B = 0 \implies C_{\text{OUT}} = 0, SUM=1SUM = 1

    • Input A=1A = 1, Input B=1  ⟹  COUT=1B = 1 \implies C_{\text{OUT}} = 1, SUM=0SUM = 0

Half Adder logic block symbol

Full Adder Architecture and Design

  • Definition: A combinational circuit that adds three single-bit inputs—two operand bits (AA, BB) and a carry-in bit (CINC_{\text{IN}})—producing two outputs: a sum (SUMSUM) and a carry-out (COUTC_{\text{OUT}}). Full adders enable multi-bit addition by propagating carries across bit columns.

  • Counting Property: The combined 2-bit binary output (COUT SUM)2(C_{\text{OUT}} \, SUM)_2 directly represents the total count of 11s present on the three input lines (CIN,A,BC_{\text{IN}}, A, B):

    • Zero inputs at 11: COUT=0,SUM=0C_{\text{OUT}} = 0, SUM = 0 (002=01000_2 = 0_{10})

    • One input at 11: COUT=0,SUM=1C_{\text{OUT}} = 0, SUM = 1 (012=11001_2 = 1_{10})

    • Two inputs at 11: COUT=1,SUM=0C_{\text{OUT}} = 1, SUM = 0 (102=21010_2 = 2_{10})

    • Three inputs at 11: COUT=1,SUM=1C_{\text{OUT}} = 1, SUM = 1 (112=31011_2 = 3_{10})

  • Truth Table:

    • CIN=0,A=0,B=0  ⟹  COUT=0,SUM=0C_{\text{IN}} = 0, A = 0, B = 0 \implies C_{\text{OUT}} = 0, SUM = 0

    • CIN=0,A=0,B=1  ⟹  COUT=0,SUM=1C_{\text{IN}} = 0, A = 0, B = 1 \implies C_{\text{OUT}} = 0, SUM = 1

    • CIN=0,A=1,B=0  ⟹  COUT=0,SUM=1C_{\text{IN}} = 0, A = 1, B = 0 \implies C_{\text{OUT}} = 0, SUM = 1

    • CIN=0,A=1,B=1  ⟹  COUT=1,SUM=0C_{\text{IN}} = 0, A = 1, B = 1 \implies C_{\text{OUT}} = 1, SUM = 0

    • CIN=1,A=0,B=0  ⟹  COUT=0,SUM=1C_{\text{IN}} = 1, A = 0, B = 0 \implies C_{\text{OUT}} = 0, SUM = 1

    • CIN=1,A=0,B=1  ⟹  COUT=1,SUM=0C_{\text{IN}} = 1, A = 0, B = 1 \implies C_{\text{OUT}} = 1, SUM = 0

    • CIN=1,A=1,B=0  ⟹  COUT=1,SUM=0C_{\text{IN}} = 1, A = 1, B = 0 \implies C_{\text{OUT}} = 1, SUM = 0

    • CIN=1,A=1,B=1  ⟹  COUT=1,SUM=1C_{\text{IN}} = 1, A = 1, B = 1 \implies C_{\text{OUT}} = 1, SUM = 1

  • Boolean Equations (from K-maps):

    • SUM=CIN⊕A⊕BSUM = C_{\text{IN}} \oplus A \oplus B

    • COUT=(CIN⋅(A⊕B))+(A⋅B)C_{\text{OUT}} = (C_{\text{IN}} \cdot (A \oplus B)) + (A \cdot B)

  • Dual Half-Adder Implementation:

    • Half Adder 1: Adds inputs AA and BB, generating an intermediate sum S1=A⊕BS_1 = A \oplus B and an intermediate carry C1=A⋅BC_1 = A \cdot B.

    • Half Adder 2: Adds the carry-in CINC_{\text{IN}} to the intermediate sum S1S_1, producing the final sum SUM=CIN⊕S1=CIN⊕A⊕BSUM = C_{\text{IN}} \oplus S_1 = C_{\text{IN}} \oplus A \oplus B and a second intermediate carry C2=CIN⋅S1=CIN⋅(A⊕B)C_2 = C_{\text{IN}} \cdot S_1 = C_{\text{IN}} \cdot (A \oplus B).

    • OR Gate: Combines the two intermediate carry outputs (C1C_1 and C2C_2) to form the final carry-out: COUT=C2+C1=(CIN⋅(A⊕B))+(A⋅B)C_{\text{OUT}} = C_2 + C_1 = (C_{\text{IN}} \cdot (A \oplus B)) + (A \cdot B).

Full Adder schematic diagram showing internal interconnection of two half adders and an OR gateFull Adder logic block symbol

Multi-Bit Parallel Adders and Propagation Delay

  • Multi-Bit Parallel Adder Structure:

    • Constructed by cascading multiple full adders in parallel, linking each stage's carry-out to the carry-in of the next stage.

    • Stage 0 (LSB): Because there is no carry-in from a prior stage, Bit 0 can be implemented with a Half Adder or a Full Adder with CIN=0C_{\text{IN}} = 0.

    • Subsequent Stages: Stage 1 receives COUT0C_{\text{OUT0}} as CIN1C_{\text{IN1}}; Stage 2 receives COUT1C_{\text{OUT1}} as CIN2C_{\text{IN2}}; Stage 3 receives COUT2C_{\text{OUT2}} as CIN3C_{\text{IN3}}.

  • Propagation Delay Limits:

    • Carry propagation requires each bit stage to wait for the carry bit to be evaluated by preceding stages.

    • The cumulative delay accumulates linearly (O(n)O(n)) as bit width increases, creating a practical limit on the number of stages that can be cascaded in high-speed hardware.

  • Example 9 (Comprehensive 4-bit addition walkthrough): Add A=11012A = 1101_2 (131013_{10}) and B=10112B = 1011_2 (111011_{10}):

    • Bit 0 (LSB): Inputs: A0=1,B0=1,CIN0=0A_0 = 1, B_0 = 1, C_{\text{IN0}} = 0; Outputs: SUM0=0,COUT0=1SUM_0 = 0, C_{\text{OUT0}} = 1

    • Bit 1: Inputs: A1=0,B1=1,CIN1=1A_1 = 0, B_1 = 1, C_{\text{IN1}} = 1; Outputs: SUM1=0,COUT1=1SUM_1 = 0, C_{\text{OUT1}} = 1

    • Bit 2: Inputs: A2=1,B2=0,CIN2=1A_2 = 1, B_2 = 0, C_{\text{IN2}} = 1; Outputs: SUM2=0,COUT2=1SUM_2 = 0, C_{\text{OUT2}} = 1

    • Bit 3 (MSB): Inputs: A3=1,B3=1,CIN3=1A_3 = 1, B_3 = 1, C_{\text{IN3}} = 1; Outputs: SUM3=1,COUT3=1SUM_3 = 1, C_{\text{OUT3}} = 1

    • Results Summary:

      • Stored 4-bit sum (SUM3SUM2SUM1SUM0SUM_3 SUM_2 SUM_1 SUM_0): 100021000_2 (8108_{10})

      • Carry-out from MSB (Bit 3): 11 (indicates register overflow)

      • True 5-bit arithmetic result: 11000211000_2 (241024_{10})