This CPU is a 6-staged pipelined, meaning that the all stages execute in parallel if possible. Each stage has one or more responsibilities which are always completed before the next clock cycle, though it is possible for stages to need the same resource at the same time, which causes a blockage and then a rerun.
- Fetch of the next instruction
- Decoding of instruction into microcode
- Read RS1 & RS2 (whether they are used or not)
- ALU input multiplexing
- Register data dependency check
- Branch condition check
- ALU execution
- Memory read & write
- PC write if the branch condition is true
- Writeback input multiplexing
- Write to registers (writeback)
Stage ID | Instruction | Microcode | Input Registers | Immediates | ALU Inputs | Data Dependency Check | Branch Condition Check | ALU Output | Writeback Input |
---|---|---|---|---|---|---|---|---|---|
sf |
❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
si |
✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
s0 |
✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
s1 |
✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ |
s2 |
✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ❌ |
s3 |
✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ | ❌ | ✅ |