HW3: Superscalar In Practice
1.) Here's a snippet of x86 assembly code. List all the RAW, WAR,
and WAW dependencies between all instructions (don't include the
implicit EFLAGS dependencies):
1: mov eax,17
2: imul eax,ebx
3: mov DWORD[ecx],eax
4: mov eax,21
5: add ecx,eax
2.) Now manually rename the registers above to eliminate all but the RAW dependencies.
3.) Write an "instructions_interlock" function for the UEMU emulator to detect when the next two instructions can't be run simultaniously. Remember, you can't run two instructions simultaniously if:
- Either instruction throws an exception (0xE... instructions, in UEMU)
- The first instruction is a branch instruction (writes to register 0xF in UEMU)
- The second instruction depends on a value computed by the first
Your "instructions_interlock" function should return correct results
for any pair of instructions, but here are two tiny sample UEMU
programs for testing:
- 3a_add.txt takes 5 clocks without
superscalar execution, but should take 4 clocks with superscalar
execution. There are several opportunities for read-after-write
dependencies. The only other hazard is the emulator exit, the
last instruction.
- 3b_loop.txt
takes 27 clocks without superscalar execution, but should take just 21
clocks when totally superscalar. There are several branch
hazards, and emulator exception calls.
Download the uemu_superscalar.cpp
source code. It takes the input program from standard input, so
you'll need to run it like "my_uemu.exe < 3a_add.txt" on the command
line.
This assignment is due by midnight on Thursday, February 21. Send
me a text file with your dependencies and renamed assembly code, and
your modified uemu_superscalar.cpp, attached to an email.