massive instruction rewrite

So, I ended up moving exec methods from Instruction to Cpu for
encapsulating cycle emulation, and this has caused me lots of pain since
I had to rewrite a shit ton of tests which are not even useful or
comprehensible, i do no know why i put myself through this

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2024-06-20 06:07:00 +05:30
parent 7d3996526f
commit 1c96f418eb
12 changed files with 775 additions and 486 deletions

View File

@@ -19,11 +19,14 @@ class GdbRsp;
class Cpu {
public:
Cpu(std::shared_ptr<Bus>) noexcept;
Cpu(std::shared_ptr<Bus> bus) noexcept;
void step();
void chg_mode(const Mode to);
void exec(arm::Instruction& instruction);
void exec(thumb::Instruction& instruction);
#ifdef GDB_DEBUG
bool breakpoint_reached() {
if (breakpoints.contains(pc - 2 * (cpsr.state() == State::Arm
@@ -92,10 +95,9 @@ class Cpu {
// raw instructions in the pipeline
std::array<uint32_t, 2> opcodes = {};
void advance_pc_arm() { pc += arm::INSTRUCTION_SIZE; };
void advance_pc_thumb() { pc += thumb::INSTRUCTION_SIZE; }
void advance_pc_arm();
void advance_pc_thumb();
bool is_flushed = false;
void flush_pipeline();
#ifdef GDB_DEBUG

View File

@@ -251,7 +251,7 @@ struct UnconditionalBranch {
struct LongBranchWithLink {
uint16_t offset;
bool high;
bool low;
};
using InstructionData = std::variant<MoveShiftedRegister,