# Power consumed by a CPU

I think the power for a CPU with current I and voltage U is I · U.

I wonder how the following conclusion from Wikipedia is derived?

The power consumed by a CPU, is approximately proportional to CPU frequency, and to the square of the CPU voltage:

P = CV2 f

(where C is capacitance, f is frequency and V is voltage).

-
Is it more suitable on Electronic.SE or Physics.SE or here? Please consider migration instead of closing – Tim Jun 5 '12 at 12:05
C in that equation is just some constant, not capacitance. It kinda-sorta could be "effective capacitance", since it has the right units for capacitance, but the factor is wrong. As others have noticed, there's a 1/2 missing, but importantly, there's a load coefficient missing, related to the fraction of gates which switch each clock cycle. Call it a proportionality constant and leave it at that. – Ben Voigt Jun 5 '12 at 18:06
@Ben - The line (where C is capacitance, f is frequency and V is voltage). is quoted from the WP page, though. – stevenvh Jun 5 '12 at 18:09
@stevenvh, please tell me you are editing and posting a new verison of the post you just deleted, I was about to give you a +1 and a comment just asking that you remove the historical artifacts and make one clear concise post. – Kortuk Jun 5 '12 at 19:07
@Kortuk - I have a much better and more detailed answer in my head, no time now, I'll post it tomorrow. – stevenvh Jun 5 '12 at 19:58
show 6 more comments

## migrated from superuser.comJun 5 '12 at 16:12

MSalters answer is 80% correct. The estimate comes from the average power necessary to charge and discharge a capacitor at constant voltage, through a resistor. This is because a CPU, as well as every integrated circuit, is a big ensemble of switches, each one driving another one.

Basically you can model a stage as a MOS inverter (it can be more complicate, but the power remains the same) charging the input gate capacitance of the following one. So it all comes down to a resistor charging a capacitor, and another one discharging it (not at the same time of course :)).

The formulas that I'm going to show are taken from Digital Integrated Circuits - A design perspective from Rabaey, Chakandrasan, Nikolic.

Consider a capacitor charged by a MOS:

the energy taken from the supply will be

$$E_{VDD} = \int_0^\infty i_{VDD}(t)V_{DD}dt=V_{DD}\int_0^\infty C_L \frac{dv_{out}}{dt}dt = C_L V_{DD} \int_0^{VDD} dv_{out} = C_L {V_{DD}}^2$$

While the energy stored in the capacitor at the end will be

$$E_{C} = \int_0^\infty i_{VDD}(t)v_{out}dt = ... = \frac{C_L {V_{DD}}^2}{2}$$

Of course, we don't wait an infinite time to charge and discharge the capacitor, as Steven points. But it's not even dependent on the resistor, because it's influence is on the funal voltage of the capacitor. But independently from that, we want a certain voltage un thefollowing gate before considering the transition done. So let's say that it's 95% Vdd, and we can factor it out.

So, independently on the output resistance of the MOS, it takes half of the energy that you store in the capacitor to charge it at constant voltage. The energy stored in the capacitor will be dissipated on the pMOS in the discharge phase.

If you consider that in a switching cycle there are a L->H and a H->L transition, and define $f_S$ the frequency at which this inverter completes a cycle, you have that the power dissipation of this simple gate is:

$$P = \frac{E_{VDD}}{t} = E_{VDD} \cdot f_S = C_L {V_{DD}}^2 f_S$$

Note that if you have N gates, it's sufficient to multiply the power by N. Now, for a complex circuit the situation is slightly more complicated, as not all the gates will commute at the same frequency. You can define a parameter $\alpha<1$ as the average fraction of gates that commute at every cycle.

So the formula becomes

$$P_{TOT} = \alpha N C_L {V_{DD}}^2 f_S$$

Small demonstration of the reason because R factors out: as Steven writes, the energy in the capacitor will be:

$$E_C = \dfrac{V_{DD}^2 \cdot C}{2} \left(1 - e^{\dfrac{-2T_{charge}}{RC}}\right)$$

so apparently, R is a factor of the energy stored in the capacitor, due to the finite charging time. But if we say that a gate must be charged to 90% Vdd in order to complete a transition, than we have a fixed ratio between Tcharge and RC, which is:

$$T_{charge} = \frac{-log(0.1)RC}{2} = kRC$$

one chosen it, we have again an energy which is independent of R.

Note that the same is obtained integrating from 0 to kRC instead of infinite, but the calculations become slightly more complicated.

-
 great answer except it misses any pictures for me to verify the technical accuracy with. – Kortuk♦ Jun 5 '12 at 19:45 Thanks! (1) Do you still mean $E_{VDD}$ by $E$? (2) Where is dividing by 2 in the formula for $P$? (3) In the circuit, is the current direct current, or alternating current? – Tim Jun 5 '12 at 19:52 @Tim yes, the energy in a cycle is Evdd because it's the charge necessary to charge the capacitor; the stored half will dissipated in discharge. The current is neither of both, is variable current that will have the exponential characteristic (fin-like) of charging and discharging the cap. – clabacchio♦ Jun 5 '12 at 20:01 Thanks! (1) I still don't quite understand there is no dividing by 2 in formula of $E_C$, while there is in formula for $E_VDD$. (2) I looked at Wikipedia, but couldn't figure the concepts of DC and AC well enough to understand your last sentence in your comment. Could you explain them and why the current here is neither of them? – Tim Jun 5 '12 at 20:06 @Tim Ec is divided by 2, for reason that come from physics and that you can derive from the equation (that I cut for brevity). The signal is variating over time, hence (t), and is neither AC or DC, but eventually more similar to the former. It's unpredictable since depends on the operation of the gate. – clabacchio♦ Jun 5 '12 at 20:27
show 5 more comments

I posted another answer before, but it wasn't good, also improper language, and I want to apologize to markrages.

I've been thinking this over and I think that my problem here is that to me the quoted text suggests that the capacitance is responsible for the power dissipation. Which isn't so. It's resistive.

Voilà une paire complémentaire MOS. The MOSFETs together with the capacitor form a charge pump. When the output goes high the P-MOSFET conducts it will charge the capacitor from $V_{DD}$, when it goes low the capacitor will be discharged to $V_{SS}$ through the N-MOSFET. Both MOSFETs have an on resistance which makes that they dissipate power dureing the charging/discharging. Now Ben suggests the resistance value doesn't matter, while I say the opposite. Well, we're both right, so also both wrong.

First Ben: both capacitor voltage and current vary exponentially during charging. The current

$I = \dfrac{V_{DD}}{R} e^{\dfrac{-t}{RC}}$

$P = I^2 R = \dfrac{V_{DD}^2}{R} e^{\dfrac{-2t}{RC}}$

and integrating over time gives us energy dissipated in the resistor:

$U = \dfrac{V_{DD}^2}{R} \displaystyle \int_{t=0}^{\infty} e^{\dfrac{-2t}{RC}} \mathrm{d}t = \dfrac{V_{DD}^2}{R} \dfrac{RC}{2} = \dfrac{V_{DD}^2 \cdot C}{2}$

which is indeed independent of $R$. So it looks like Ben is right.

Now me. "Infinity!? Are you out of your mind? This job has to be done in 0.3ns!" At school we seemed to have ages to charge a capacitor. If $t$ is finite we get

$U = \dfrac{V_{DD}^2}{R} \displaystyle \int_{t=0}^{t1} e^{\dfrac{-2t}{RC}}\mathrm{d}t = \dfrac{V_{DD}^2 \cdot C}{2} \left(1 - e^{\dfrac{-2t}{RC}}\right)$

and then $R$ is still a factor.
In practice it won't matter however since $RC \ll T_{CLOCK}$.

I cut some corners here assuming that $R$ is constant. But it's not easy. $R(t)$ depends on the gate's voltage, which depends on the gate's capacitance's charge curve, which depends on $R$. Easy if it's a linear system, but this isn't, so I chose for the exponential as an approximation.

Conclusion: while the dissipation is expressed in terms of $C$ it happens in $R$, which on first sight seems to have nothing to do with it.

What can be done about it? Lowering $R$ is no use. Can we decrease $C$? It would help to decrease the charge being drained from $V_{DD}$ to $V_{SS}$, but we need $C$. The gate capacitance is what makes a MOSFET work!

What if $R$ were zero, absolute zero? Then we wouldn't have dissipation, right? In that case switching would give an infinite $di/dt$, which would cause the switching energy to be radiated instead of dissipated, but the amount of energy would be the same. Your CPU would get less hot, but would be a wideband 100W RF noise transmitter.

-
 No agree :). Your paragraph about the finite time is right, but it assumes that we fix the time that we give for the transition, while what is fixed is the voltage at which we assume the transition finished. So the resistor goes away again, because it determines the maximum speed of the CPU, and it's why is better to scale down the capacitance (one of the reasons) – clabacchio♦ Jun 6 '12 at 6:56 Note that I usually leave a big margin for errors in my answers, but this is - almost - copied from a very expensive book :). I trust its (conceptual) accuracy more than any other, typos apart. – clabacchio♦ Jun 6 '12 at 6:59 @clabacchio - Ben is Ben Voigt, who commented on my other answer. The resistor goes away again because of the short RC time. But there's no reason why you shouldn't break off the charging at a higher clock speed if a 90% charge would be sufficient. My very expensive book is my head (sometimes with the help of Mathematica) :-) – stevenvh Jun 6 '12 at 7:07 My reasoning is different: I say that it's not because t>>RC (it would be a waste of resources), but that t=kRC, where k is a design constraint that ensures enough voltage swing to be robust. If you always use the same k, then that factor goes away (also with rhyme). The thing about the book was to make clear that I don't support my claim just for arrogance – clabacchio♦ Jun 6 '12 at 7:11 Better the way it is :-). I even hid the content from the +10k rep users. I think Kortuk was too positive about it. About the RC, I think we're saying the same thing. If your k=2.3 then you end up at my 90%. – stevenvh Jun 6 '12 at 7:18
show 6 more comments

Capacitance is measured in Farads, which is Coulombs per Volt.

Frequency is measured in Hertz, which is units per second.

Reducing we get Coulomb-Volts per second, more commonly known as Watts, a unit of power.

-
This does not really answer why though. – Kortuk Jun 6 '12 at 10:59

The main power draw in CPU's is caused by the charging and discharging of capacitors during calculations. These electrical charges are dissipated in resistors, turning the associated electrical energy into heat.

The amount of energy in each capacitor is Ci/2 · V2. If this capacitor is charged and discharged f times per second, the energy going in and out is Ci/2 · V2 · f. Sum for all switching capacitors and substituting C = ΣCi/2, you get C · V2 · f

-
 Thanks! WHy C = ΣCi/2, not C = ΣCi? In other words, how do you make dividing by 2 disappear? – Tim Jun 5 '12 at 11:25 @Tim: Pure a matter of definition. In practice, the C value of a CPU is measured directly. – MSalters Jun 5 '12 at 11:52 In series, 1/C = \sum_i 1/C_i; in parallel, C = \sum_i, C_i. Neither is your formula C = 1/2 \time \sum_i C_i. This is my confusion. – Tim Jun 5 '12 at 11:55 @Tim: That's assuming the capacitors are hardwired in parallel anyway (sum_i). With all the gates switching on a CPU, this isn't a given anyway. But the main reason I dropped the 1/2 is because I'm using an engineering approach, not a pure physics approach. A CPU isn't acting as a capacitor anyway. The C value isn't related to (dV/dt)/I; it's merely an observed contant relating P, V and f. – MSalters Jun 5 '12 at 12:07 @Tim: If you keep the 1/2, it will just cancel out, you'll just get a different value for capacitance. For example, solve for C, you get either V^2·F/P or (1/2)·V^2·F/P. Now, let's say you change the voltage, frequency, and power. With the first equation, you get V1^2·F1/P1 = V2^2·F2/P2 and in the other case you get (1/2)V1^2·F1/P1 = (1/2)V2^2·F2/P2 which is the same thing. – David Schwartz Jun 5 '12 at 12:07

Generally the current consumed by a device is proportional to the voltage. Since the power is voltage*current, the power becomes proportional to the square of the voltage.

-
That is far from "generally". In fact there's a special name for such devices: Ohmic loads (From Ohm's law, V = I · R) – MSalters Jun 5 '12 at 9:42

Your equation is correct for the power drawn at any particular instant. But the current drawn by the CPU is not constant. The CPU is running at some frequency and changing states on a regular basis. It uses a certain amount of power for each state change.

If you understand I as the RMS current (the square root of the average of the square of the current) then your equation is correct. Putting these together, you get:

V · I(Rms) = C · V^2 · F
I(Rms) = C · V · F

So the average current varies linearly with the voltage, frequency, and capacitance. The power varies with the square of the frequency.

-
Thanks! My question is why V · I(Rms) = C · V^2 · F? Do you have some references for that formula? – Tim Jun 5 '12 at 11:27
I'm don't quite get what you want to know. – David Schwartz Jun 5 '12 at 11:36
Why is V · I(Rms) = C · V^2 · F true? WHere do you learn it from? – Tim Jun 5 '12 at 11:47
It's true because it combines two power equations, each of which is correct and which measure the same thing. That I has to be RMS power for P=V·I to give you average power can be trivially proven with calculus from P = I^2·R. – David Schwartz Jun 5 '12 at 11:54
@Tim: If you divide by two, you just have to double the capacitance and the equation works the same. If you want to divide by two, you can. You'll just use capacitance numbers that are double what everyone else uses and you will get the same answers. (We use 12 inch feet, but you could use 6 inch feet if you wanted to. You can still design cars, buildings, and bridges. You'll just call them different sizes from everyone else.) – David Schwartz Jun 5 '12 at 12:34
show 5 more comments