From 22513fb6fe281f5ccb75aaddb6417a12a66c313d Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 25 May 2020 16:42:42 +0200 Subject: emumem: A little more speedup. cache and specific change syntax, and are not pointers anymore [O. Galibert] The last(?) two changes are: - Add a template parameter to everything (theoretically the address space width, in practice a level derived from it to keep as much compatibility between widths as possible) so that the shift size becomes a constant. - Change the syntax of declaring and initializing the caches and specifics so that they're embedded in the owner device. Solves lifetime issues and also removes one indirection (looking up the base dispatch pointer through the cache/specific pointer). --- src/devices/cpu/dspp/dspp.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'src/devices/cpu/dspp/dspp.cpp') diff --git a/src/devices/cpu/dspp/dspp.cpp b/src/devices/cpu/dspp/dspp.cpp index 44ced48c56c..d4f889df01a 100644 --- a/src/devices/cpu/dspp/dspp.cpp +++ b/src/devices/cpu/dspp/dspp.cpp @@ -100,8 +100,6 @@ dspp_device::dspp_device(const machine_config &mconfig, device_type type, const m_dma_write_handler(*this), m_code_config("code", ENDIANNESS_BIG, 16, 10, -1, code_map_ctor), m_data_config("data", ENDIANNESS_BIG, 16, 10, -1, data_map_ctor), - m_code(nullptr), - m_data(nullptr), m_output_fifo_start(0), m_output_fifo_count(0), m_dspx_reset(0), @@ -160,12 +158,9 @@ void dspp_device::device_start() m_dma_write_handler.resolve_safe(); // Get our address spaces - m_code = &space(AS_PROGRAM); - m_data = &space(AS_DATA); - auto code_cache = m_code->cache<1, -1, ENDIANNESS_BIG>(); - m_code_cache = code_cache; - m_code16 = [code_cache](offs_t address) -> uint16_t { return code_cache->read_word(address); }; - m_codeptr = [code_cache](offs_t address) -> const void * { return code_cache->read_ptr(address); }; + space(AS_PROGRAM).cache(m_code_cache); + space(AS_PROGRAM).specific(m_code); + space(AS_DATA).specific(m_data); // Register our state for the debugger state_add(DSPP_PC, "PC", m_core->m_pc); @@ -369,7 +364,7 @@ inline void dspp_device::update_ticks() uint16_t dspp_device::read_op(offs_t pc) { - return m_code_cache->read_word(pc); + return m_code_cache.read_word(pc); } @@ -379,7 +374,7 @@ uint16_t dspp_device::read_op(offs_t pc) inline uint16_t dspp_device::read_data(offs_t addr) { - return m_data->read_word(addr); + return m_data.read_word(addr); } @@ -389,7 +384,7 @@ inline uint16_t dspp_device::read_data(offs_t addr) inline void dspp_device::write_data(offs_t addr, uint16_t data) { - m_data->write_word(addr, data); + m_data.write_word(addr, data); } @@ -2344,12 +2339,12 @@ READ32_MEMBER( dspp_device::read ) if (offset < 0x1000/4) { // 16-bit code memory - return m_code->read_word(offset); + return m_code.read_word(offset); } else if (offset >= 0x1000/4 && offset < 0x2000/4) { // 16-bit data memory and registers - return m_data->read_word((offset - 0x1000/4)); + return m_data.read_word((offset - 0x1000/4)); } else if(offset >= 0x5000/4 && offset < 0x6000/4) { @@ -2505,12 +2500,12 @@ WRITE32_MEMBER( dspp_device::write ) if (offset < 0x1000/4) { // 16-bit code memory - m_code->write_word(offset, data); + m_code.write_word(offset, data); } else if (offset >= 0x1000/4 && offset < 0x2000/4) { // 16-bit data memory and registers - m_data->write_word((offset - 0x1000/4), data); + m_data.write_word((offset - 0x1000/4), data); } else if(offset >= 0x5000/4 && offset < 0x6000/4) { -- cgit v1.2.3-70-g09d2