Assignment 9, due Apr 12
Part of
the homework for 22C:60 (CS:2630), Spring 2013
|
On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper at the start of class on the day indicated (usually Friday). Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!
The parent class, float, has two subclasses, single-float and double-float. All floating point numbers have methods FADD, FSUB. (Yes, real useful floating point numbers will have more methods, but this is a toy example). From a high-level language perspective, the statement a=b+c would be objectified as in your system as a.fadd(b,c).
a) Write an appropriate SMAL Hawk header file, float.h, that defines the interface to the parent class. This will contain some comments and a few definitions. (0.5 points)
b) Given that the variables a, b and c are local variables of the current subroutine that point to floating point objects, give code that is equivalent to a.fadd(b,c). Note that you do not know which floating point representation is involved, so you cannot directly call the floating point operation.
a) Enumerate the signed fixed point decimal equivalents of all of these (0.3 points)
b) What is the minimum number of bits you need in the exponent field in order to support an IEEE-style number with support for normalized floating point numbers, non-normalized numbers and NANs (IEEE-style not-a-numbers). (0.2 points)
c) Enumerate signed fixed-point decimal equivalents of all of the numbers you get in this scheme. There will be more entries in your table than in the answer for part a, but the table should not be too big to imagine writing down. (0.5 points)
a) Draw the schematic diagram that incorporates this change. Neatness counts. Label the inputs and outputs "oldD", "oldC", "oldQ", etc. in order to emphasize that the labels might not reflect the new purpose of those connections. (0.3 points)
b) Draw the timing diagram. As inputs, use the exact same sequence as shown in the timing diagram in the notes (but re-label so "C" is "oldC", etc). You are not required to give the intermediate values at the points labeled R and S in the figure, but they are certainly useful in working out the correct answer. (0.5 points)
c) Give appropriate labels for the points originally labeled old. That is, what should "oldC" be called, what should "oldD" be called, etc. These labels should reflect the function. If a Data input line exists, call it D. If it behaves as a flipflop, call the outputs Q and Qbar, and if one of those outputs can be set to the data input, call that one Q. If positive pulses on the clock input cause a data transfer, clock should be called C. If negative pulses cause data transfer, clock should be called Cbar. (0.2 points)