Test 2 Study Guide CS 200 • Spring 2015 Study Topics Number Base Conversion o Other Bases to Decimal (ex. Base 5 to Base 10) o Base 10 to Binary, Hexadecimal, and Octal o Binary to Octal and Hexadecimal o Octal to Hex using Binary intermediate o Radix point and Fractional conversion (focus on Binary) Data Representation o Integers Unsigned Sign-Magnitude 1s Complement 2s Complement o Floating Point Exponent with Bias Significand with implied “1.” IEEE Single (32 bits) and Double (64 bits) precision o Floating Point Math Addition./Subtraction Normalize smaller exponent to match larger Use sign bit to decide sign of result and add or subtract significand Normalize again (if necessary) to store in IEEE format Multiplication/Division Use sign to decide sign of result Add (for multiply) or subtract (for divide) exponents Multiply or divide significands Normalize (if necessary) to store in IEEE format o Character Representation BCD: Early IBM 6-bit format EBCDIC: BDC extended to 8 bits ASCII: Binary code for analog devices (telephone, telegraph) Originally 7 bits extended to 8 bits Unicode: 16-bit format designed to hold international character sets o Error Detection Modulo 2 division CRC Syndrome from Data Use prime binary divisor Add digits (0s) to data – one less than digits in divisor Modulo 2 division – remainder replaces 0s added to data o CRC detection Modulo 2 division using original prime binary divisor If remainder 0, remove syndrome digits to get data If remainder not 0, data is suspect – ask for retransmit Hamming Code Can detect AND correct errors Parity: count the 1s in a binary string Even Parity: if the 1s are odd, parity bit = 1, otherwise 0 Odd Parity: if the 1s are odd, parity bit = 0, otherwise 1 8 data bits + 4 parity bits = 12-bit codeword. Create Codeword Number bits from 1 starting at right Parity bits are at powers of 2 positions Other positions are combinations of powers of 2 Add up all the positions that use a power to get the parity bit Ex: Data = 10110111 1 0 1 1 0 1 1 1 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 2 2 2 2 2 = 1 4 4 4 4 8 8 8 8 The positions that contribute to parity bit 2 are in red and add up to an odd number so the (even) parity is 1 and would go in position 2. Decode Codeword Test parity bits as above, mark as correct or incorrect If all parity bits are correct or only one is incorrect, data is good. If more than one parity bit is incorrect, add positions to find bad bit Ex: Bits 4, 2, and 1 are incorrect so position 7 is the bad bit. (4 + 2 + 1 = 7) If outside of possible positions, data cannot be corrected Otherwise, simply flip the bad bit to fix it. If data is correct, strip out the parity bits to get the original data.