1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-21 21:33:54 +00:00

Provide further context.

This commit is contained in:
Thomas Harte 2022-08-06 14:40:12 -04:00
parent e897cd99f9
commit 3781b5eb0e
2 changed files with 21 additions and 4 deletions

View File

@ -11,6 +11,7 @@
#include <cstddef>
#include <cstdint>
#include <string>
#include <vector>
#include "../../ClockReceiver/ClockReceiver.hpp"
@ -201,7 +202,7 @@ template <bool record_bus = false> class Blitter: public DMADevice<4, 4> {
ReadC,
AddToPipeline,
WriteFromPipeline
} type;
} type = Type::SkippedSlot;
uint32_t address = 0;
uint16_t value = 0;
@ -209,6 +210,22 @@ template <bool record_bus = false> class Blitter: public DMADevice<4, 4> {
Transaction() {}
Transaction(Type type) : type(type) {}
Transaction(Type type, uint32_t address, uint16_t value) : type(type), address(address), value(value) {}
std::string to_string() const {
std::string result;
switch(type) {
case Type::SkippedSlot: result = "SkippedSlot"; break;
case Type::ReadA: result = "ReadA"; break;
case Type::ReadB: result = "ReadB"; break;
case Type::ReadC: result = "ReadC"; break;
case Type::AddToPipeline: result = "AddToPipeline"; break;
case Type::WriteFromPipeline: result = "WriteFromPipeline"; break;
}
result += " address:" + std::to_string(address) + " value:" + std::to_string(value);
return result;
}
};
std::vector<Transaction> get_and_reset_transactions();

View File

@ -181,9 +181,9 @@ struct Chipset {
default: break;
}
XCTAssertEqual(transaction.type, expected_transaction.type, @"Type mismatch at index %lu", (unsigned long)index);
XCTAssertEqual(transaction.value, expected_transaction.value, @"Value mismatch at index %lu", (unsigned long)index);
XCTAssertEqual(transaction.address, expected_transaction.address, @"Address mismatch at index %lu", (unsigned long)index);
XCTAssertEqual(transaction.type, expected_transaction.type, @"Type mismatch at index %lu: %s expected vs %s found", (unsigned long)index, expected_transaction.to_string().c_str(), transaction.to_string().c_str());
XCTAssertEqual(transaction.value, expected_transaction.value, @"Value mismatch at index %lu: %s expected vs %s found", (unsigned long)index, expected_transaction.to_string().c_str(), transaction.to_string().c_str());
XCTAssertEqual(transaction.address, expected_transaction.address, @"Address mismatch at index %lu: %s expected vs %s found", (unsigned long)index, expected_transaction.to_string().c_str(), transaction.to_string().c_str());
if(
transaction.type != expected_transaction.type ||
transaction.value != expected_transaction.value ||