summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/dsp56156
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2020-05-25 16:42:42 +0200
committer Olivier Galibert <galibert@pobox.com>2020-05-25 16:42:57 +0200
commit22513fb6fe281f5ccb75aaddb6417a12a66c313d (patch)
tree3cf84032cc6482d685a8dbb57e015bd17c7f7fdc /src/devices/cpu/dsp56156
parente42c2d2874cf9c1092c01ab5ce9ef997d465ce25 (diff)
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).
Diffstat (limited to 'src/devices/cpu/dsp56156')
-rw-r--r--src/devices/cpu/dsp56156/dsp56156.cpp10
-rw-r--r--src/devices/cpu/dsp56156/dsp56156.h6
-rw-r--r--src/devices/cpu/dsp56156/dsp56ops.hxx46
-rw-r--r--src/devices/cpu/dsp56156/dsp56pcu.cpp6
4 files changed, 34 insertions, 34 deletions
diff --git a/src/devices/cpu/dsp56156/dsp56156.cpp b/src/devices/cpu/dsp56156/dsp56156.cpp
index b6c5b4fd672..04952c0f7d3 100644
--- a/src/devices/cpu/dsp56156/dsp56156.cpp
+++ b/src/devices/cpu/dsp56156/dsp56156.cpp
@@ -141,7 +141,7 @@ device_memory_interface::space_config_vector dsp56156_device::memory_space_confi
/***************************************************************************
MEMORY ACCESSORS
***************************************************************************/
-#define ROPCODE(pc) cpustate->cache->read_word(pc)
+#define ROPCODE(pc) cpustate->cache.read_word(pc)
/***************************************************************************
@@ -291,9 +291,9 @@ void dsp56156_device::device_start()
save_item(NAME(m_core.peripheral_ram));
- m_core.program = &space(AS_PROGRAM);
- m_core.cache = m_core.program->cache<1, -1, ENDIANNESS_LITTLE>();
- m_core.data = &space(AS_DATA);
+ space(AS_PROGRAM).cache(m_core.cache);
+ space(AS_PROGRAM).specific(m_core.program);
+ space(AS_DATA).specific(m_core.data);
state_add(DSP56156_PC, "PC", m_core.PCU.pc).formatstr("%04X");
state_add(DSP56156_SR, "SR", m_core.PCU.sr).formatstr("%04X");
@@ -445,7 +445,7 @@ void dsp56156_device::device_reset()
m_core.ppc = m_core.PCU.pc;
/* HACK - Put a jump to 0x0000 at 0x0000 - this keeps the CPU locked to the instruction at address 0x0000 */
- m_core.program->write_word(0x0000, 0x0124);
+ m_core.program.write_word(0x0000, 0x0124);
}
diff --git a/src/devices/cpu/dsp56156/dsp56156.h b/src/devices/cpu/dsp56156/dsp56156.h
index 4b1169f07d9..09801c54407 100644
--- a/src/devices/cpu/dsp56156/dsp56156.h
+++ b/src/devices/cpu/dsp56156/dsp56156.h
@@ -191,9 +191,9 @@ struct dsp56156_core
int interrupt_cycles;
void (*output_pins_changed)(uint32_t pins);
cpu_device *device;
- address_space *program;
- memory_access_cache<1, -1, ENDIANNESS_LITTLE> *cache;
- address_space *data;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::cache cache;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::specific program;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::specific data;
uint16_t peripheral_ram[0x40];
uint16_t *program_ram;
diff --git a/src/devices/cpu/dsp56156/dsp56ops.hxx b/src/devices/cpu/dsp56156/dsp56ops.hxx
index 52ff4f5560c..d6b2b82f97d 100644
--- a/src/devices/cpu/dsp56156/dsp56ops.hxx
+++ b/src/devices/cpu/dsp56156/dsp56ops.hxx
@@ -2308,7 +2308,7 @@ static size_t dsp56156_op_bfop(dsp56156_core* cpustate, const uint16_t op, const
decode_BBB_bitmask(cpustate, BITS(op2,0xe000), &iVal);
workAddr = assemble_address_from_Pppppp_table(cpustate, BITS(op,0x0020), BITS(op,0x001f));
- previousValue = cpustate->data->read_word(workAddr);
+ previousValue = cpustate->data.read_word(workAddr);
workingWord = previousValue;
switch(BITS(op2, 0x1f00))
@@ -2374,7 +2374,7 @@ static size_t dsp56156_op_bfop_1(dsp56156_core* cpustate, const uint16_t op, con
decode_RR_table(cpustate, BITS(op,0x0003), &R);
workAddr = *((uint16_t*)R.addr);
- previousValue = cpustate->data->read_word(workAddr);
+ previousValue = cpustate->data.read_word(workAddr);
workingWord = previousValue;
switch(BITS(op2, 0x1f00))
@@ -3265,7 +3265,7 @@ static size_t dsp56156_op_movec(dsp56156_core* cpustate, const uint16_t op, uint
if (W)
{
/* Write D */
- uint16_t value = cpustate->data->read_word(*((uint16_t*)R.addr)) ;
+ uint16_t value = cpustate->data.read_word(*((uint16_t*)R.addr)) ;
typed_pointer temp_src = { &value, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3307,7 +3307,7 @@ static size_t dsp56156_op_movec_1(dsp56156_core* cpustate, const uint16_t op, ui
if (W)
{
/* Write D */
- uint16_t tempData = cpustate->data->read_word(memOffset);
+ uint16_t tempData = cpustate->data.read_word(memOffset);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3351,7 +3351,7 @@ static size_t dsp56156_op_movec_2(dsp56156_core* cpustate, const uint16_t op, ui
if (W)
{
/* Write D */
- uint16_t tempData = cpustate->data->read_word(memOffset);
+ uint16_t tempData = cpustate->data.read_word(memOffset);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3402,7 +3402,7 @@ static size_t dsp56156_op_movec_3(dsp56156_core* cpustate, const uint16_t op, co
else
{
/* 16-bit long address */
- uint16_t tempD = cpustate->data->read_word(op2);
+ uint16_t tempD = cpustate->data.read_word(op2);
typed_pointer tempTP = {&tempD, DT_WORD};
SetDestinationValue(tempTP, SD);
}
@@ -3480,7 +3480,7 @@ static size_t dsp56156_op_movec_5(dsp56156_core* cpustate, const uint16_t op, co
if (W)
{
/* Write D */
- uint16_t tempData = cpustate->data->read_word(memOffset);
+ uint16_t tempData = cpustate->data.read_word(memOffset);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3543,7 +3543,7 @@ static size_t dsp56156_op_movem(dsp56156_core* cpustate, const uint16_t op, uint
{
/* Read from Program Memory */
typed_pointer data;
- uint16_t ldata = cpustate->program->read_word(*((uint16_t*)R.addr));
+ uint16_t ldata = cpustate->program.read_word(*((uint16_t*)R.addr));
data.addr = &ldata;
data.data_type = DT_WORD;
@@ -3597,7 +3597,7 @@ static size_t dsp56156_op_movep(dsp56156_core* cpustate, const uint16_t op, uint
if (W)
{
- uint16_t data = cpustate->data->read_word(pp);
+ uint16_t data = cpustate->data.read_word(pp);
typed_pointer tempTP;
tempTP.addr = &data;
@@ -3636,7 +3636,7 @@ static size_t dsp56156_op_movep_1(dsp56156_core* cpustate, const uint16_t op, ui
/* A little different than most W if's - opposite read and write */
if (W)
{
- uint16_t data = cpustate->data->read_word(*((uint16_t*)SD.addr));
+ uint16_t data = cpustate->data.read_word(*((uint16_t*)SD.addr));
typed_pointer tempTP;
tempTP.addr = &data;
@@ -4663,7 +4663,7 @@ static void execute_x_memory_data_move(dsp56156_core* cpustate, const uint16_t o
if (W)
{
/* From X:<ea> to SD */
- uint16_t data = cpustate->data->read_word(*((uint16_t*)R.addr));
+ uint16_t data = cpustate->data.read_word(*((uint16_t*)R.addr));
typed_pointer tempTP;
tempTP.addr = &data;
@@ -4711,7 +4711,7 @@ static void execute_x_memory_data_move2(dsp56156_core* cpustate, const uint16_t
if (W)
{
/* Write D */
- uint16_t value = cpustate->data->read_word(*mem_offset);
+ uint16_t value = cpustate->data.read_word(*mem_offset);
typed_pointer tempV = {&value, DT_WORD};
SetDestinationValue(tempV, SD);
}
@@ -4739,7 +4739,7 @@ static void execute_x_memory_data_move_with_short_displacement(dsp56156_core* cp
if (W)
{
/* Write D */
- uint16_t tempData = cpustate->data->read_word(memOffset);
+ uint16_t tempData = cpustate->data.read_word(memOffset);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -4775,13 +4775,13 @@ static void execute_dual_x_memory_data_read(dsp56156_core* cpustate, const uint1
fatalerror("Dsp56156: Unimplemented access to external X Data Memory >= 0xffc0 in Dual X Memory Data Read.\n");
/* First memmove */
- srcVal1 = cpustate->data->read_word(*((uint16_t*)R.addr));
+ srcVal1 = cpustate->data.read_word(*((uint16_t*)R.addr));
tempV.addr = &srcVal1;
tempV.data_type = DT_WORD;
SetDestinationValue(tempV, D1);
/* Second memmove */
- srcVal2 = cpustate->data->read_word(R3);
+ srcVal2 = cpustate->data.read_word(R3);
tempV.addr = &srcVal2;
tempV.data_type = DT_WORD;
SetDestinationValue(tempV, D2);
@@ -4877,13 +4877,13 @@ static void SetDataMemoryValue(dsp56156_core* cpustate, typed_pointer source, ui
{
switch(source.data_type)
{
- case DT_BYTE: cpustate->data->write_word(destinationAddr, (uint16_t)( (*((uint8_t*) source.addr) & 0xff) ) ) ; break ;
- case DT_WORD: cpustate->data->write_word(destinationAddr, (uint16_t)( (*((uint16_t*)source.addr) & 0xffff) ) ) ; break ;
- case DT_DOUBLE_WORD: cpustate->data->write_word(destinationAddr, (uint16_t)( (*((uint32_t*)source.addr) & 0x0000ffff) ) ) ; break ;
+ case DT_BYTE: cpustate->data.write_word(destinationAddr, (uint16_t)( (*((uint8_t*) source.addr) & 0xff) ) ) ; break ;
+ case DT_WORD: cpustate->data.write_word(destinationAddr, (uint16_t)( (*((uint16_t*)source.addr) & 0xffff) ) ) ; break ;
+ case DT_DOUBLE_WORD: cpustate->data.write_word(destinationAddr, (uint16_t)( (*((uint32_t*)source.addr) & 0x0000ffff) ) ) ; break ;
/* !!! Is this universal ??? */
/* !!! Forget not, yon shift-limiter !!! */
- case DT_LONG_WORD: cpustate->data->write_word(destinationAddr, (uint16_t)( ((*((uint64_t*)source.addr)) & 0x00000000ffff0000U) >> 16) ) ; break ;
+ case DT_LONG_WORD: cpustate->data.write_word(destinationAddr, (uint16_t)( ((*((uint64_t*)source.addr)) & 0x00000000ffff0000U) >> 16) ) ; break ;
}
}
@@ -4892,12 +4892,12 @@ static void SetProgramMemoryValue(dsp56156_core* cpustate, typed_pointer source,
{
switch(source.data_type)
{
- case DT_BYTE: cpustate->program->write_word(destinationAddr, (uint16_t)( (*((uint8_t*) source.addr) & 0xff) ) ) ; break ;
- case DT_WORD: cpustate->program->write_word(destinationAddr, (uint16_t)( (*((uint16_t*)source.addr) & 0xffff) ) ) ; break ;
- case DT_DOUBLE_WORD: cpustate->program->write_word(destinationAddr, (uint16_t)( (*((uint32_t*)source.addr) & 0x0000ffff) ) ) ; break ;
+ case DT_BYTE: cpustate->program.write_word(destinationAddr, (uint16_t)( (*((uint8_t*) source.addr) & 0xff) ) ) ; break ;
+ case DT_WORD: cpustate->program.write_word(destinationAddr, (uint16_t)( (*((uint16_t*)source.addr) & 0xffff) ) ) ; break ;
+ case DT_DOUBLE_WORD: cpustate->program.write_word(destinationAddr, (uint16_t)( (*((uint32_t*)source.addr) & 0x0000ffff) ) ) ; break ;
/* !!! Is this universal ??? */
/* !!! Forget not, yon shift-limiter !!! */
- case DT_LONG_WORD: cpustate->program->write_word(destinationAddr, (uint16_t)( ((*((uint64_t*)source.addr)) & 0x00000000ffff0000U) >> 16) ) ; break ;
+ case DT_LONG_WORD: cpustate->program.write_word(destinationAddr, (uint16_t)( ((*((uint64_t*)source.addr)) & 0x00000000ffff0000U) >> 16) ) ; break ;
}
}
diff --git a/src/devices/cpu/dsp56156/dsp56pcu.cpp b/src/devices/cpu/dsp56156/dsp56pcu.cpp
index 94ca3b1caae..3714dff41de 100644
--- a/src/devices/cpu/dsp56156/dsp56pcu.cpp
+++ b/src/devices/cpu/dsp56156/dsp56pcu.cpp
@@ -146,8 +146,8 @@ void pcu_reset(dsp56156_core* cpustate)
/* ... */
/* P:$cffe -> Internal P:$07ff low byte */
/* P:$cfff -> Internal P:$07ff high byte */
- uint8_t mem_value_low = cpustate->program->read_byte(mem_offset); /* TODO: IS THIS READING RIGHT? */
- uint8_t mem_value_high = cpustate->program->read_byte(mem_offset);
+ uint8_t mem_value_low = cpustate->program.read_byte(mem_offset); /* TODO: IS THIS READING RIGHT? */
+ uint8_t mem_value_high = cpustate->program.read_byte(mem_offset);
cpustate->program_ram[i] = (mem_value_high << 8) | mem_value_low;
}
@@ -168,7 +168,7 @@ void pcu_reset(dsp56156_core* cpustate)
/* they need. Once they've had their fill, they turn bootstrap mode off */
/* and the CPU begins execution at 0x0000; */
/* HACK - Read bit 15 at 0xc000 to see if we're working with the SSIO or host interface. */
- if (cpustate->program->read_word(0xc000<<1) & 0x8000)
+ if (cpustate->program.read_word(0xc000<<1) & 0x8000)
{
cpustate->bootstrap_mode = BOOTSTRAP_SSIX;
cpustate->device->logerror("DSP56156 : Currently in (hacked) bootstrap mode - reading from SSIx.\n");