contur2
Loading...
Searching...
No Matches
cpu.h
Go to the documentation of this file.
1
7
8#pragma once
9
10#include <memory>
11
12#include "contur/cpu/i_cpu.h"
14
15namespace contur {
16
29 class Cpu final : public ICPU
30 {
31 public:
34 explicit Cpu(IMemory &memory);
35
36 ~Cpu() override;
37
38 // Non-copyable, movable
39 Cpu(const Cpu &) = delete;
40 Cpu &operator=(const Cpu &) = delete;
41 Cpu(Cpu &&) noexcept;
42 Cpu &operator=(Cpu &&) noexcept;
43
45 [[nodiscard]] Interrupt step(RegisterFile &regs) override;
46
48 void reset() noexcept override;
49
55 [[nodiscard]] RegisterValue flags() const noexcept;
56
57 private:
58 struct Impl;
59 std::unique_ptr<Impl> impl_;
60 };
61
62} // namespace contur
Cpu(const Cpu &)=delete
void reset() noexcept override
Resets the CPU's internal state (flags, etc.).
Cpu(Cpu &&) noexcept
~Cpu() override
RegisterValue flags() const noexcept
Returns the current comparison flags.
Cpu & operator=(const Cpu &)=delete
std::unique_ptr< Impl > impl_
Definition cpu.h:59
Interrupt step(RegisterFile &regs) override
Performs a single fetch-decode-execute cycle.
Cpu(IMemory &memory)
Constructs a CPU connected to the given memory.
ICPU()=default
Abstract interface for linear addressable memory.
Definition i_memory.h:19
The CPU's register bank — holds REGISTER_COUNT (16) registers.
ICPU — abstract interface for the CPU simulation.
IMemory interface — abstract linear addressable memory.
Definition block.h:15
Interrupt
Interrupt codes used by the CPU and kernel.
Definition interrupt.h:17
std::int32_t RegisterValue
Value stored in a CPU register.
Definition types.h:21