# Scheduler overview
## Description
The scheduler is the middle part of our processor.
It is located after the frontend and before execution units.
Its main tasks are:
- register allocation
- renaming
- ROB entry allocation
- dispatching instructions to RSs
## Schema
```{mermaid}
graph
Reg;
Reg[REGISTER ALLOCATION
-get free register from FREE RF list]
Reg --> Rename;
Rename[RENAMING
-rename source registers using F-RAT
-save mapping to allocated output register in F-RAT]
Rename --> AlocRob;
AlocRob[ROB ALLOCATION
-get ID of free entry in ROB
-save instruction in ROB entry]
AlocRob --> Select;
Select[RS SELECTION
-choose RS to which instruction should be send
-reserve entry in that RS]
Select --> Insert;
Insert[RS INSERTION
-insert instruction to selected RS
-get operands from RF
-save them in RS field of new instruction]
```
## Structure
We decided to split the scheduler into 5 phases:
- register allocation
- renaming
- ROB entry allocation
- choosing the RS to which instruction should be dispatched
- inserting instruction to RS
Each phase can potentially take one clock cycle, but they can be merged as a potential future optimization.
During implementation each phase should be treated as a separate hardware block for future flexibility.
## More detailed description of each block
TODO