/Tomasulo-s-Simulation

C++ simulation of Tomasulo's Algorithm

Primary LanguageC++

Ahmed Fahmy
Ali El-Said
Aya Shaker
Habiba Gamal

This deliverable simulates Tomasulo's algorithm. The inputs can be inputted in 3 different ways. The command line interacts with the user on what to do.
For input from a file, the instructions are preceded by @<starting address>. The data section followed the instruction section and starts by .data:. Each data input is preceded by <address>
The program then outputs the time tracing table for all instructions and the required performance metrics. 

All the tried test cases work.

3 branch prediction modes are implemented. To change the branch prediction mode, there is a macro at the the top of the source code. Set to 0 if static prediction, 1 if 1 bit prediction and 2 if 2 bit prediction.
The program supports labels for branches and jumps when inputting from a file.  

Assumptions: 
RAW dependent hazards do not resume execution in the same cycle as the independent instruction writes.
The structural hazards do not resume issuing in the same cycle when the functional unit was emptied.
The full ROB hazard does not resume issuing in the same cycle when an ROB entry was emptied.
The branch prediction is used in the fetch stage. It is used to fetch the target address of the prediction.
The actual branch outcome is acted upon in the commit stage.
JMP is handled in the fetch stage (similar as branch prediction)
For JALR, RET and mispredicted branches, the processor flushes in their commit stage.
For a load dependent on a store, it does not start execution until the store commits.