From e2b698429fed9c16fb42bd554e712ca9079c94f6 Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 7 Apr 2020 21:54:29 +0200 Subject: [PATCH] pla: allow reparsing after device started (nw) --- src/devices/machine/pla.cpp | 21 +++++++++++++++------ src/devices/machine/pla.h | 3 ++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/devices/machine/pla.cpp b/src/devices/machine/pla.cpp index 44db6a4ed10..7ad690b11cd 100644 --- a/src/devices/machine/pla.cpp +++ b/src/devices/machine/pla.cpp @@ -72,21 +72,29 @@ void pla_device::device_start() m_input_mask = ((uint64_t)1 << m_inputs) - 1; m_input_mask = ((uint64_t)m_input_mask << 32) | m_input_mask; - // parse fusemap - parse_fusemap(); + m_cache_size = 1 << ((m_inputs > MAX_CACHE_BITS) ? MAX_CACHE_BITS : m_inputs); + m_cache.resize(m_cache_size); + + reinit(); +} + +bool pla_device::reinit() +{ + int result = parse_fusemap(); // initialize cache m_cache2_ptr = 0; for (auto & elem : m_cache2) elem = 0x80000000; + int csize = m_cache_size; m_cache_size = 0; - int csize = 1 << ((m_inputs > MAX_CACHE_BITS) ? MAX_CACHE_BITS : m_inputs); - m_cache.resize(csize); for (int i = 0; i < csize; i++) m_cache[i] = read(i); m_cache_size = csize; + + return result == JEDERR_NONE; } @@ -94,7 +102,7 @@ void pla_device::device_start() // parse_fusemap - //------------------------------------------------- -void pla_device::parse_fusemap() +int pla_device::parse_fusemap() { jed_data jed; int result = JEDERR_NONE; @@ -120,7 +128,7 @@ void pla_device::parse_fusemap() } logerror("%s PLA parse error %d!\n", tag(), result); - return; + return result; } // parse it @@ -174,6 +182,7 @@ void pla_device::parse_fusemap() m_xor <<= 32; LOGMASKED(LOG_TERMS, "F ^= %0*X\n", (m_outputs + 3) / 4, m_xor >> 32); + return result; } diff --git a/src/devices/machine/pla.h b/src/devices/machine/pla.h index b614a968b36..548ab4bf16b 100644 --- a/src/devices/machine/pla.h +++ b/src/devices/machine/pla.h @@ -69,6 +69,7 @@ public: uint32_t outputs() { return m_outputs; } uint32_t read(uint32_t input); + bool reinit(); protected: // device-level overrides @@ -79,7 +80,7 @@ private: static constexpr unsigned MAX_CACHE_BITS = 20; static constexpr unsigned CACHE2_SIZE = 8; - void parse_fusemap(); + int parse_fusemap(); required_memory_region m_region;