Digital Systems and Information: Arithmetic, Codes, and Abstractions
Conversions and Number Systems Recap
Decimal to Other Bases
- Integer Part Conversion: To convert the integer portion of a decimal number to another base, divide the number by the target base repeatedly and record the remainders. The final converted number is found by reading the remainders in reverse order (from the last remainder generated to the first).
- Fractional Part Conversion: To convert the fractional portion of a decimal number, multiply the fraction by the target base. Record the resulting integer part. Repeat the process with the remaining fraction until the fractional part equals . The final converted fraction is found by reading the recorded integers in chronological order (from first to last).
Conversion from Other Bases to Decimal
- Apply the general positional notation formula: , where is the digit, is the base, and is the position relative to the radix point.
Binary to Octal Conversion
- The binary number is partitioned into groups of three bits ( bits) each, starting from the binary point and moving both left and right. Each group is then assigned its corresponding octal digit ( through ).
Binary to Hexadecimal Conversion
- The binary number is partitioned into groups of four bits ( bits) each, starting from the binary point. Each group is then assigned its corresponding hexadecimal digit ( through and through ).
Binary Arithmetic Operations
Binary Addition of Two Bits
- : Result for the current bit is , with a carry of to the next higher-order bit.
Binary Subtraction of Two Bits
- : In this case, the current step bit result is , and a borrow of is taken from the next higher-order bit.
Hexadecimal Arithmetic Operations
Hexadecimal Addition (Example: )
- Step 1 (Right Column): Sum the least significant digits.
- Since , perform division: with a remainder of .
- Write down and carry over .
- Step 2 (Left Column): Sum the next digits and include the carry.
- Include carry:
- Perform division: with a remainder of .
- Write down and carry over .
- Final Result:
- Step 1 (Right Column): Sum the least significant digits.
Hexadecimal Subtraction
- When subtracting, if the top digit is smaller than the bottom digit, borrow from the next column.
- Example logic provided: , which corresponds to the hexadecimal digit .
Hexadecimal Multiplication (Example: )
- Process Part 1:
- . remainder . Write , carry .
- . remainder .
- Partial Product 1: .
- Process Part 2:
- . remainder . Write , carry .
- . remainder .
- Partial Product 2: .
- Final Summation:
- Align the partial products (shifting the second product left by one position): .
- Text references additional values: , , and a resulting block of .
- Process Part 1:
Decimal Codes and Binary-Coded Decimal (BCD)
Definition and Concept
- Computers store decimal numbers in specific formats to facilitate easy conversion to binary.
- An -bit binary code consists of a group of bits that can assume up to distinct combinations of s and s.
- Example: A -bit code identifies a set of elements; a -bit code identifies a set of elements.
Binary-Coded Decimal (BCD)
- Each decimal digit () is represented by its own -bit binary string.
- Table 1-4: BCD Mapping
Practice Problem: Binary Number
- Conversion to Decimal: .
- Conversion to BCD: Partition into groups of bits: . This translates to the digits , , and . Result: .
Alphanumeric Codes
The Need for Alphanumeric Codes
- Codes are required to store upper and lowercase letters, decimal digits (), and various symbols (punctuation, mathematical operators) in binary form.
- Requirement breakdown: (letters) + (digits) + additional symbols.
ASCII (American Standard Code for Information Interchange)
- Uses bits to encode characters.
- The character set consists of printable characters and non-printable control characters.
- Control Characters identified in Table 1-5:
Unicode Code
- Provides a unique numeric value called a "code point" and a unique name for every character in world languages.
- Format: followed by four to six hexadecimal digits.
- Example: represents the "Digit Zero."
- Supports Internationalization and Localization: The process of adapting computing systems for different world regions and languages.
Abstraction Layers in Computer Systems Design
Computer systems are designed in hierarchical layers of abstraction, moving from logical concepts to physical hardware:
- Algorithms
- Programming Languages
- Operating Systems
- Instruction Set Architecture (ISA)
- Microarchitecture
- Register Transfers
- Logic Gates
- Transistor Circuits
Practice Exercises
- Decode the following ASCII sequences (mapped from binary):
- Final Decoded Message: "Go Cardinals!"