There are a few common performance metrics:
In general, if you increase the number of programs your throughput will get better and your response time will get worse.
Response time for a program is its execution time:
$$\text{Execution time} = \text{number of instructions}\text{CPI}\text{clock period}$$
The CPI is the number of clock cycles for an application. For multi-cycle datapath, the CPI is around 4-5 depending on how many lw
commands you have.
To know the CPI for a program, you have to know how long each instruction takes, and what mix of instructions you have.
Pipelining is a way to improve the CPI. You find instructions, line them up, and execute them at the same time so you have multiple instructions in flight where each one is doing something different.
As you go to more pipelining stages, the clock period improves.
In our new datapath, there are five stages:
add
or nand
instruction, or to memory if it is a ld
instruction.Let's say you execute an add
instruction, and then a nand
instruction. You will be writing back at the same time as you decode an instruction. This could be a problem. Insert some noop
s to fix it. Problem: this makes your program larger. Another approach is that you do fetch, and then fetch, and you detect if there is a hazard and you hold one instruction in its state until it's ready.
The problems with detect and stall: