1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-25 18:30:07 +00:00

Start hacking in some ARM tests.

This commit is contained in:
Thomas Harte 2024-03-08 22:54:42 -05:00
parent fdef8901ab
commit 47f7340dfc
4 changed files with 84 additions and 6 deletions

View File

@ -19,6 +19,7 @@
#include <algorithm>
#include <array>
#include <set>
#include <vector>
namespace {
@ -686,6 +687,8 @@ class ConcreteMachine:
return Outputs::Display::ScanStatus();
}
std::set<uint32_t> all;
// MARK: - TimedMachine.
void run_for(Cycles cycles) override {
static uint32_t last_pc = 0;
@ -714,23 +717,25 @@ class ConcreteMachine:
}
// TODO: pipeline prefetch?
static bool log = true;
static bool log = false;
// if(executor_.pc() == 0x0380096c) {
all.insert(instruction);
// if(executor_.pc() == 0x03801404) {
// printf("");
// }
// log |= (executor_.pc() > 0 && executor_.pc() < 0x03800000);
log |= executor_.pc() == 0x38008e0;
// log |= executor_.pc() == 0x38008e0;
// log |= (executor_.pc() > 0x03801000);
// log &= (executor_.pc() != 0x038019f8);
if(executor_.pc() == 0x38008e0) //0x038019f8)
return;
// if(executor_.pc() == 0x38008e0) //0x038019f8)
// return;
if(log) {
auto info = logger.info();
info.append("%08x: %08x prior:[", executor_.pc(), instruction);
for(size_t c = 0; c < 15; c++) {
for(uint32_t c = 0; c < 15; c++) {
info.append("r%d:%08x ", c, executor_.registers()[c]);
}
info.append("]");

View File

@ -968,6 +968,7 @@
4BB505832B962DDF0031C43C /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB505762B962DDF0031C43C /* Keyboard.cpp */; };
4BB505862B9634F30031C43C /* Archimedes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB505842B9634F30031C43C /* Archimedes.cpp */; };
4BB505872B9634F30031C43C /* Archimedes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB505842B9634F30031C43C /* Archimedes.cpp */; };
4BB505892B9C0E6F0031C43C /* Messy ARM in Resources */ = {isa = PBXBuildFile; fileRef = 4BB505882B9C0E6F0031C43C /* Messy ARM */; };
4BB697CB1D4B6D3E00248BDF /* TimedEventLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB697C91D4B6D3E00248BDF /* TimedEventLoop.cpp */; };
4BB697CE1D4BA44400248BDF /* CommodoreGCR.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB697CC1D4BA44400248BDF /* CommodoreGCR.cpp */; };
4BB73EA21B587A5100552FC2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB73EA11B587A5100552FC2 /* AppDelegate.swift */; };
@ -2106,6 +2107,7 @@
4BB505772B962DDF0031C43C /* Electron.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Electron.hpp; sourceTree = "<group>"; };
4BB505842B9634F30031C43C /* Archimedes.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Archimedes.cpp; sourceTree = "<group>"; };
4BB505852B9634F30031C43C /* Archimedes.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Archimedes.hpp; sourceTree = "<group>"; };
4BB505882B9C0E6F0031C43C /* Messy ARM */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "Messy ARM"; sourceTree = "<group>"; };
4BB5B995281B1D3E00522DA9 /* RegisterSizes.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = RegisterSizes.hpp; sourceTree = "<group>"; };
4BB5B996281B1E3F00522DA9 /* Perform.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Perform.hpp; sourceTree = "<group>"; };
4BB5B997281B1F7B00522DA9 /* Status.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Status.hpp; sourceTree = "<group>"; };
@ -2683,6 +2685,7 @@
4B1414631B588A1100E04248 /* Test Binaries */ = {
isa = PBXGroup;
children = (
4BB505882B9C0E6F0031C43C /* Messy ARM */,
4B680CE323A555CA00451D43 /* 68000 Comparative Tests */,
4B75F97A280D7C7700121055 /* 68000 Decoding */,
4B683B002727BE6F0043E541 /* Amiga Blitter Tests */,
@ -5572,6 +5575,7 @@
4BB299B51B587D8400A49093 /* rolzx in Resources */,
4BB299DD1B587D8400A49093 /* stxa in Resources */,
4BB299051B587D8400A49093 /* arrb in Resources */,
4BB505892B9C0E6F0031C43C /* Messy ARM in Resources */,
4BB299DC1B587D8400A49093 /* stazx in Resources */,
4B670A9D2401CB8400D4E002 /* z80ccf.tap in Resources */,
4B4F47652533EA64004245B8 /* suite-a.prg in Resources */,

View File

@ -10,6 +10,9 @@
#include "../../../InstructionSets/ARM/Executor.hpp"
#include "CSROMFetcher.hpp"
#include "NSData+dataWithContentsOfGZippedFile.h"
#include <sstream>
using namespace InstructionSet::ARM;
@ -277,6 +280,72 @@ struct Memory {
}
}
- (void)testMessy {
NSData *const tests =
[NSData dataWithContentsOfGZippedFile:
[[NSBundle bundleForClass:[self class]]
pathForResource:@"test"
ofType:@"txt.gz"
inDirectory:@"Messy ARM"]
];
const std::string text((char *)tests.bytes);
std::istringstream input(text);
input >> std::hex;
uint32_t instruction;
while(!input.eof()) {
std::string label;
input >> label;
if(label == "**") {
input >> instruction;
continue;
}
if(label == "Before:" || label == "After:") {
// Read register state.
uint32_t regs[17];
for(int c = 0; c < 17; c++) {
input >> regs[c];
}
if(label == "Before:") {
// This is the start of a new test.
} else {
// Execute test and compare.
}
continue;
}
uint32_t address;
uint32_t value;
input >> address >> value;
if(label == "r.b") {
// Capture a byte read for provision.
continue;
}
if(label == "r.w") {
// Capture a word read for provision.
continue;
}
if(label == "w.b") {
// Capture a byte write for comparison.
continue;
}
if(label == "w.w") {
// Capture a word write for comparison.
continue;
}
}
XCTAssertNotNil(tests);
}
// TODO: turn the below into a trace-driven test case.
- (void)testROM319 {
constexpr ROM::Name rom_name = ROM::Name::AcornRISCOS319;

Binary file not shown.