CSE378 Homework #7

11/20/2003

Due: Electronic turn-in for SMOK: Tue. 11/25 9:00 p.m. (see below).  Written materials: beginning of lecture Weds. 11/26.

You can work in pairs on this homework (including the SMOK project).  In that case, just turn in one copy of the work, with both partners' names on it.   Be sure you both are able to do each problem!


From P&H textbook:
7.7, 7.8, 7.9, 7.18 (you can omit the last detail, showing how the chips are used), 7.20, 7.21, 7.29
7.27, 7.28



SMOK Project

Build a machine which can add two IEEE single precision floating point numbers.  The result should be properly normalized.  If the numbers cannot be added within the confines of the problem as described below, raise an exception.  It is not necessary to emulate all the cases that might be legal or illegal under the full IEEE specifications.   In fact, you do not even have to properly handle negative numbers (as long as you give an exception rather than simply giving an incorrect answer).

Inputs: two (normalized) FP numbers.  Output: one FP number (normalized), and an Exception flag.  The two input numbers are unchanged.  In case the Exception is raised (flag is true), the value of the output number is undefined.

More precisely: build your machine as a set of SMOK "containers", both for general modularity and to make testing and debugging easier  (It is very easy to make a container.  Just "save as container".  After that, your new container will show up on the menu of components you can add).  Some specific submachines (containers) you should have are listed.  Your machine will need additional circuitry, which you can package into other containers or not, as you see fit.

  1. FP format expansion: just like the last project, except that the mantissa (significand) and exponent fields produced do not have to be limited to their unexpanded sizes (8 and 23 bits).  The values in those fields still need to be right-justified, however.
  2. Denormalization: this component takes the 3 expanded  FP fields, plus a 'shift amount" field, and shifts the mantissa by that amount, adjusting the exponent accordingly.  A positive shift amount means "make the mantissa smaller and the exponent larger", and a negative amount means "make the mantissa larger and the exponent smaller" (this sounds mysterious but will not be once you see you how a floating multiply works).  The sign field is not affected.  If the shift cannot be completed for any reason, a one-bit Exception flag is raised.
  3. Normalization: this component takes 3 (expanded) FP fields, and packs them into a single, normalized FP number.  If the normalization cannot be accomplished for any reason, a one-bit Exception flag is raised.

Be prepared to document your outcome in the following three categories:

  1. Cases in which the two numbers are added without any exception and the result is correct.  State the range of numbers for which this is true, and give specifically one test case for it.
  2. Cases in which the two numbers are added but an exception is raised.  State the range of numbers for which this happens, and list the reasons for which an exception is raised.  Give specifically a couple of different test cases.
  3. Cases in which your machine does not operate correctly.  For example, it gives an exception when it shouldn't; it produces the incorrect sum even when no exception is raised, etc.  Give test cases for these situations.

A "test case" is a set of inputs (pair of numbers, in decimal and hex) and the output produced and/or expected (output FP in hex and decimal and value of the Exception flag).

As before, you can use any of the built-in SMOK components (as long as they are not deprecated), and any number of them.  That does NOT mean that you won't be critiqued for using unnecessary or inappropriate or excessive components!

Electronic Turnin Instructions for SMOK exercise

To turn in your file electronically, you will need to: