4
\$\begingroup\$

In grossly simplified terms, a processor calculates 1 instruction in a single clock cycle. But what does that even mean? If a processor is a bunch of transistors, is 1 clock cycle simply 1 state change (or the potential for a state change) for all those millions of transistors? Is 1 clock cycle how often the state of every transistor get evaluated? What exactly is happening, electrically, in 1 clock cycle?

\$\endgroup\$
  • 3
    \$\begingroup\$ You should look through one particular video series on Youtube made by Ben Eater, each video is about 20 minutes, and there's a total of 44 videos in the playlist. He literally builds a computer and shows how everything works. + He's a very good talker. The video that answers your question is the 36th video I believe, also the 37th and 38th. \$\endgroup\$ – Harry Svensson May 9 '18 at 22:32
  • 1
    \$\begingroup\$ @HarrySvensson I'm 10 minutes into the 36th video and that is super cool! Thanks for the link. Now I want to watch a bunch more of these! \$\endgroup\$ – user3629081 May 9 '18 at 22:55
  • 1
    \$\begingroup\$ Interesting video series \$\endgroup\$ – Mitu Raj May 10 '18 at 5:21
  • 1
    \$\begingroup\$ @MITURAJ I wire-wrapped my own design in 1974. Didn't have no fancy wireless protoboards (I'd have probably failed trying to use them, anyway.) Got a local newpaper reporter out who did a story on me (no idea who ratted me out.) Could only afford 256 bytes at the time. That was REAL MONEY then. I very much enjoy seeing that there is at least one more idiot like me out there!! Have you seen this one: Harry Porter's Relay Computer? He's local to me. \$\endgroup\$ – jonk May 10 '18 at 6:32
3
\$\begingroup\$

The transistors in a CPU will be arranged to form small functional units. These fall into two main categories: combinatorial logic (logic gates, adders, multiplexers, etc.) and stateful logic (flip flops, latches, SRAM, etc.). Combinatorial logic performs various logical and mathematical operations, while stateful logic can store data. Generally the clock is only connected to stateful logic, such as flip-flops. Combinatorial logic is then connected between stateful logic elements. So you might have a flip flop that feeds some logic gates, which then feeds another flip flop. Combinatorial logic has a propagation delay associated with it--how long it takes for the output to change after the input changes. Each flip flop will transfer whatever logic level is on its input through to its output on the active clock edge, once per clock cycle. The fastest possible clock period is then determined by the longest propagation delay through the logic between the flip flops.

So yes, your statement is essentially correct that each clock cycle is essentially one state change.

In a CPU (or any other synchronous digital logic), the clock serves merely to synchronize the flow of data though the chip such that computations are preformed correctly. The clock is necessary because the propagation delays through the logic can vary, either along different paths or with process, voltage, and temperature (PVT). Incidentally, this is why you see sites like silicon lottery and why CPU manufacturers sell multiple versions of the same chip that run at different speeds--variations in how each chip gets produced mean that the propagation delays of the logic will all be a little different, so some chips will support faster clocks than others.

It is possible to design CPUs that do not use a clock. This is called asynchronous design. It has the advantage of not requiring a clock and all of the complexity and power consumption associated with it, but asynchronous design is more difficult as the circuit must be designed such that no propagation delays are violated, even with variations between chips and across different voltages and temperatures. I have heard that a company made an asynchronous CPU quite a few years ago, and it would slow down if you set a cup of hot coffee on top of it due to the asynchronous logic adjusting to the temperature change.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.