------------------------------------------ Test 2 (Nov 9) Review Topics and Questions ------------------------------------------ -Ian! D. Allen - idallen@idallen.ca - www.idallen.com Test format: Short answers, calculations, multiple choice. These review topics do not cover all the material. ----------------------------------------------------------------------------- The Big Picture: Bit patterns have no inherent meaning. They may represent signed integers, unsigned integers, floating point numbers, characters, or even executable program instructions. The computer program that operates on the bits give the bits meaning. Example: The 32-bit pattern 00111111100000000000000000000000 (3F800000h) If you interpret this bit pattern as: 1. unsigned -> 1065353216 decimal 2. sign/magnitude -> 1065353216 decimal 3. two's complement -> 1065353216 decimal 4. IEEE 754 SP FP -> 1.0 decimal 5. Four 7-bit ASCII characters (in 8-bit bytes): 00111111 = 63 decimal = '?' (question mark character) 10000000 = 128 decimal = NOT ASCII (ASCII is only 0-127 decimal) 00000000 = 0 = NUL 00000000 = 0 = NUL 6. Two 16-bit MARIE instructions (Table 4.2 and 4.6 p.193,209): 0011 111110000000 = ADD 3968 0000 000000000000 = JNS 0 Example: The 32-bit pattern 10111111100000000000000000000000 (BF800000h) If you interpret this bit pattern as: 1. unsigned -> 3212836864 decimal 2. sign/magnitude -> -1065353216 decimal 3. two's complement -> -1082130431 decimal 4. IEEE 754 SP FP -> -1.0 decimal 5. Four 7-bit ASCII characters (in 8-bit bytes): 10111111 = 191 decimal = NOT ASCII (ASCII is only 0-127 decimal) 10000000 = 128 decimal = NOT ASCII (ASCII is only 0-127 decimal) 00000000 = 0 = NUL 00000000 = 0 = NUL 6. Two 16-bit MARIE instructions (Table 4.2 and 4.6 p.193,209): 1011 111110000000 = ADDI 3968 0000 000000000000 = JNS 0 Numbers represented in computers have a limited size (number of bits), hence limited range and precision. Numbers can be stored as integers or as floating-point values. Both precision and range are essentially the same for integers, since integers have no exponent field. Floating point numbers have both a mantissa (for precision) and an exponent field (for range); they usually trade away some precision in favour of greater range. Though floating-point numbers almost always have a greater range than integers, the range is not infinite. To store a value accurately in a floating-point representation in a computer, two things must work out: the number's value must lie within the *range* of the floating-point representation (the exponent must fit), and the value must not lose any *precision* (the mantissa must fit). In practice, some precision is often lost when working with floating-point numbers. ----------------------------------------------------------------------------- Topics for Test 2: Chapter 1 * Table 1.1 page 5: know the names and decimal and power-of-two values of all prefixes from Pico (10**-12, 2**-40) up to Tera (10**12, 2**40) * Know what is meant by "orders of magnitude" (powers of 10) * Exercises p.37: 2, 3 Chapter 2 * Conversion among all of decimal, binary, octal, hexadecimal * Integers: unsigned, one's complement, two's complement, sign-magnitude * What causes integer carry, overflow flags to be set * What flag indicates that an unsigned integer addition is wrong? * What flag indicates that a two's complement integer addition is wrong? * Conversions to/from decimal and IEEE 754 SP floating-point * Differentiate between range, accuracy and precision * What causes floating-point overflow, underflow * Approximate range (in decimal) of IEEE 754 SP floating-point * Basic layout of the ASCII character set (but not specific letters) * Conversion between ASCII ctrl chars, upper-case letters, lower-case letters * Questions p.93: 1-9, 12, 13, 15-19, 22-24 * Exercises p.94: 1-9, 23, 25, 28a, 29a, 29b, 30, 31, 46 Chapter 3 * Sections 3.2.0, 3.2.1, 3.2.2 * simplification of simple Boolean expressions (some of 3.2.3) * simple Boolean expression complements (some of 3.2.4) * Table 3.5, 3.6 * Boolean identities and deMorgan (most importantly deMorgan) * bitwise operations (see p.122 and Class Notes file bit_operations.txt) * Questions p.154: 1-6 * Exercises p.155: 1-4, 8, 11, 12b, 13, 15 Chapter 4 * Sections 4.1, 4.2, 4.4, 4.5, 4.6 (omit interleaving), 4.8 * Sections 4.9.0, 4.9.1, 4.9.3, 4.10, 4.11 * the functions of the seven MARIE registers * the function and meaning of the first nine MARIE opcodes (Table 4.2) * the RTN for each of the first nine MARIE opcodes (4.8.4) * describe in detail the fetch/decode/execute cycle * trace a simple program, showing how the MARIE registers change * hand-assemble a simple program into hexadecimal * Questions p.236: 1, 3, 4, 5, 9, 14, 17-20, 24-29, 32 * Exercises p.237: 1, 3-5, 8, 9, 11-14, 15a