How does an instruction in a CPU report that is has finished?

0

When an instruction is sent to a CPU, that may take multiple clock cycles to complete, when does the CPU know that the instruction has finished and can start processing the next one? I'm mostly interested in RISC architectures for the simplicity, since CISC may contain complex microcode.

Xenopathic

Posted 2014-03-09T01:01:18.377

Reputation: 746

if one looks at pictures in old textbooks, the "program counter" gets incremented. you can read about the 'program counter' 'memory address register' memory buffer/data register'. address bus, data bus, control bus or control lines. – barlop – 2015-03-09T16:49:22.833

I think your confused by how instructions work. An instruction can't take multiple clock cycles. Now a series of instructions that make up a method is something else entirely. As for tracking the progress that's what the cache is for – Ramhound – 2014-03-09T01:13:48.490

Many RISC systems doesn't have multi-cycles instructions. Not having to keep track of multi-cycles instructions are part of what makes them much simpler than CISC. – Lie Ryan – 2014-03-09T01:16:51.347

Today's machines (even single core) are normally executing several instructions at once. You should look for resources on computer architecture (there sure are lots of lecture notes and other resources of the net). – vonbrand – 2014-03-09T02:47:56.480

3@Ramhound Of course an instruction can take multiple clock cycles. Multiplies typically take longer than adds, for example. – David Schwartz – 2014-03-09T02:54:37.070

Answers

1

Typically, for simple CPUs that are not superscalar and don't have sophisticated pre-fetch or pipeline logic, this is done by an actual circuit connection. When an instruction is retired, a wire from the retire logic to the fetch unit triggers the fetching of the next instruction.

David Schwartz

Posted 2014-03-09T01:01:18.377

Reputation: 58 310

0

What you are asking can be found by googling for "Processor timing diagram":

http://goo.gl/DkEE8I

Inside the timing diagram you can see when instructions is put on the bus, and when it is completed it can triggered the next instruction to be fetched etc.

Yes, different instructions have different number of clocks cycles - eg, those XMM instructions from Intel architecture are going to take much longer than a simple XOR operation. Moreover, due to caching, and pipelining, the SAME instructions may even have different overall latencies.

Since you asked for RISC then perhaps you should read the ARM processor timing diagram:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0301h/I998937.html

Peter Teoh

Posted 2014-03-09T01:01:18.377

Reputation: 103