previous | contents | next

Fig. OC-6. RTM diagram to test the "Count number of ones in a word" RTM system.

TESTING

The above four designs represent solutions to the isolated problem of designing subprocesses to compute the number of ones in a word. These designs create an additional problem of testing whether they in fact work. Each system can be checked by the additional components given in Figure OC-6. A T(lights and switches) is added to the data part. The control part causes the switches to be read into W, the subprocess to be executed, and the results to be displayed. By observing the relationship between lights and switches the system correctness can be verified to a certain extent.

1. Why does Solution 2 take an additional loop time? What is the average time for Solution 2?

2. What is the operation time and system cost for Solution 3?

3. The solutions given assume that the data is shifted left (i.e., A <- Ax2). Since the B register of a DMgpa can be shifted right, then the best solution (in terms of minimum cost and time) may be based on an assignment of A\Count and B\Word\W in a single DMgpa. Thus the arithmetic operations: Count <- Count+1; and W <- W/2 are both permitted. Carry out this design.

4. Using the flowchart to hold data, as in Figure OC-4, together with 16 different constants, design an RTM system which counts the number of ones in a word without using shifting.

5. Using a specially wired M(transfer register), design a faster ones counter for both the count, and modulo 2 count cases.

6. Plot the time vs. cost on a graph for Solutions 1 to 3, and your designs in problems 3, 4 and 5.

7. Another operation, normalization, is used in certain arithmetic operations and is similar to counting ones. Normalization consists of determining a count which corresponds to the bit position of the most significant one in a word. The result

86

previous | contents | next