CS250 Assignment 2: Binary Representations

Start date 26 January, due 2 February beginning of class.

Lab Preparation: Binary Counter / Clocked Circuit

In the lab, you will be constructing a binary counter that counts clock pulses you manually generate with a switch. (This is based on Lab 4 in the textbook.) Key things to think about:

In particular, you'll find that although the lab seems trivial (build a counter using a counter chip), it isn't quite so easy in practice. This is because of the problems interfacing between mechanical devices (the switch) and electrical signals. A switch isn't quite the simple on/off device you think - at least not at the time scales of computers.

Your pushbutton switch, when pressed, connects one side to the center. When released, it connects the other side to the center. In between (while you are pressing or releasing), both sides are disconnected, but will fluctuate between open and closed several times in one button press. You'll need to debounce the switch, by building a latch that captures the first connection on one side, then waits for the first connection on the other side to change state (ignoring the disconnections.) You've seen a flip/flop that will do this, if connected properly. You won't need many gates.

Remember that disconnected is not the same as ground - you'll want to set it up so that such open circuits are connected through a resistor to ground (or power), as appropriate.

You are strongly encouraged to diagram out what you will build before coming to lab. Try cutting out the chips you will use from the pinout diagram, laying them on a piece of paper, and drawing in the wires. The lab time is limited to two hours, if you are unprepared you may be unable to finish in the allotted time, and will not receive full credit.

If you get through the lab quickly (and have appropriate parts), try building an 8-bit counter, or a count-down circuit. (Instead of starting at 0 and counting up, it will start with 15 (24-1) and subtract one each time.) If you prepare in advance, you'll find it quite easy. Hint: You can do it with one additional chip, and around 10 additional wires.

Problem 1: Binary Representations

  1. Convert the following to their 8 bit binary representation:
    1. Unsigned integer value: 103

    2. 1's complement signed integer value: 103

    3. 2's complement signed integer value: 103

    4. Hexadecimal: 0x67

    5. ASCII character: 'g' (If you are concerned about parity, then assume odd parity. Or just don't worry about parity at all.)

  2. Give the appropriate meaning from converting the 8-bit binary string 1011 0010 to the following:
    1. An unsigned integer.

    2. A signed integer, assuming a 1's complement representation.

    3. A signed integer, assuming a 2's complement representation.

    4. A hexadecimal value.

    5. An ASCII character, assuming use of a parity bit and even parity.

Problem 2: Signed Integer Arithmetic

Let X = 8 and Y = -6. Convert to binary and compute X+Y, showing your work. Do this using:

  1. 1's complement representation





  2. 2's complement representation





Problem 3: Scaling

You have been working with 8 bit numbers, but now they are too small. Convert the following to eight bit binary, two's complement, and then show the representation as a 16 bit 2's complement binary number:

  1. 62:


  2. -113:


Problem 4: IEEE Floating Point Representation

  1. Give the decimal equivalent of the following hexadecimal numbers:
    1. 0x41000000



    2. 0xC1880000



  2. Convert the following to 32 bit floating point:
    1. 256



    2. -8.125



  3. Extra credit: Give the correct binary (or hexadecimal) output of the following addition: 0xFF800000 + 0xC0000000. Explain.




Turning in assignment

For this assignment, paper submission is easiest. However, you may also submit electronic copy through WebCT if you are concerned about the possible loss of paper, want a record of turning it in, etc. Pdf is the safest format for capturing non-text, please check with the TA for formats other than html, text, or pdf. Hard copy is acceptable, please hand in at the beginning of class.


Valid XHTML 1.1!