Previous Contents Next

Appendix B   The Cost and Delay Calculation Programs

In order to calculate the hardware cost and the longest path of the design, two C++ programs are used. The following sections describe the structure of the programs and give usage notes. The programs themselves are not printed here because of their length. The programs should run in any C++/32-bit environment. Both programs use a library presented in [MP95], which provides functions for the cost and delay of the basic gates and simple circuits such as adders, RAMs, and binary trees of gates. A GNU makefile is supplied to make compilation simple. The programs are available via WWW at the address http://www-wjp.cs.uni-sb.de/~kroening/tomasulo/.

B.1   The Hardware Cost Calculation Program

B.1.1   Usage

The hardware cost in gate equivalents is calculated by the cost program. The program takes several command line arguments, which are given in table B.1. By default, the program prints table 5.2 in LaTeX syntax. Other options allow printing of the ROB and reservation station comparison tables.

In order to reduce the delay, the design offers two optimization tricks, which also affect the hardware cost. The ROB is the critical component on the longest path, both tricks therefore modify the path through the ROB. Option --trick1 enables the use of two ROB1 RAMs, one RAM with four read and two write ports, and another with three read and two write ports. Thus, seven read ports are available altogether. Option --trick2 controls the type of the ROB RAM. The ROB RAM is replaced by register based RAM if this option is set. Both options can be combined, but this does not result in further improvement of the delay.


Parameter Purpose
--addcache Add a 16 kb direct mapped cache
--onlysum Only print cost total
--robtable Print the ROB size comparison table
--rstable Print the reservation station comparison table
--comptable Print the comparison table for the three designs
--tag=n Set the number of tag bits to n
--trick1 Enable optimization trick1
--trick2 Enable optimization trick2

Table B.1: Command line arguments of the cost calculation program


B.1.2   Implementation

The implementation of the cost calculation program is similar to the implementation of the cost calculation programs in [MP95]. For each environment or circuit, a function is defined, which returns its cost in gate equivalents in dependence of certain parameters, e.g., tag size. The main function just calculates the sum of these figures.

B.2   The Delay Calculation Program

B.2.1   Usage

The delay calculation program finds the longest path of the design. The program takes several command line arguments, which are given in table B.2. By default, the program prints all components on the longest path, their delay and the accumulated delay of all components. In order to reduce the delay, the design offers two optimization tricks. The tricks and the corresponding command line parameters have been described above.


Parameter Purpose
--tag=n Set the number of tag bits to n
--trick1 Enable optimization trick1
--trick2 Enable optimization trick2

Table B.2: Command line arguments of the delay calculation program


B.2.2   Implementation

The implementation of the delay program is slightly different from the programs in [MP95]. The program determines the delay of the longest path and also prints all components on this path. In order to realize this, the program uses a C++ class library which implements an abstract data type patht which is used as datapath. Data paths start in a register or are provided as external signal. For example, the power up signal pup is defined as follows:

    patht pup("pup");
The string argument is the name of the source of the data path, as used for the printout. A data path can be extended by further components just by adding them:

    patht inv_pup=pup+cinv;
This defines a new data path called inv_pup (inverted power up). The new signal is calculated from pup with the delay of an inverter. In order to allow correlation of gate delays to components of the design, it is possible to add a string to a data path. This string is the name of all gates, which have been added since the last component. The example above is now:

    patht inv_pup=pup+cinv+"inverted power up";
Most gates and circuits use more than one data path as input. The accumulated delay of the new data path is the maximum of the accumulated delays of all input data paths. This can be expressed as follows:

    patht new_path=max(path1, path2, ....)+circuit_delay;
The max function is defined for up to four arguments. However, the source code of the data path library can be extended to any given number of arguments with ease. As soon as a data path ends in a register, it is stored in a list of data paths. After all data paths in the design have been added to that list, the max function of the pathlist is called. It returns the data path with the maximum accumulated delay.


Previous Contents Next