π Master Conversions Cheatsheet: Digital Codes & Canonical Forms
Purpose
This cheatsheet serves as a high-yield, quick-reference guide for all digital code conversions, error control systems, and algebraic canonical transformations. It is designed to be fully compatible with Obsidian reading and editing views.
1. Binary Coded Decimal (8421 BCD) Conversions
1.1 Decimal BCD
- Decimal to BCD: Directly replace each individual decimal digit with its equivalent 4-bit binary nibble [3].
- BCD to Decimal: Partition the binary string into 4-bit groups (starting from the LSB) and translate each group into its decimal digit [3].
Decimal BCD Conversion
- [3]
1.2 BCD Addition Algorithm
- Add the two BCD values using standard binary addition [4].
- For each 4-bit sum nibble:
- If Sum and no carry is generated: The nibble is valid [4].
- If Sum OR a carry is generated: Add a correction factor of to that nibble [4]. This skips the 6 invalid states ( to ) [4, 8]. Propagate any resulting carry to the next higher-order nibble [4].
BCD Addition (Correction Required)
Add and : Final BCD: [5].
2. Excess-3 (XS-3) Code Conversions
2.1 Decimal Excess-3
- Decimal to Excess-3: Add to the decimal digit , then convert the result into a 4-bit binary representation [17].
- Excess-3 to Decimal: Convert the 4-bit group into decimal and subtract [13, 17].
Decimal Excess-3 Conversion
- [17].
2.2 Excess-3 Addition Algorithm
- Perform standard binary addition on the two Excess-3 digits. Since both numbers contain an offset of , the raw sum contains an offset of [19].
- For each sum nibble:
- If a carry is generated (Sum ): Add to restore the correct offset [19].
- If NO carry is generated (Sum ): Subtract (or add ) [19].
Excess-3 Addition (No Carry)
Add and in Excess-3: [20].
3. Weighted 4-Bit Code Conversions
Weighted codes represent a decimal value by multiplying each bit by its assigned positional weight [7]:
3.1 Major Weighted Codes Reference Table
| Decimal Digit | 8421 (BCD) [7] | 2421 [7] | 5211 [7] | 84-2-1 [7] |
|---|---|---|---|---|
| 0 | 0000 | 0000 | 0000 | 0000 |
| 1 | 0001 | 0001 | 0001 | 0111 |
| 2 | 0010 | 0010 | 0011 | 0110 |
| 3 | 0011 | 0011 | 0100 | 0101 |
| 4 | 0100 | 0100 | 0101 | 0100 |
| 5 | 0101 | 1011 | 1000 | 1011 |
| 6 | 0110 | 1100 | 1001 | 1010 |
| 7 | 0111 | 1101 | 1011 | 1001 |
| 8 | 1000 | 1110 | 1100 | 1000 |
| 9 | 1001 | 1111 | 1111 | 1111 |
3.2 Conversion Example: to 5211 Weighted Code
To convert, translate each decimal digit independently using the weighted positional rules:
- Digit 6: [11].
- Digit 0: [11].
- Digit 5: [11].
- Result: [11, 12].
4. Reflected (Gray) Code Conversions
4.1 Binary Gray
- Keep the Most Significant Bit (MSB) identical [31]:
- XOR each subsequent binary bit with the binary bit immediately to its left [31]:
Binary: B3 -------> B2 -------> B1 -------> B0
| | | |
| XOR XOR XOR
v v v v
Gray: G3 G2 G1 G0
Binary to Gray Conversion (1011 to Gray)
- Result: [32].
4.2 Gray Binary
- Keep the MSB identical [32]:
- XOR the previously calculated binary bit with the next incoming Gray code bit [32]:
Gray to Binary Conversion (1110 to Binary)
- Result: [33].
7. Standard Canonical Boolean Conversions
- Canonical Form: Every term contains all domain variables exactly once [67].
- SOP Canonical Expansion Rule: Multiply each non-canonical product term by for every missing variable [74].
- POS Canonical Expansion Rule: Add to each non-canonical sum term for every missing variable , then expand via distribution: [74].
SOP & POS Canonical Conversion
Convert into Maxterms () and Minterms ():
- Term 1 is missing :
- Term 2 is missing and : Expand using distribution into 4 maxterms:
- Product of Maxterms: [76].
- Sum of Minterms: Minterm indices are the remaining states (0 to 15):