1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-18 13:29:41 +00:00

Add invented model for tests.

This commit is contained in:
Thomas Harte 2024-03-10 21:45:56 -04:00
parent 06a5df029d
commit fbc273f114
4 changed files with 16 additions and 5 deletions

View File

@ -278,7 +278,7 @@ struct Executor {
}
// Check for an address exception.
if(address >= (1 << 26)) {
if(is_invalid_address(address)) {
registers_.exception<Registers::Exception::Address>();
return;
}
@ -472,7 +472,7 @@ struct Executor {
};
// Check for an address exception.
address_error = address >= (1 << 26);
address_error = is_invalid_address(address);
// Write out registers 1 to 14.
for(uint32_t c = 0; c < 15; c++) {
@ -578,6 +578,13 @@ struct Executor {
private:
Registers registers_;
static bool is_invalid_address(uint32_t address) {
if constexpr (model == Model::ARMv2with32bitAddressing) {
return false;
}
return address >= 1 << 26;
}
};
/// Executes the instruction @c instruction which should have been fetched from @c executor.pc(),

View File

@ -15,6 +15,10 @@ namespace InstructionSet::ARM {
enum class Model {
ARMv2,
/// Like an ARMv2 but all non-PC addressing is 64-bit. Primarily useful for a particular set of test
/// cases that I want to apply retroactively; not a real iteration.
ARMv2with32bitAddressing,
};
enum class Condition {

View File

@ -740,7 +740,7 @@ class ConcreteMachine:
}
info.append("]");
}
InstructionSet::ARM::execute<arm_model>(instruction, executor_);
InstructionSet::ARM::execute(instruction, executor_);
// if(
//// executor_.pc() > 0x038021d0 &&

View File

@ -334,7 +334,7 @@ struct MemoryLedger {
input >> std::hex;
using Exec = Executor<Model::ARMv2, MemoryLedger>;
using Exec = Executor<Model::ARMv2with32bitAddressing, MemoryLedger>;
std::unique_ptr<Exec> test;
struct FailureRecord {
@ -389,7 +389,7 @@ struct MemoryLedger {
default: break;
}
execute<Model::ARMv2>(instruction, *test);
execute(instruction, *test);
NSMutableString *error = nil;
for(uint32_t c = 0; c < 15; c++) {