0
\$\begingroup\$

Basically what the title says, I guess I've got some sort of misconception or somthing probably. The ALU can have, say, a ripple carry adder which doesn't produce its entire output all at the same time (it ripples). So how does a computer know when the output is ready? Does it have to do with the clockspeed and propagation delay?

\$\endgroup\$
  • \$\begingroup\$ Given the need for addition in many computer operations, such as computing array element locations in memory, or relative-register addressing, the Clock period is usually somewhat larger than the ADDER propagation delay. \$\endgroup\$ – analogsystemsrf Apr 17 at 1:22
  • \$\begingroup\$ the "computer" does not know ..... the person that designed the cpu knows and has designed the circuitry in a way that allows the output of the ALU to be read at the correct time \$\endgroup\$ – jsotola Apr 17 at 1:30
4
\$\begingroup\$

Let's say that you work out the worst-case propagation delays through the ripple-carry adder and all associated logic as being \$178\:\text{ns}\$ (this includes both subtraction and addition, let's say.) Then you might choose to arrange the minimum clock period to be \$250\:\text{ns}\$ so that you are certain there is enough time. If so, then you might latch the inputs to the ALU on the prior clock period (assuming you can latch both inputs on the same clock, which may not be true) and latch the output of the ALU on the current (following) clock period. That's fine, because you know for sure that there has been enough time for the ALU output to stabilize.

That's not the only way, though. You might have a system which, for other design reasons, has a minimum clock period of \$100\:\text{ns}\$. So, to be safe you arrange things so that you latch the inputs on \$c_0\$ and then only latch the output of the ALU on \$c_3\$ (\$300\:\text{ns}\$ later.) The faster clock may serve other uses well, despite causing the addition/subtraction to take even longer than it might had the minimum clock period been longer. Of course, you could also consider latching the output on \$c_2\$ in this case because \$200\:\text{ns}\$ is longer than the required \$178\:\text{ns}\$.

The above is for clocked CPUs. There are also asynchronous CPUs where the reasoning and methods mentioned above are handled differently. That's a whole different area of research and the answer would be very much different than I gave above. But I don't know much about these, so I'll hold short of saying more about it.

These are all design choices, though. It's not left to the electronics itself to "guess at." (Not in my experience, anyway.) The designer works out the details and makes decisions. Where I was involved some, the design is simulated first. Then it is placed on a huge cube of FPGAs that can run the design almost at full speed. A little "pod" reaches out from the cube to plug into a CPU socket on a real board for further testing. All this before committing to an ASIC and an IC FAB run.

\$\endgroup\$
0
\$\begingroup\$

It's a fixed number of clock cycles after the data is put in the ALU. The exact number depends on the processor, and sometimes also on the specific instruction. You might find it useful to look up the term "pipelining" as it applies to computing.

\$\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.