tests: add some exec tests

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2023-09-18 08:05:21 +05:30
parent dd9dd5f116
commit b918b75f27
22 changed files with 1331 additions and 604 deletions

View File

@@ -156,6 +156,10 @@ struct Instruction {
InstructionData data;
Instruction(uint32_t insn);
Instruction(Condition condition, InstructionData data) noexcept
: condition(condition)
, data(data){};
std::string disassemble();
};
}

View File

@@ -0,0 +1,3 @@
headers += files(
'instruction.hh',
)

View File

@@ -1,7 +1,7 @@
#pragma once
#include "arm/instruction.hh"
#include "bus.hh"
#include "instruction.hh"
#include "psr.hh"
#include <cstdint>
@@ -10,7 +10,7 @@ using std::size_t;
class Cpu {
public:
Cpu(Bus& bus);
Cpu(const Bus& bus);
void step();
private:
@@ -30,7 +30,9 @@ class Cpu {
Psr spsr; // status program status register
static constexpr uint8_t PC_INDEX = 15;
uint32_t& pc = gpr[PC_INDEX];
static_assert(PC_INDEX < GPR_COUNT);
uint32_t& pc = gpr[PC_INDEX];
bool is_flushed;

View File

@@ -1,6 +1,7 @@
headers += files(
'cpu.hh',
'instruction.hh',
'psr.hh',
'utility.hh'
)
)
subdir('arm')