 In this example, we'll be looking at this set of code and seeing how it's going to be handled by Thomas Hulu's algorithm. As before, we can fetch two instructions every cycle and we can commit two instructions every cycle. We also have two integer ALUs and a load store unit to process our information. So we'll start by pulling in two instructions. We'll have an add immediate and a store word instruction. Our instruction fetch is actually going to be really simple. We'll just issue two instructions every cycle. So we'll go ahead and fill that out now. Each cycle will issue two more instructions. Now we can focus on what happens inside. So our add immediate instruction is going to do some arithmetic. It's going to be one of our adders. We'll just send it off to our first ALU. Store word instruction, on the other hand, requires memory unit. So we'll send it off to the memory unit. Now there is a dependency between our store word and the add immediate instruction. They're dependent on the stack pointer. Our add immediate instruction can run immediately. It doesn't have any dependencies. Which means that it will be sent out on the boss at the end of cycle three. Our store word instruction will be able to grab that data off of the boss in cycle three. Then it will have all of its parameters so that it can run in cycle four. This means that their data will reach the commit unit in cycle three and cycle four. And then those can be committed as soon as they're available. Next we've got a store word and an add instruction. So our second store word instruction is also dependent on the stack pointer. Which means it won't be able to run until cycle four. But it's going to go off to the load store unit and discover that it can't run in cycle four anyway. It's going to have to wait until cycle five. We'll arrive at the commit unit. Then it can be committed back in cycle six. Add instruction is dependent on T zero and T seven. Neither of these are related to any of the instructions that we've had before. So I will just send that to an ALU. Say ALU two. Then it can run immediately because all of its parameters are available. So it will get its results to the commit unit in cycle four. But we do need to commit all of our instructions in order. So we can't commit this instruction in cycle five. We'll have to wait until cycle six. Because we do still have one opening in cycle six. Next we have a subtract instruction and a load word instruction. Our subtract instruction depends on S zero and T three. We just computed S zero. So we're going to have some dependency between this instruction and this instruction. I'll send our subtract instruction off to the first ALU. We'll arrive here in cycle four when that ALU is empty. And it will need to wait until this instruction has computed its results. On the other hand, these results will be computed in the same cycle that our subtract instruction actually reaches the ALU. So it will actually have all of its parameters available to it immediately. And it can just run. We'll end up at the commit unit. But we can't commit this instruction in cycle six because we can only commit to instructions per cycle. So it will have to wait until cycle seven to be committed. Next we have the load word instruction. So our load word instruction is dependent on S zero, which we calculated here again. So that should be available to us now. It's also dependent on the stack pointer, which was updated way up here. It should also be available. So we'll just send this off to the load store unit. It's got all of its parameters available to it, but the memory unit is still in use. It's going to be in use until cycle six. So the load word instruction gets to run in cycle six. Results will then be committed back. This time we do have a slot open in cycle seven. So we can commit those results immediately. Next we have our second load word instruction. Our load word instruction is only dependent on the stack pointer. As I should have pointed out was the previous load word instruction. Again, our stack pointer was updated in cycle three. That data is available to us immediately. We can use that whenever we want. We just have to send this instruction off to the memory unit. We'll arrive here in cycle five. And it will wait around until cycle seven, because that's the first time that our memory unit is going to be free and available. It will reach the commit unit at the end of cycle seven. And then it can be committed back in cycle eight. Then I just have the add immediate instruction. Add immediate instruction updates the stack pointer. You can also see that I could have the potential for a couple of right after read hazards there. So this instruction is going to go off to an ALU. I'll send it to ALU two because that one looks open in cycle five. So the stack pointer was updated in cycle three. All that data is available to this instruction so it can run immediately as well. It runs in cycle six. Reaches the commit unit in cycle six. But we don't use these for any of the previous instructions. We wanted to use the stack pointer for these two instructions, but we're not going to pass the updated value of the stack pointer to either of these instructions because that would give us bad results. Likewise, we make sure to wait to commit these results until all of the previous instructions have also been committed. So this instruction can be committed in cycle eight. And that's how these eight instructions would be processed by Tomasulo's algorithm.