I am developing a pipeline.
This pipeline has parallel flows of execution.
What i need to know is, how to branch the pipeline and later how to fold it back ?
(this question has nothing to do with the instruction branch and return).
Prev. Unit -> Stage0 ----> Stage1 -+-> Stage2 -> Stage3 -> Stage7 -> Next unit
^ |
| +-> Stage4 -> Stage5 -> Stage6 -+
| |
+------------------------------------+
This is what i want to know, how to branch (Ie. have more than one possible next stage) and then fold back (have a unit that might take data from two different stages).
If data+opcode goes thru Stage4, Stage5 and Stage6 Stage0 must stop sending data (this part of the pipeline should stall) because Stage4 means a cache miss (stage1 is the CAM memory that will tell if the page is on the cache or not), if the data is on the cache, stage2 takes it and Stage3 operates on it. Else, Stage4, Stage5, Stage6 (arbitrary size) will evict one page and load the correct page into the unit cache.
So i need to be able to "branch" the pipeline based on if the page is on the cache or not. But, if the page is not on the cache, proabably everything else will cachemiss too, so i need to stall the pipeline (but not everything else i would not be able to handle the cache miss).
The problem is my pipeline stages are made out of D flip-flops that forward a word each clock cycle. If i dont prevent the clock from cycling, data will simply drop.
Is there a standard way to implement flow control for branches in the pipeline ?