Assignment 10, Solutions

Part of the homework for 22C:60 (CS:2630), Fall 2011
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

  1. A Problem: What is the closest approximation to π (Pi, 3.14159...) as a 32-bit IEEE format floating point number? Give your answer in hexadecimal. You may use any tools you wish to find this value. (1.0 points).

    In fixed point binary, rounded to 32 places after the point,
    π = 11.0010 0100 0011 1111 0110 1010 1000 1001

    IEEE format uses a 24-bit mantissa (including the hidden bit), so the mantissa needs to be rounded to that size and normalized:
    π = 1.100 1001 0000 1111 1101 1011 × 2

    Now, the exponent 21 is represented as 1000 0000, and this is a positive number, so we can assemble all the parts to get:
    π = 0100 0000 0100 1001 0000 1111 1101 1011 = 40490FDB

  2. Background: Consider this bizarrely minimal floating point format: Numbers are 4 bits long, 1 bit of sign, 2 bits of exponent, and 2 bits of mantissa, including a hidden bit. The exponent is expressed as a naturally biased binary number between -2 and 1, while the magnitude of the mantissa ranges from 1.0 to 1.5 (the point is immediately to the right of the hidden bit).

    A problem: Give a table of the decimal equivalents of every floating point number in this system from 0000 to 1111, in order. (1 point)

    0000 = 0 00 0 = +1.0 × 2-2 = +0.25
    0001 = 0 00 1 = +1.5 × 2-2 = +0.375
    0010 = 0 01 0 = +1.0 × 2-1 = +0.5
    0011 = 0 01 1 = +1.5 × 2-1 = +0.75
    0100 = 0 10 0 = +1.0 × 2+0 = +1
    0101 = 0 10 1 = +1.5 × 2+0 = +1.5
    0110 = 0 11 0 = +1.0 × 2 1 = +2
    0111 = 0 11 1 = +1.5 × 2 1 = +3
    1000 = 1 00 0 = -1.0 × 2-2 = -0.25
    1001 = 1 00 1 = -1.5 × 2-2 = -0.375
    1010 = 1 01 0 = -1.0 × 2-1 = -0.5
    1011 = 1 01 1 = -1.5 × 2-1 = -0.75
    1100 = 1 10 0 = -1.0 × 2 0 = -1
    1101 = 1 10 1 = -1.5 × 2 0 = -1.5
    1110 = 1 11 0 = -1.0 × 2+1 = -2
    1111 = 1 11 1 = -1.5 × 2+1 = -3
    

  3. Background: Consider the following set of simultaneous boolean equations:

    a) Draw this in the schematic notation for a logic circuit. (0.3 points)

    b) What values of the inputs to this circuit permit it to store one bit of information? (In doing part a, you will have identified the inputs.) (0.3 points)

    If [a,b] = [1,0] the outputs [c,d] will be either [1,1] or [0,0], which is to say, the circuit will be storing a bit. Under these circumstances, the outputs are always identical, so we can label them both Q.

    c) How do you make this circuit store the value one? (0.2 points)

    If [a,b] = [1,1] the outputs [c,d] will be forced to [1,1].

    In other words, if we start and end with [a,b] = [1,0] and apply a brief positive pulse to the b input, so [a,b] are briefly [1,1], we will set the flipflop. As such, the b input should be labeled S because it sets the flipflop on a positive pulse.

    d) How do you make this circuit store the value zero? (0.2 points)

    If [a,b] = [0,0] the outputs [c,d] will be forced to [0,0].

    In other words, if we start and end with [a,b] = [1,0] and apply a brief negative pulse to the a input, so [a,b] are briefly [0,0], we will reset the flipflop. As such, the a input should be labeled R because it resets the flipflop on a negative pulse.