Data Representation Notes
Data Representation
7-Bit ASCII Code Table
- The ASCII table provides a way to represent characters using 7 bits.
- It maps characters to numerical values, enabling computers to process and display text.
- The table is organized with rightmost four bits and leftmost three bits to determine the character.
- Examples:
- NUL (Null character)
- DLE (Data Link Escape)
- Space
- 0-9 (Digits)
- A-Z (Uppercase letters)
- a-z (Lowercase letters)
- Various symbols and control characters
ASCII Table
- Provides decimal, hexadecimal, and character representations.
- Decimal values range from 0 to 127.
- Includes control characters (0-31) and printable characters (32-127).
- Examples:
- 0: NUL (Null)
- 8: BS (Backspace)
- 9: HT (Horizontal Tab)
- 10: LF (Line Feed)
- 13: CR (Carriage Return)
- 32: Space
- 65: A
- 97: a
- 127: DEL (Delete)
Half-Adder
- A half-adder is a digital circuit that performs binary addition of two bits.
- It produces a sum and a carry bit as outputs.
- Inputs: A, B
- Outputs: Sum, Carry
Full Adder
- A full adder performs binary addition of three bits: two input bits and a carry-in bit.
- It produces a sum and a carry-out bit.
- Inputs: A, B, {C_{in}}
- Outputs: Sum (S), {C_{out}}
Ripple Carry Adder
- A ripple carry adder is formed by cascading full adders.
- The carry-out of one full adder is connected to the carry-in of the next full adder.
- It adds two n-bit binary numbers.
- Example: 4-bit ripple carry adder
- Inputs: {A3}{B3}, {A2}{B2}, {A1}{B1}, {A0}{B0}, {C_{in}}
- Outputs: {S3}, {S2}, {S1}, {S0}, {C_3}
Carry Look-Ahead Adder
- A carry look-ahead adder reduces the carry propagation delay by calculating the carry bits in advance.
- It uses generate (G) and propagate (P) signals to predict carry bits.
- Example: 4-bit carry look-ahead adder
- Inputs: {A3}{B3}, {A2}{B2}, {A1}{B1}, {A0}{B0}
- Outputs: {S3}, {S2}, {S1}, {S0}
- Uses a 4-bit carry look-ahead circuit.
Carry Look-Ahead Adder Logic Circuit
- The logic circuit implements the carry look-ahead principle using AND and OR gates.
- It calculates carry bits {C1}, {C2}, {C3}, and {C4} based on propagate (P) and generate (G) signals.
Add-Shift Multiplication Algorithm
- An algorithm for binary multiplication using addition and bit-shifting operations.
- Initialization: A = 0, Q = Multiplier, M = Multiplicand, Count = Number of bits in Q.
- Steps:
- Examine the least significant bit (LSB) of Q.
- If Q[0] = 1, add M to A (A = A + M).
- Right-shift the A and Q registers (A, Q).
- Decrement the Count.
- Repeat steps 1-4 until Count = 0.
- The result is stored in the A and Q registers.
Booth's Algorithm
- Booth's algorithm is used for signed number multiplication.
- It handles both positive and negative numbers efficiently.
- Initialization: A = 0, Q = Multiplier, M = Multiplicand, Q-1 = 0, Count = n (number of bits in Q).
- Steps:
- Examine the least significant bit (LSB) of Q (Q[0]) and the previous value of Q (Q-1).
- If Q[0]Q-1 = 01, A = A + M.
- If Q[0]Q-1 = 10, A = A - M.
- Perform arithmetic right shift on A, Q, and Q-1.
- Decrement Count.
- Repeat steps 1-5 until Count = 0.
- Example: -5 * 4 = -20
- M = -5 (1011 in 2's complement)
- Q = 4 (0100 in binary)
Binary Division Using Restoring Method
- The restoring method is a binary division algorithm.
- Initialization: A = 0, Q = Dividend, M = Divisor, n = number of bits.
- Steps:
- Shift left A and Q (A, Q).
- Subtract M from A (A = A - M).
- If A is negative, set Q[0] = 0 and restore A (A = A + M).
- If A is positive, set Q[0] = 1.
- Decrement n (n = n - 1).
- Repeat steps 1-5 until n = 0.
- The quotient is in Q, and the remainder is in A.
- Example: Divide 11 by 3.
- Dividend (Q) = 1011 (11 in binary)
- Divisor (M) = 0011 (3 in binary)