Main CPU logic¶
- Look at CPU code.
vi src/learning_gem5/cpu.cc
Fetch event¶
- Calls translate
- (the request) Calls finishFetchTranslate
- (the request) calls decodeInstruction once we get the data.
Decoding¶
- Call decoder.moreBytes
- Try to decode to get the StaticInst
- If you can’t (e.g., x86 is annoying), then you have to get some more data
Next, execute!¶
- Deal with micro-op BS (Stupid x86)
- Create an execution context.
- This is the thing that allows the instruction implementation to effect the CPU state
- If it’s a memory operation, then call initiateAcc (this will translate and setup a memory request)
- Else, do the instruction.
- For memory operations, you have to translate and deal with special memory accesses (IPR). Then send.
- Also get a response, call completeAcc (like execute, but for memory)