1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-02 02:49:28 +00:00

Improves resizeable microcycle test.

This commit is contained in:
Thomas Harte 2019-06-24 10:55:22 -04:00
parent d27ba90c07
commit faef917cbd
5 changed files with 9 additions and 15 deletions

View File

@ -1189,7 +1189,7 @@ class CPU::MC68000::ProcessorStorageTests {
const auto state = _machine->get_processor_state(); const auto state = _machine->get_processor_state();
XCTAssertEqual(state.data[1], 1); XCTAssertEqual(state.data[1], 1);
XCTAssertEqual(state.status & Flag::ConditionCodes, Flag::Extend); XCTAssertEqual(state.status & Flag::ConditionCodes, Flag::Extend);
// XCTAssertEqual(158, _machine->get_cycle_count()); XCTAssertEqual(158, _machine->get_cycle_count());
} }
- (void)testDIVS_4 { - (void)testDIVS_4 {

View File

@ -189,6 +189,10 @@ struct Microcycle {
uint32_t word_address() const { uint32_t word_address() const {
return (address ? (*address) & 0x00fffffe : 0) >> 1; return (address ? (*address) & 0x00fffffe : 0) >> 1;
} }
#ifndef NDEBUG
bool is_resizeable = false;
#endif
}; };
/*! /*!

View File

@ -52,7 +52,7 @@
// Sets the length of the next microcycle; if this is a debug build, also confirms // Sets the length of the next microcycle; if this is a debug build, also confirms
// that the microcycle being adjusted is the one that it's permissible to adjust. // that the microcycle being adjusted is the one that it's permissible to adjust.
#define set_next_microcycle_length(x) \ #define set_next_microcycle_length(x) \
assert(resizeable_microcycle_ == &bus_program->microcycle); \ assert(bus_program->microcycle.is_resizeable); \
bus_program->microcycle.length = x bus_program->microcycle.length = x
template <class T, bool dtack_is_implicit, bool signal_will_perform> void Processor<T, dtack_is_implicit, signal_will_perform>::run_for(HalfCycles duration) { template <class T, bool dtack_is_implicit, bool signal_will_perform> void Processor<T, dtack_is_implicit, signal_will_perform>::run_for(HalfCycles duration) {
@ -948,7 +948,7 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
bus_program = active_micro_op_->bus_program; \ bus_program = active_micro_op_->bus_program; \
\ \
populate_trap_steps(5, get_status()); \ populate_trap_steps(5, get_status()); \
set_next_microcycle_length(HalfCycles(8)); \ bus_program->microcycle.length = HalfCycles(8); \
\ \
program_counter_.full -= 2; program_counter_.full -= 2;

View File

@ -3048,13 +3048,8 @@ struct ProcessorStorageConstructor {
// If this is a debug build, not where the resizeable microcycle is // If this is a debug build, not where the resizeable microcycle is
// (and double check that there's only the one). // (and double check that there's only the one).
#ifndef NDEBUG #ifndef NDEBUG
for(size_t c = 0; c < storage_.all_bus_steps_.size() - 1; ++c) { for(auto &bus_step: storage_.all_bus_steps_) {
if(!storage_.all_bus_steps_[c+1].is_terminal()) continue; bus_step.microcycle.is_resizeable = bus_step.microcycle.length == HalfCycles(0);
if(storage_.all_bus_steps_[c].microcycle.length == HalfCycles(0)) {
assert(!storage_.resizeable_microcycle_);
storage_.resizeable_microcycle_ = &storage_.all_bus_steps_[c].microcycle;
}
} }
#endif #endif

View File

@ -411,11 +411,6 @@ class ProcessorStorage {
RegisterPair16 throwaway_value_; RegisterPair16 throwaway_value_;
uint32_t movem_final_address_; uint32_t movem_final_address_;
// Sanity checking for the debug build.
#ifndef NDEBUG
const Microcycle *resizeable_microcycle_ = nullptr;
#endif
/*! /*!
Evaluates the conditional described by @c code and returns @c true or @c false to Evaluates the conditional described by @c code and returns @c true or @c false to
indicate the result of that evaluation. indicate the result of that evaluation.