Pipelines and Clock Cycles

  • Comp Sci
  • Thread starter ver_mathstats
  • Start date
  • Tags
    Clock Cycles
In summary: Sorry that's not what I meant, I know they work together passing information along, but they are not independent.
  • #1
ver_mathstats
260
21
Homework Statement
We have a 16-bit architecture which has a five stage pipeline for instruction execution, the five stages are: (a) fetch the next instructions, (b) decode the instructions and fetch operande, (c) perform ALU operation, (d) read or write to memory and (e) store the result in the register. Assuming each stage takes three clock cycles, how many instructions per clock cycle does the overall architecture execute? What would be the consequence of improving stage (a), (b), and (c) to process one instruction per cycle?
Relevant Equations
five stage pipeline
I think I am having trouble visualizing the count for the clock cycle. Would this just be the clock cycles divided by the instructions of the pipeline? I'm confused about how each stage of the pipeline takes three clock cycles to complete when there are five stages?

The consequence of improving stage (a), (b), and (c) is that the entire program will execute in about the same time? Is this the right idea?

Any help would be appreciated, thank you.
 
Physics news on Phys.org
  • #2
ver_mathstats said:
Homework Statement:: We have a 16-bit architecture which has a five stage pipeline for instruction execution, the five stages are: (a) fetch the next instructions, (b) decode the instructions and fetch operande, (c) perform ALU operation, (d) read or write to memory and (e) store the result in the register. Assuming each stage takes three clock cycles, how many instructions per clock cycle does the overall architecture execute? What would be the consequence of improving stage (a), (b), and (c) to process one instruction per cycle?
Relevant Equations:: five stage pipeline

I think I am having trouble visualizing the count for the clock cycle. Would this just be the clock cycles divided by the instructions of the pipeline?
You have this backwards. Once the pipeline is full, all pipeline stages are executing at the same time. Again, when full, there are 5 stages operating every 3 seconds.
ver_mathstats said:
I'm confused about how each stage of the pipeline takes three clock cycles to complete when there are five stages?
Again, the five stages are operating independently.
ver_mathstats said:
The consequence of improving stage (a), (b), and (c) is that the entire program will execute in about the same time? Is this the right idea?
No. Speeding up the pipeline stages means that more instructions can be executed in less time.
ver_mathstats said:
Any help would be appreciated, thank you.
 
  • #3
Mark44 said:
No. Speeding up the pipeline stages means that more instructions can be executed in less time.
This is only true if later stages of the pipeline can be skipped if not necessary, otherwise stage (d) will become a bottleneck and one instruction per 3 cycles is still the upper bound.
 
  • Like
Likes FactChecker
  • #4
pbuk said:
This is only true if later stages of the pipeline can be skipped if not necessary, otherwise stage (d) will become a bottleneck and one instruction per 3 cycles is still the upper bound.
Exactly. And a mismatch at a bottleneck makes low-level programming much trickier. The results of the fast part of the pipeline would have to be grabbed and used before they were overwritten by the next calculation. That would force some sort of splitting of the fast results among multiple slower pipeline parts. This problem was central in programming array processors.
 
Last edited:
  • #5
pbuk said:
This is only true if later stages of the pipeline can be skipped if not necessary, otherwise stage (d) will become a bottleneck and one instruction per 3 cycles is still the upper bound.
Right. What I was saying was more germane to arithmetic-type or similar instructions that don't have to access memory for reads or writes.
 
  • #6
Mark44 said:
You have this backwards. Once the pipeline is full, all pipeline stages are executing at the same time. Again, when full, there are 5 stages operating every 3 seconds.
Again, the five stages are operating independently.
No. Speeding up the pipeline stages means that more instructions can be executed in less time.
So when trying to figure out the instructions per clock cycle, we would just be dividing the amount of instructions by the amount of clock cycles? Because the five stages operate independently?
 
  • #7
ver_mathstats said:
So when trying to figure out the instructions per clock cycle, we would just be dividing the amount of instructions by the amount of clock cycles? Because the five stages operate independently?
Any rate, such as instructions per clock cycle, can be thought of as a fraction:
$$\frac{\text{number of instructions}}{\text{number of cycles}}$$
 
  • Like
Likes ver_mathstats
  • #8
ver_mathstats said:
Because the five stages operate independently?
I would not say it that way. The stages can run simultaneously, but they are not independent, they must pass the information along. So if one runs slower, the others must wait to supply or take the data to/from the slower stage. Things are simple when they are all running at the same rate but the second question of your post is more complicated.
 
  • #9
FactChecker said:
I would not say it that way. The stages can run simultaneously, but they are not independent, they must pass the information along. So if one runs slower, the others must wait to supply or take the data to/from the slower stage. Things are simple when they are all running at the same rate but the second question of your post is more complicated.
Sorry that's not what I meant, I know they work together passing information along
 
  • Like
Likes FactChecker

1. What is a pipeline in computer architecture?

A pipeline in computer architecture is a technique used to improve the performance of a processor by breaking down instructions into smaller stages and executing them in parallel. This allows for multiple instructions to be processed simultaneously, increasing the overall speed of the processor.

2. How does a pipeline work?

A pipeline works by dividing the execution of instructions into smaller stages, such as instruction fetch, decode, execute, and write back. Each stage is responsible for a specific task and the processor can work on different stages simultaneously. This allows for a more efficient use of the processor's resources.

3. What are the advantages of using a pipeline?

The main advantage of using a pipeline is the increased performance of the processor. By breaking down instructions into smaller stages and executing them in parallel, the processor can complete more instructions in a shorter amount of time. This results in faster processing and improved overall efficiency.

4. What are the potential drawbacks of pipelines?

One potential drawback of pipelines is the possibility of a pipeline stall or bubble. This occurs when an instruction in one stage of the pipeline is dependent on the completion of an instruction in a previous stage. This can cause a delay in the execution of subsequent instructions and decrease the overall performance of the pipeline.

5. How are clock cycles related to pipelines?

Clock cycles are used to synchronize the different stages of a pipeline. Each stage of the pipeline is triggered by the processor's clock, which ensures that instructions are processed in the correct order. The number of clock cycles needed to complete a task can also be used as a measure of the performance of a pipeline.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
4K
  • Programming and Computer Science
Replies
25
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
4K
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
4K
  • Other Physics Topics
Replies
5
Views
1K
Replies
11
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
3K
Back
Top