From eb7996ee5a333e6fab4756081ee6e7147e804d88 Mon Sep 17 00:00:00 2001 From: hap Date: Wed, 24 Nov 2021 12:19:39 +0100 Subject: sparc: assume that sparclite waitstate page check is per cs --- src/devices/bus/saitek_osa/sparc.cpp | 2 +- src/devices/cpu/sparc/sparc.cpp | 18 +++++++++--------- src/devices/cpu/sparc/sparc.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/devices/bus/saitek_osa/sparc.cpp b/src/devices/bus/saitek_osa/sparc.cpp index 0517b158686..3564b801be1 100644 --- a/src/devices/bus/saitek_osa/sparc.cpp +++ b/src/devices/bus/saitek_osa/sparc.cpp @@ -16,7 +16,7 @@ The module doesn't have its own LCD screen. It has a grill+fan underneath at the front part, and a heatsink on the CPU. TODO: -- runs too slow? opening book moves take around 3 seconds, but on the real +- runs too slow? opening book moves take around 2.5 seconds, but on the real device less than 1 second ***************************************************************************/ diff --git a/src/devices/cpu/sparc/sparc.cpp b/src/devices/cpu/sparc/sparc.cpp index 6e9ec39e90c..ea301d6a1fe 100644 --- a/src/devices/cpu/sparc/sparc.cpp +++ b/src/devices/cpu/sparc/sparc.cpp @@ -659,8 +659,8 @@ void mb86930_device::device_reset() m_spmr = 0; m_spmr_mask = ~0ULL; std::fill_n(&m_wssr[0], 3, 0); - m_last_masked_addr = 0ULL; + std::fill_n(&m_last_masked_addr[0], 6, 0ULL); std::fill_n(&m_same_page_waits[0], 6, 0); std::fill_n(&m_other_page_waits[0], 6, 0); @@ -819,14 +819,14 @@ uint32_t mb86930_device::mmu_r(offs_t offset, uint32_t mem_mask) { const uint64_t full_addr = ((uint64_t)Asi << 30) | offset; - const uint64_t masked_addr = full_addr & m_spmr_mask; - const bool is_same_page = (masked_addr == m_last_masked_addr); - m_last_masked_addr = masked_addr; - for (int cs = 0; cs < 6; cs++) { if ((full_addr & m_full_masks[cs]) == m_full_ranges[cs]) { + const uint64_t masked_addr = full_addr & m_spmr_mask; + const bool is_same_page = (masked_addr == m_last_masked_addr[cs]); + m_last_masked_addr[cs] = masked_addr; + eat_cycles(is_same_page ? m_same_page_waits[cs] : m_other_page_waits[cs]); return m_cs_r[cs](offset, mem_mask); } @@ -839,14 +839,14 @@ template void mb86930_device::mmu_w(offs_t offset, uint32_t data, { const uint64_t full_addr = ((uint64_t)Asi << 30) | offset; - const uint64_t masked_addr = full_addr & m_spmr_mask; - const bool is_same_page = (masked_addr == m_last_masked_addr); - m_last_masked_addr = masked_addr; - for (int cs = 0; cs < 6; cs++) { if ((full_addr & m_full_masks[cs]) == m_full_ranges[cs]) { + const uint64_t masked_addr = full_addr & m_spmr_mask; + const bool is_same_page = (masked_addr == m_last_masked_addr[cs]); + m_last_masked_addr[cs] = masked_addr; + eat_cycles(is_same_page ? m_same_page_waits[cs] : m_other_page_waits[cs]); m_cs_w[cs](offset, data, mem_mask); return; diff --git a/src/devices/cpu/sparc/sparc.h b/src/devices/cpu/sparc/sparc.h index 8f071a8c72b..a8f01a2452e 100644 --- a/src/devices/cpu/sparc/sparc.h +++ b/src/devices/cpu/sparc/sparc.h @@ -419,7 +419,7 @@ protected: u32 m_amr[6]; u64 m_full_masks[6]; u64 m_full_ranges[6]; - u64 m_last_masked_addr; + u64 m_last_masked_addr[6]; int m_same_page_waits[6]; int m_other_page_waits[6]; -- cgit v1.2.3