summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/mips
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/mips')
-rw-r--r--src/devices/cpu/mips/mips3.cpp15
-rw-r--r--src/devices/cpu/mips/mips3.h3
-rw-r--r--src/devices/cpu/mips/mips3drc.cpp12
-rw-r--r--src/devices/cpu/mips/mips3fe.cpp2
-rw-r--r--src/devices/cpu/mips/r3000.cpp16
-rw-r--r--src/devices/cpu/mips/r3000.h3
6 files changed, 37 insertions, 14 deletions
diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp
index ca8a621dc72..411c6ca5d6f 100644
--- a/src/devices/cpu/mips/mips3.cpp
+++ b/src/devices/cpu/mips/mips3.cpp
@@ -96,7 +96,7 @@ static const uint8_t fpmode_source[4] =
MEMORY ACCESSORS
***************************************************************************/
-#define ROPCODE(pc) direct->read_dword(pc)
+#define ROPCODE(pc) m_lr32(pc)
DEFINE_DEVICE_TYPE(VR4300BE, vr4300be_device, "vr4300be", "NEC VR4300 (big)")
@@ -337,7 +337,18 @@ void mips3_device::device_start()
m_cpu_clock = clock();
m_program = &space(AS_PROGRAM);
- m_direct = m_program->direct<0>();
+ if(m_program->endianness() == ENDIANNESS_LITTLE)
+ {
+ auto cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
+ m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
+ m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); };
+ }
+ else
+ {
+ auto cache = m_program->cache<2, 0, ENDIANNESS_BIG>();
+ m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
+ m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); };
+ }
/* set up the endianness */
m_program->accessors(m_memory);
diff --git a/src/devices/cpu/mips/mips3.h b/src/devices/cpu/mips/mips3.h
index 019920df79e..6c192b5436c 100644
--- a/src/devices/cpu/mips/mips3.h
+++ b/src/devices/cpu/mips/mips3.h
@@ -362,7 +362,8 @@ private:
loadstore_func m_sdr;
address_space *m_program;
- direct_read_data<0> *m_direct;
+ std::function<u32 (offs_t)> m_pr32;
+ std::function<const void * (offs_t)> m_prptr;
uint32_t c_system_clock;
uint32_t m_cpu_clock;
emu_timer * m_compare_int_timer;
diff --git a/src/devices/cpu/mips/mips3drc.cpp b/src/devices/cpu/mips/mips3drc.cpp
index a226fcbcbc7..3be62994a27 100644
--- a/src/devices/cpu/mips/mips3drc.cpp
+++ b/src/devices/cpu/mips/mips3drc.cpp
@@ -1075,14 +1075,14 @@ void mips3_device::generate_checksum_block(drcuml_block &block, compiler_state &
if (!(seqhead->flags & OPFLAG_VIRTUAL_NOOP))
{
uint32_t sum = seqhead->opptr.l[0];
- void *base = m_direct->read_ptr(seqhead->physpc);
+ const void *base = m_prptr(seqhead->physpc);
UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,0,dword
if (seqhead->delay.first() != nullptr
&& !(seqhead->delay.first()->flags & OPFLAG_VIRTUAL_NOOP)
&& seqhead->physpc != seqhead->delay.first()->physpc)
{
- base = m_direct->read_ptr(seqhead->delay.first()->physpc);
+ base = m_prptr(seqhead->delay.first()->physpc);
assert(base != nullptr);
UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword
UML_ADD(block, I0, I0, I1); // add i0,i0,i1
@@ -1102,20 +1102,20 @@ void mips3_device::generate_checksum_block(drcuml_block &block, compiler_state &
for (curdesc = seqhead->next(); curdesc != seqlast->next(); curdesc = curdesc->next())
if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
{
- void *base = m_direct->read_ptr(seqhead->physpc);
+ const void *base = m_prptr(seqhead->physpc);
UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,0,dword
UML_CMP(block, I0, curdesc->opptr.l[0]); // cmp i0,opptr[0]
UML_EXHc(block, COND_NE, *m_nocode, epc(seqhead)); // exne nocode,seqhead->pc
}
#else
uint32_t sum = 0;
- void *base = m_direct->read_ptr(seqhead->physpc);
+ const void *base = m_prptr(seqhead->physpc);
UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,0,dword
sum += seqhead->opptr.l[0];
for (curdesc = seqhead->next(); curdesc != seqlast->next(); curdesc = curdesc->next())
if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
{
- base = m_direct->read_ptr(curdesc->physpc);
+ base = m_prptr(curdesc->physpc);
assert(base != nullptr);
UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword
UML_ADD(block, I0, I0, I1); // add i0,i0,i1
@@ -1125,7 +1125,7 @@ void mips3_device::generate_checksum_block(drcuml_block &block, compiler_state &
&& !(curdesc->delay.first()->flags & OPFLAG_VIRTUAL_NOOP)
&& (curdesc == seqlast || (curdesc->next() != nullptr && curdesc->next()->physpc != curdesc->delay.first()->physpc)))
{
- base = m_direct->read_ptr(curdesc->delay.first()->physpc);
+ base = m_prptr(curdesc->delay.first()->physpc);
assert(base != nullptr);
UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword
UML_ADD(block, I0, I0, I1); // add i0,i0,i1
diff --git a/src/devices/cpu/mips/mips3fe.cpp b/src/devices/cpu/mips/mips3fe.cpp
index a530d026c75..bfaf0c682d2 100644
--- a/src/devices/cpu/mips/mips3fe.cpp
+++ b/src/devices/cpu/mips/mips3fe.cpp
@@ -49,7 +49,7 @@ bool mips3_frontend::describe(opcode_desc &desc, const opcode_desc *prev)
// fetch the opcode
assert((desc.physpc & 3) == 0);
- op = desc.opptr.l[0] = m_mips3->m_direct->read_dword(desc.physpc);
+ op = desc.opptr.l[0] = m_mips3->m_pr32(desc.physpc);
// all instructions are 4 bytes and default to a single cycle each
desc.length = 4;
diff --git a/src/devices/cpu/mips/r3000.cpp b/src/devices/cpu/mips/r3000.cpp
index 60ddfc1b594..1cf74b4bff4 100644
--- a/src/devices/cpu/mips/r3000.cpp
+++ b/src/devices/cpu/mips/r3000.cpp
@@ -130,7 +130,6 @@ r3000_device::r3000_device(const machine_config &mconfig, device_type type, cons
m_program_config_be("program", ENDIANNESS_BIG, 32, 29),
m_program_config_le("program", ENDIANNESS_LITTLE, 32, 29),
m_program(nullptr),
- m_direct(nullptr),
m_chip_type(chiptype),
m_hasfpu(false),
m_endianness(ENDIANNESS_BIG),
@@ -214,7 +213,18 @@ void r3000_device::device_start()
{
// get our address spaces
m_program = &space(AS_PROGRAM);
- m_direct = m_program->direct<0>();
+ if(m_program->endianness() == ENDIANNESS_LITTLE)
+ {
+ auto cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
+ m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
+ m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); };
+ }
+ else
+ {
+ auto cache = m_program->cache<2, 0, ENDIANNESS_BIG>();
+ m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
+ m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); };
+ }
// determine the cache sizes
switch (m_chip_type)
@@ -470,7 +480,7 @@ std::unique_ptr<util::disasm_interface> r3000_device::create_disassembler()
inline uint32_t r3000_device::readop(offs_t pc)
{
- return m_direct->read_dword(pc);
+ return m_pr32(pc);
}
uint8_t r3000_device::readmem(offs_t offset)
diff --git a/src/devices/cpu/mips/r3000.h b/src/devices/cpu/mips/r3000.h
index 86ecec13a5b..0abea62316d 100644
--- a/src/devices/cpu/mips/r3000.h
+++ b/src/devices/cpu/mips/r3000.h
@@ -194,7 +194,8 @@ protected:
const address_space_config m_program_config_be;
const address_space_config m_program_config_le;
address_space *m_program;
- direct_read_data<0> *m_direct;
+ std::function<u32 (offs_t)> m_pr32;
+ std::function<const void * (offs_t)> m_prptr;
// configuration
chip_type m_chip_type;