![]() |
Contur 2
Educational OS kernel simulator
|
Concrete CPU implementation. More...
#include <cpu.h>
Public Member Functions | |
| Cpu (IMemory &memory) | |
| Constructs a CPU connected to the given memory. | |
| ~Cpu () override | |
| Destroys CPU. | |
| Cpu (const Cpu &)=delete | |
| Cpu & | operator= (const Cpu &)=delete |
| Cpu (Cpu &&) noexcept | |
| Move-constructs CPU state. | |
| Cpu & | operator= (Cpu &&) noexcept |
| Move-assigns CPU state. | |
| Interrupt | step (RegisterFile ®s) override |
| Performs a single fetch-decode-execute cycle. | |
| void | reset () noexcept override |
| Resets the CPU's internal state (flags, etc.). | |
| RegisterValue | flags () const noexcept |
| Returns the current comparison flags. | |
| Public Member Functions inherited from contur::ICPU | |
| virtual | ~ICPU ()=default |
Private Attributes | |
| std::unique_ptr< Impl > | impl_ |
Additional Inherited Members | |
| Protected Member Functions inherited from contur::ICPU | |
| ICPU ()=default | |
| ICPU (const ICPU &)=default | |
| ICPU & | operator= (const ICPU &)=default |
| ICPU (ICPU &&)=default | |
| ICPU & | operator= (ICPU &&)=default |
Concrete CPU implementation.
The CPU performs the fetch-decode-execute cycle:
Instruction encoding in Block:
|
explicit |
Constructs a CPU connected to the given memory.
| memory | Reference to the memory subsystem (must outlive the CPU). |
Referenced by Cpu(), Cpu(), operator=(), and operator=().
|
override |
Destroys CPU.
|
delete |
References Cpu().
|
noexcept |
Move-constructs CPU state.
References Cpu().
|
nodiscardnoexcept |
|
overridevirtualnoexcept |
Resets the CPU's internal state (flags, etc.).
Implements contur::ICPU.
References reset().
Referenced by reset().
|
nodiscardoverridevirtual |
Performs a single fetch-decode-execute cycle.
Reads the instruction at the address given by the Program Counter in regs, decodes it, executes it (updating regs and possibly memory), and advances the PC.
| regs | The register file for the currently running process. |
Implements contur::ICPU.
References step().
Referenced by step().