summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cam900 <dbtlrchl@naver.com>2022-01-20 12:19:37 +0900
committer GitHub <noreply@github.com>2022-01-19 22:19:37 -0500
commit70295eff162bb08a8961a3f2d6a5bac020125876 (patch)
tree330b4ea9a6a94770e5967081f89b507c94c793be
parent3ee2758bb2b072325fe7b9b0a9ee3e259840542e (diff)
cpu/adsp2100/*.*: Add partially support for PMOVLAY register (#9164)
* Allow PMOVLAY, DMOVLAY register reading on opcodes and debugger states * Add device_post_load for restore external space overlay state
-rw-r--r--src/devices/cpu/adsp2100/2100ops.hxx40
-rw-r--r--src/devices/cpu/adsp2100/adsp2100.cpp60
-rw-r--r--src/devices/cpu/adsp2100/adsp2100.h10
3 files changed, 97 insertions, 13 deletions
diff --git a/src/devices/cpu/adsp2100/2100ops.hxx b/src/devices/cpu/adsp2100/2100ops.hxx
index 0b9aded2a22..ba5925e197e 100644
--- a/src/devices/cpu/adsp2100/2100ops.hxx
+++ b/src/devices/cpu/adsp2100/2100ops.hxx
@@ -337,6 +337,12 @@ inline void adsp21xx_device::update_l(int which)
m_base[which] = m_i[which] & m_lmask[which];
}
+inline void adsp21xx_device::update_dmovlay()
+{
+ if (!m_dmovlay_cb.isnull())
+ m_dmovlay_cb(m_dmovlay);
+}
+
void adsp21xx_device::write_reg0(int regnum, int32_t val)
{
switch (regnum)
@@ -380,9 +386,23 @@ void adsp21xx_device::write_reg1(int regnum, int32_t val)
break;
case 3:
- // Check for DMOVLAY instruction callback
- if (regnum == 0xf && !m_dmovlay_cb.isnull())
- m_dmovlay_cb(val & 0x3fff);
+ if (m_chip_type == CHIP_TYPE_ADSP2181) // ADSP2181 Overlay register
+ {
+ switch (index)
+ {
+ case 2:
+ m_pmovlay = val & 0x3fff;
+ //update_pmovlay();
+ break;
+ case 3:
+ m_dmovlay = val & 0x3fff;
+ update_dmovlay();
+ break;
+ default:
+ logerror("ADSP %04x: Writing to an invalid register! RGP=01 RegCode=%1X Val=%04X\n", m_ppc, regnum, val);
+ break;
+ }
+ }
else
logerror("ADSP %04x: Writing to an invalid register! RGP=01 RegCode=%1X Val=%04X\n", m_ppc, regnum, val);
break;
@@ -486,7 +506,19 @@ int32_t adsp21xx_device::read_reg0(int regnum)
int32_t adsp21xx_device::read_reg1(int regnum)
{
- return *m_read1_ptr[regnum];
+ int32_t ret = *m_read1_ptr[regnum];
+ // ADSP2181 Overlay register
+ if ((m_chip_type == CHIP_TYPE_ADSP2181) && (regnum >= 0xe))
+ {
+ switch (regnum)
+ {
+ case 0xe: ret = m_pmovlay; break;
+ case 0xf: ret = m_dmovlay; break;
+ default: break;
+ }
+ }
+
+ return ret;
}
int32_t adsp21xx_device::read_reg2(int regnum)
diff --git a/src/devices/cpu/adsp2100/adsp2100.cpp b/src/devices/cpu/adsp2100/adsp2100.cpp
index f1d8c78eab4..bb6674037ad 100644
--- a/src/devices/cpu/adsp2100/adsp2100.cpp
+++ b/src/devices/cpu/adsp2100/adsp2100.cpp
@@ -2,7 +2,7 @@
// copyright-holders:Aaron Giles
/***************************************************************************
- ADSP2100.c
+ adsp2100.cpp
ADSP-21xx series emulator.
@@ -61,8 +61,8 @@
Program Space: Program Space:
0000-01ff = 512 Internal RAM (booted) 0000-37ff = 14k External access
- 0400-07ff = 1k Reserved 3800-3bff = 1k Internal RAM
- 0800-3fff = 14k External access 3c00-3fff = 1k Reserved
+ 0200-07ff = 1.5k Reserved 3800-39ff = 512 Internal RAM
+ 0800-3fff = 14k External access 3a00-3fff = 1.5k Reserved
Data Space: Data Space:
0000-03ff = 1k External DWAIT0 0000-03ff = 1k External DWAIT0
@@ -71,7 +71,7 @@
3000-33ff = 1k External DWAIT3 3000-33ff = 1k External DWAIT3
3400-37ff = 1k External DWAIT4 3400-37ff = 1k External DWAIT4
3800-38ff = 256 Internal RAM 3800-38ff = 256 Internal RAM
- 3a00-3bff = 512 Reserved 3a00-3bff = 512 Reserved
+ 3900-3bff = 768 Reserved 3900-3bff = 768 Reserved
3c00-3fff = 1k Internal Control regs 3c00-3fff = 1k Internal Control regs
@@ -80,12 +80,16 @@
MMAP = 0 MMAP = 1
+ Auto boot loading via BDMA or IDMA No auto boot loading
+
Program Space: Program Space:
0000-1fff = 8k Internal RAM 0000-1fff = 8k External access
- 2000-3fff = 8k Internal RAM or Overlay 2000-3fff = 8k Internal
+ 2000-3fff = 8k Internal RAM (PMOVLAY = 0) 2000-3fff = 8k Internal (PMOVLAY = 0)
+ 2000-3fff = 8k External (PMOVLAY = 1,2)
Data Space: Data Space:
- 0000-1fff = 8k Internal RAM or Overlay 0000-1fff = 8k Internal RAM or Overlay
+ 0000-1fff = 8k Internal RAM (DMOVLAY = 0) 0000-1fff = 8k Internal RAM (DMOVLAY = 0)
+ 0000-1fff = 8k External (DMOVLAY = 1,2) 0000-1fff = 8k External (DMOVLAY = 1,2)
2000-3fdf = 8k-32 Internal RAM 2000-3fdf = 8k-32 Internal RAM
3fe0-3fff = 32 Internal Control regs 3fe0-3fff = 32 Internal Control regs
@@ -95,6 +99,10 @@
0400-05ff = 512 External IOWAIT2 0400-05ff = 512 External IOWAIT2
0600-07ff = 512 External IOWAIT3 0600-07ff = 512 External IOWAIT3
+ TODO:
+ - Move internal stuffs into CPU core file (on-chip RAM, control registers, etc)
+ - Support variable internal memory mappings
+
***************************************************************************/
#include "emu.h"
@@ -137,6 +145,8 @@ adsp21xx_device::adsp21xx_device(const machine_config &mconfig, device_type type
m_astat_clear(0),
m_idle(0),
m_px(0),
+ m_pmovlay(0),
+ m_dmovlay(0),
m_pc_sp(0),
m_cntr_sp(0),
m_stat_sp(0),
@@ -467,6 +477,8 @@ void adsp21xx_device::device_start()
save_item(NAME(m_lmask));
save_item(NAME(m_base));
save_item(NAME(m_px));
+ save_item(NAME(m_pmovlay));
+ save_item(NAME(m_dmovlay));
save_item(NAME(m_pc));
save_item(NAME(m_ppc));
@@ -587,6 +599,12 @@ void adsp21xx_device::device_start()
state_add(ADSP2100_FL1, "FL1", m_fl1).mask(1);
state_add(ADSP2100_FL2, "FL2", m_fl2).mask(1);
+ if (m_chip_type == CHIP_TYPE_ADSP2181)
+ {
+ state_add(ADSP2100_PMOVLAY, "PMOVLAY", m_pmovlay);
+ state_add(ADSP2100_DMOVLAY, "DMOVLAY", m_dmovlay);
+ }
+
// set our instruction counter
set_icountptr(m_icount);
}
@@ -611,6 +629,14 @@ void adsp21xx_device::device_reset()
write_reg2(0x0a, m_l[6]); write_reg2(0x02, m_i[6]);
write_reg2(0x0b, m_l[7]); write_reg2(0x03, m_i[7]);
+ // reset overlays
+ if (m_chip_type == CHIP_TYPE_ADSP2181)
+ {
+ m_pmovlay = m_dmovlay = 0;
+ // PMOVLAY
+ update_dmovlay();
+ }
+
// reset PC and loops
m_pc = (m_chip_type >= CHIP_TYPE_ADSP2101) ? 0 : 4;
m_ppc = m_pc;
@@ -645,6 +671,21 @@ void adsp21xx_device::device_reset()
//-------------------------------------------------
+// device_post_load - called after loading a saved state
+//-------------------------------------------------
+
+void adsp21xx_device::device_post_load()
+{
+ // update overlays
+ if (m_chip_type == CHIP_TYPE_ADSP2181)
+ {
+ // PMOVLAY
+ update_dmovlay();
+ }
+}
+
+
+//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or nullptr if
// the space doesn't exist
@@ -728,6 +769,11 @@ void adsp21xx_device::state_import(const device_state_entry &entry)
update_l(entry.index() - ADSP2100_L0);
break;
+ // PMOVLAY
+ case ADSP2100_DMOVLAY:
+ update_dmovlay();
+ break;
+
default:
fatalerror("CPU_IMPORT_STATE(adsp21xx) called for unexpected value\n");
}
@@ -1048,7 +1094,7 @@ void adsp21xx_device::create_tables()
// initialize the mask table
for (int i = 0; i < 0x4000; i++)
{
- if (i > 0x2000) m_mask_table[i] = 0x0000;
+ if (i > 0x2000) m_mask_table[i] = 0x0000;
else if (i > 0x1000) m_mask_table[i] = 0x2000;
else if (i > 0x0800) m_mask_table[i] = 0x3000;
else if (i > 0x0400) m_mask_table[i] = 0x3800;
diff --git a/src/devices/cpu/adsp2100/adsp2100.h b/src/devices/cpu/adsp2100/adsp2100.h
index 9910a7ac2b3..d17988edbf9 100644
--- a/src/devices/cpu/adsp2100/adsp2100.h
+++ b/src/devices/cpu/adsp2100/adsp2100.h
@@ -153,6 +153,8 @@ enum
ADSP2100_FL0,
ADSP2100_FL1,
ADSP2100_FL2,
+ ADSP2100_PMOVLAY,
+ ADSP2100_DMOVLAY,
ADSP2100_AX0_SEC,
ADSP2100_AX1_SEC,
ADSP2100_AY0_SEC,
@@ -213,6 +215,7 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
+ virtual void device_post_load() override;
// device_execute_interface overrides
virtual uint32_t execute_min_cycles() const noexcept override;
@@ -277,6 +280,7 @@ protected:
// register read/write
inline void update_i(int which);
inline void update_l(int which);
+ inline void update_dmovlay();
inline void write_reg0(int regnum, int32_t val);
inline void write_reg1(int regnum, int32_t val);
inline void write_reg2(int regnum, int32_t val);
@@ -382,6 +386,8 @@ protected:
uint32_t m_lmask[8];
uint32_t m_base[8];
uint8_t m_px;
+ uint32_t m_pmovlay; // External Program Space overlay
+ uint32_t m_dmovlay; // External Data Space overlay
// stacks
uint32_t m_loop_stack[LOOP_STACK_DEPTH];
@@ -441,8 +447,8 @@ protected:
devcb_read32 m_sport_rx_cb; // callback for serial receive
devcb_write32 m_sport_tx_cb; // callback for serial transmit
- devcb_write_line m_timer_fired_cb; // callback for timer fired
- devcb_write_line m_dmovlay_cb; // callback for DMOVLAY instruction
+ devcb_write_line m_timer_fired_cb; // callback for timer fired
+ devcb_write32 m_dmovlay_cb; // callback for DMOVLAY instruction
// debugging
#if ADSP_TRACK_HOTSPOTS