In this lesson, you will learn how to balance the speed of your clock pulses against the complexity of your instructions to achieve the best overall processor performance.
The Performance Equation
To understand CPU speed, we look at the CPU Time equation:
CPU Time = (Instruction Count) × (Cycles Per Instruction (CPI)) × (Clock Cycle Time)
When designing a processor, we often face a "tug-of-war" between CPI and Clock Cycle Time.
The Trade-off
Think of CPI as how many "steps" it takes for your hardware to finish an instruction. If you make your instructions very powerful (like in a CISC design), you might complete a complex task in fewer instructions, but each instruction takes many cycles to complete because the hardware logic becomes massive and slow.
Conversely, if you keep instructions simple (like in a RISC design), the hardware logic is "thin" and fast. This allows the processor to tick at a much higher frequency, meaning the Clock Cycle Time is very short. However, you might need many more instructions to get the same work done.
Concrete Example
Imagine you want to perform an addition.
- Design A: A complex instruction that performs
Memory Load + Add + Storein one go. It has a highCPI(say, 5 cycles) but a slowClock Cycle Time(because the logic path is long). - Design B: Three separate instructions (
Load,Add,Store). Each has a lowCPI(1 cycle each, total 3 cycles), and because the circuits are simple, theClock Cycle Timeis significantly faster.
If Design B’s clock is twice as fast as Design A’s, it will likely beat Design A in total execution time, even though it executes more instructions. Optimization is all about finding the "sweet spot" where the product of CPI and Clock Cycle Time is minimized. We optimize CPI by simplifying the datapath stages (like the ALU or register file access) so that we don't force the clock to slow down just to accommodate a single, overly complex operation.
Key Takeaway: Improving performance requires finding the optimal balance where reducing the Cycles Per Instruction does not force a detrimental increase in the Clock Cycle Time.