tests: add some exec tests
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
		@@ -5,7 +5,7 @@
 | 
			
		||||
 | 
			
		||||
class Bus {
 | 
			
		||||
  public:
 | 
			
		||||
    Bus(Memory& memory);
 | 
			
		||||
    Bus(const Memory& memory);
 | 
			
		||||
 | 
			
		||||
    uint8_t read_byte(size_t address);
 | 
			
		||||
    void write_byte(size_t address, uint8_t byte);
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
};
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										3
									
								
								include/cpu/arm/meson.build
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								include/cpu/arm/meson.build
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
headers += files(
 | 
			
		||||
  'instruction.hh',
 | 
			
		||||
)
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
headers += files(
 | 
			
		||||
  'cpu.hh',
 | 
			
		||||
  'instruction.hh',
 | 
			
		||||
  'psr.hh',
 | 
			
		||||
  'utility.hh'
 | 
			
		||||
)
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
subdir('arm')
 | 
			
		||||
@@ -10,8 +10,7 @@ class Memory {
 | 
			
		||||
  public:
 | 
			
		||||
    static constexpr size_t BIOS_SIZE = 1024 * 16;
 | 
			
		||||
 | 
			
		||||
    Memory(std::array<uint8_t, BIOS_SIZE>&& bios,
 | 
			
		||||
           std::vector<uint8_t>&& rom) noexcept;
 | 
			
		||||
    Memory(std::array<uint8_t, BIOS_SIZE>&& bios, std::vector<uint8_t>&& rom);
 | 
			
		||||
 | 
			
		||||
    uint8_t read(size_t address) const;
 | 
			
		||||
    void write(size_t address, uint8_t byte);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user