Clock speed is all important to CPU performance. At least, that’s what the marketing department in companies that design and sell CPUs would like you to think. Of course, there are many other factors and the weighting of all of them depends on your use case. A lightly threaded video game will typically benefit from one lighting fast core, backed up by a few slower cores. A rendering computer will typically benefit from as many cores as possible, and while faster is better, more cores are even better. In mobile environments performance is important but power efficiency is paramount, especially when peak performance is not required.
Many factors affect performance in all of these scenarios but one constant factor is the clock. In the CPU the clock signal determines when things happen. A faster clock tick rate means more operations in a given time. This sounds great, surely you just want it to tick as fast as possible then, right? Not so fast. Firstly, every tick of the clock causes a pulse of power. This power has to come from somewhere. It also results in the production of heat, which then must be dissipated. Secondly, it’s actually really hard to ensure that everything stays properly synchronised, and it gets harder the faster the clock ticks.
Power and thermal management
There are two main uses of electrical power. The first is the constant current of a system that is powered on. The second is the surge from a system being turned on. The main source of power usage in a CPU is actually due to the constant switching of circuits on and off. The clock signal drives that switching. It also, alone, contributes a non-trivial amount of that power usage.
The thing is, some pieces of hardware on a CPU aren’t needed in every CPU cycle. In most clock cycles, an individual register for example, won’t be needed. As such, sending it a clock signal and causing it to toggle on and off quickly simply wastes power, for no gain. Clock gating is the technique of preventing the clock signal from reaching areas of the CPU that aren’t needed for that particular clock cycle.
The hardware for clock gating must be placed in the path of the clock signal to each piece of functionality that you might want to gate off from the clock. Where multiple bits of functionality are always and exclusively needed together it can be possible to place them behind the same clock gate. By disabling the clock signal behind the gate, the main source of power usage can be removed. This can help to significantly decrease power consumption, which is especially important for battery-powered devices.
Note: The clock gate itself does use power, so it’s important to ensure that it’s only used where it will save more power than it uses.
The absolute speed limit
We mentioned before that it gets harder to synchronise fast clocks. Unfortunately, that is a hard and fast rule imposed by basic physics. The fastest speed at which anything can travel is the speed of light in a vacuum. That’s roughly three hundred million meters per second (or 670,600,000 miles per hour) that’s really fast. Another thing that’s really fast is the clock speed on modern CPUs. 5.7GHz or 5.7 billion ticks per second translates to one clock tick every 175 picoseconds, or 0.175 nanoseconds. When put together, you can work out how far light can travel in the timeframe of a single clock tick. It’s 55mm or 2.1 inches.
Now computers don’t run on photons, at least they don’t yet though photonics is an advancing field. Computers run on electrons which move slower. There also isn’t a single straight line for electrons to travel and there are many electronic components that are in the way. Each of these delays the signal propagation. To that end, the clock signal needs to be introduced to a CPU at many different points to actually be properly synchronised across the whole thing.
As mentioned, intervening electronics slow down the clock signal propagation. This is true even for clock gates. As such, during CPU design, it’s important to take this into account. It’s also important to understand exactly what effect this can have on the overall shape of the clock signal. A slightly delayed leading edge can be combined with a properly aligned falling edge resulting in a shorter clock period and potentially incomplete functions.
A Clock Gate is a circuit component used in processor design. It prevents or enables the synchronising clock signal from reaching one or more further components. This essentially acts as a switch. The main purpose is to save power by not spending power toggling circuits on and off that aren’t supposed to do anything. It also prevents that energy from being converted into heat. This leaves more thermal and power budget for other components of the processor that are being used. Alternatively, it reduces the overall system load on the power and cooling system. System design needs to account for the delay that any components, even a switch places on such a tightly timed clock signal. Care must also be taken to ensure that opening the gate doesn’t send a shortened clock signal if the clock signal is already high as the gate opens.