next up previous contents
Next: Contracts Up: Participants Previous: The Compiler

Hardware Specifications

The hardware specification file was already mention in the previous section. This file does not need to contain everything there is to know about the hardware. Rather, it should contain only the information necessary to the compiler for determining timing, cost, precision, range, and reliability requirements. Optionally, a hardware simulator could be used in place of the hardware specification file. Note that such hardware simulators already exist and are used by the manufacturer during the design phase of a new architecture. The simulator would be useful in many different situations. The first is to give an overall maximum wall clock time for a block of application code. Another is to select the fastest code among alternatives in an algorithm where machine dependent details matter.

For example, consider the quadratic equation. The denominator is the term `2a'. For many years, it has been standard practice in a situation like this to calculate the value once and place it in a temporary variable. Then every time a division is called for, a multiplication by the inverse is used instead. The rationale is that a floating point multiplication is typically faster than a division. We believe that the application programmer should accommodate as many alternative hardware possibilities as is manageable.

Rather, this is a feature that can and should be tested at compile time and the application programmer should supply two versions of the code: one using the temporary variable and one that does the division every time. Then after the compiler has done its speed test for division versus multiplication, it can decide which alternative section of code to use. We can extend this idea even further by having the compiler time both branches of code ( i.e. an entire section of code) and then select the quicker of the two.

In summary, we have shifted the burden off of the compiler and onto the application programmer. This is contrary to the prevailing academic goal. We believe this approach has the benefit of reducing long term development costs - even though it is at the expense of greater short-term cost.



next up previous contents
Next: Contracts Up: Participants Previous: The Compiler



Dr. T. L. Marchioro II
Wed Aug 9 16:54:08 CDT 1995