mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-22 12:33:29 +00:00
Reads also may or may not be aligned. *sigh*
This commit is contained in:
parent
0b42f5fb30
commit
ccdd340c9a
@ -83,11 +83,15 @@ struct MemoryLedger {
|
|||||||
|
|
||||||
template <typename IntT>
|
template <typename IntT>
|
||||||
bool read(uint32_t address, IntT &source, Mode, bool) {
|
bool read(uint32_t address, IntT &source, Mode, bool) {
|
||||||
if constexpr (std::is_same_v<IntT, uint32_t>) {
|
const auto is_faulty = [&](uint32_t address) -> bool {
|
||||||
address &= static_cast<uint32_t>(~3);
|
return
|
||||||
}
|
read_pointer == reads.size() ||
|
||||||
|
reads[read_pointer].size != sizeof(IntT) ||
|
||||||
|
reads[read_pointer].address != address;
|
||||||
|
};
|
||||||
|
|
||||||
if(read_pointer == reads.size() || reads[read_pointer].size != sizeof(IntT) || reads[read_pointer].address != address) {
|
// As per writes; the test set sometimes forces alignment on the record, sometimes not...
|
||||||
|
if(is_faulty(address) && is_faulty(address & static_cast<uint32_t>(~3))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
source = reads[read_pointer].value;
|
source = reads[read_pointer].value;
|
||||||
|
Loading…
Reference in New Issue
Block a user