diff options
Diffstat (limited to 'src/devices/cpu/unsp')
-rw-r--r-- | src/devices/cpu/unsp/unsp.cpp | 13 | ||||
-rw-r--r-- | src/devices/cpu/unsp/unsp.h | 11 | ||||
-rw-r--r-- | src/devices/cpu/unsp/unspdrc.cpp | 12 | ||||
-rw-r--r-- | src/devices/cpu/unsp/unspfe.cpp | 2 |
4 files changed, 17 insertions, 21 deletions
diff --git a/src/devices/cpu/unsp/unsp.cpp b/src/devices/cpu/unsp/unsp.cpp index 40adc713f01..ea416cbe05c 100644 --- a/src/devices/cpu/unsp/unsp.cpp +++ b/src/devices/cpu/unsp/unsp.cpp @@ -41,12 +41,11 @@ unsp_device::unsp_device(const machine_config &mconfig, device_type type, const : cpu_device(mconfig, type, tag, owner, clock) , m_core(nullptr) , m_program_config("program", ENDIANNESS_BIG, 16, 23, -1, internal) - , m_program(nullptr) , m_debugger_temp(0) #if UNSP_LOG_OPCODES || UNSP_LOG_REGS , m_log_ops(0) #endif - , m_cache(CACHE_SIZE + sizeof(unsp_device)) + , m_drccache(CACHE_SIZE + sizeof(unsp_device)) , m_drcuml(nullptr) , m_drcfe(nullptr) , m_drcoptions(0) @@ -193,7 +192,7 @@ void unsp_device::unimplemented_opcode(uint16_t op, uint16_t ximm, uint16_t ximm void unsp_device::device_start() { - m_core = (internal_unsp_state *)m_cache.alloc_near(sizeof(internal_unsp_state)); + m_core = (internal_unsp_state *)m_drccache.alloc_near(sizeof(internal_unsp_state)); memset(m_core, 0, sizeof(internal_unsp_state)); #if ENABLE_UNSP_DRC @@ -211,13 +210,11 @@ void unsp_device::device_start() m_debugger_temp = 0; - m_program = &space(AS_PROGRAM); - auto cache = m_program->cache<1, -1, ENDIANNESS_BIG>(); - m_pr16 = [cache](offs_t address) -> u16 { return cache->read_word(address); }; - m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); }; + space(AS_PROGRAM).cache(m_cache); + space(AS_PROGRAM).specific(m_program); uint32_t umlflags = 0; - m_drcuml = std::make_unique<drcuml_state>(*this, m_cache, umlflags, 1, 23, 0); + m_drcuml = std::make_unique<drcuml_state>(*this, m_drccache, umlflags, 1, 23, 0); // add UML symbols- m_drcuml->symbol_add(&m_core->m_r[REG_SP], sizeof(uint32_t), "SP"); diff --git a/src/devices/cpu/unsp/unsp.h b/src/devices/cpu/unsp/unsp.h index b5f77d239db..c55daf885c7 100644 --- a/src/devices/cpu/unsp/unsp.h +++ b/src/devices/cpu/unsp/unsp.h @@ -209,14 +209,14 @@ protected: internal_unsp_state* m_core; protected: - uint16_t read16(uint32_t address) { return m_program->read_word(address); } + uint16_t read16(uint32_t address) { return m_program.read_word(address); } void write16(uint32_t address, uint16_t data) { #if UNSP_LOG_REGS log_write(address, data); #endif - m_program->write_word(address, data); + m_program.write_word(address, data); } void add_lpc(const int32_t offset) @@ -287,9 +287,8 @@ private: address_space_config m_program_config; - address_space *m_program; - std::function<u16 (offs_t)> m_pr16; - std::function<const void * (offs_t)> m_prptr; + memory_access<23, 2, -1, ENDIANNESS_BIG>::cache m_cache; + memory_access<23, 2, -1, ENDIANNESS_BIG>::specific m_program; uint32_t m_debugger_temp; #if UNSP_LOG_OPCODES || UNSP_LOG_REGS @@ -300,7 +299,7 @@ private: inline void trigger_irq(int line); void check_irqs(); - drc_cache m_cache; + drc_cache m_drccache; std::unique_ptr<drcuml_state> m_drcuml; std::unique_ptr<unsp_frontend> m_drcfe; uint32_t m_drcoptions; diff --git a/src/devices/cpu/unsp/unspdrc.cpp b/src/devices/cpu/unsp/unspdrc.cpp index 32011522c2e..8db11bc19e1 100644 --- a/src/devices/cpu/unsp/unspdrc.cpp +++ b/src/devices/cpu/unsp/unspdrc.cpp @@ -204,7 +204,7 @@ void unsp_device::code_compile_block(offs_t pc) } /* validate this code block if we're not pointing into ROM */ - if (m_program->get_write_ptr(seqhead->physpc) != nullptr) + if (m_program.space().get_write_ptr(seqhead->physpc) != nullptr) generate_checksum_block(block, compiler, seqhead, seqlast); /* label this instruction, if it may be jumped to locally */ @@ -526,7 +526,7 @@ void unsp_device::generate_checksum_block(drcuml_block &block, compiler_state &c } /* full verification; sum up everything */ - void *memptr = m_program->get_write_ptr(seqhead->physpc); + void *memptr = m_program.space().get_write_ptr(seqhead->physpc); UML_LOAD(block, I0, memptr, 0, SIZE_WORD, SCALE_x2); uint32_t sum = seqhead->opptr.w[0]; for (int i = 1; i < seqhead->length; i++) @@ -539,7 +539,7 @@ void unsp_device::generate_checksum_block(drcuml_block &block, compiler_state &c { if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP)) { - memptr = m_program->get_write_ptr(curdesc->physpc); + memptr = m_program.space().get_write_ptr(curdesc->physpc); UML_LOAD(block, I1, memptr, 0, SIZE_WORD, SCALE_x2); UML_ADD(block, I0, I0, I1); sum += curdesc->opptr.w[0]; @@ -1158,7 +1158,7 @@ bool unsp_device::generate_opcode(drcuml_block &block, compiler_state &compiler, case 0x01: // imm16 { UML_MOV(block, I2, mem(&m_core->m_r[opb])); - const uint16_t r1 = m_pr16(desc->pc + 1); + const uint16_t r1 = m_cache.read_word(desc->pc + 1); generate_add_lpc(block, 1); UML_MOV(block, I1, r1); break; @@ -1167,7 +1167,7 @@ bool unsp_device::generate_opcode(drcuml_block &block, compiler_state &compiler, case 0x02: // [imm16] { UML_MOV(block, I2, mem(&m_core->m_r[opb])); - const uint16_t r1 = m_pr16(desc->pc + 1); + const uint16_t r1 = m_cache.read_word(desc->pc + 1); generate_add_lpc(block, 1); UML_MOV(block, I0, r1); if (op0 != 0x0d) @@ -1179,7 +1179,7 @@ bool unsp_device::generate_opcode(drcuml_block &block, compiler_state &compiler, { UML_MOV(block, I1, I2); UML_MOV(block, I2, mem(&m_core->m_r[opb])); - const uint16_t r2 = m_pr16(desc->pc + 1); + const uint16_t r2 = m_cache.read_word(desc->pc + 1); generate_add_lpc(block, 1); UML_MOV(block, I0, r2); break; diff --git a/src/devices/cpu/unsp/unspfe.cpp b/src/devices/cpu/unsp/unspfe.cpp index 5da9b6febdc..f93423379a1 100644 --- a/src/devices/cpu/unsp/unspfe.cpp +++ b/src/devices/cpu/unsp/unspfe.cpp @@ -24,7 +24,7 @@ unsp_frontend::unsp_frontend(unsp_device *unsp, uint32_t window_start, uint32_t inline uint16_t unsp_frontend::read_op_word(opcode_desc &desc, int offset) { - return m_cpu->m_pr16(desc.physpc + offset); + return m_cpu->m_cache.read_word(desc.physpc + offset); } /*------------------------------------------------- |