Assignment:
Write a program to demonstrate the effect of a superscalar architecture. Your
program should at least consider the following four cases.
- Baseline I: No dependencies at all, just add constants to operands, or
add operands so that each operation is independent.
- Baseline II: Operation four is dependent upon operation 1.
- Dependency 3: Operation three is dependent upon operation 1.
- Dependency 2: Every operation is dependent upon the previous one.
You may also want to look at mixing floating point and integer operations to
see the effect of having floating point as well as integer ALUs. In other
words, if you have N ALUs and M FPUs, what is the relative change in
computation time for adding another ALU or FPU operation so long as the
number of each is less than N and M, respectively? Compare that to the change
in computation time for adding another ALU or FPU operation so long when the
number of each is greater than N or M, respectively.
Note that, in order to create dependencies you have to fool the optimization that goes on in the compiler. The compiler will sometimes re-order operations to take advantage of the superscalar abilities of the processor. Your program should be a simple for loop that contains at least 4 operations, if not 8, using numerous variables (all local and not pointers). If you find that you are not getting different results for the above cases, then you are not fooling the compiler and it is figuring out a way to optimize the code for you. Students in the past have actually disassembled their code to get at the exact instructions the compiler created in this situation. You may want to do something like this just to prove that your results are due to the superscalar architecture and not something else.