summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2023-11-25 09:01:40 -0500
committer AJR <ajrhacker@users.noreply.github.com>2023-11-25 09:01:40 -0500
commit7174ef98d4ef11e315057a7bb88515c3fb265a00 (patch)
tree0b65bc03915f12ffe55087b63599f8da643941c8 /src
parent928aa6732d02b47362ad5eca34b99985c06b46f8 (diff)
skeleton/hudson_poems.cpp: Create and hook up skeleton Xtensa CPU device
Diffstat (limited to 'src')
-rw-r--r--src/devices/cpu/xtensa/xtensa.cpp71
-rw-r--r--src/devices/cpu/xtensa/xtensa.h52
-rw-r--r--src/mame/skeleton/hudson_poems.cpp37
3 files changed, 150 insertions, 10 deletions
diff --git a/src/devices/cpu/xtensa/xtensa.cpp b/src/devices/cpu/xtensa/xtensa.cpp
new file mode 100644
index 00000000000..2559ebcfb0e
--- /dev/null
+++ b/src/devices/cpu/xtensa/xtensa.cpp
@@ -0,0 +1,71 @@
+// license:BSD-3-Clause
+// copyright-holders:AJR
+/***************************************************************************
+
+ Tensilica Xtensa
+
+ Currently this device is just a stub with no actual execution core.
+
+***************************************************************************/
+
+#include "emu.h"
+#include "xtensa.h"
+#include "xtensad.h"
+
+// device type definitions
+DEFINE_DEVICE_TYPE(XTENSA, xtensa_device, "xtensa", "Tensilica Xtensa core")
+
+xtensa_device::xtensa_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : cpu_device(mconfig, XTENSA, tag, owner, clock)
+ , m_space_config("program", ENDIANNESS_LITTLE, 32, 32, 0)
+ , m_pc(0)
+{
+}
+
+std::unique_ptr<util::disasm_interface> xtensa_device::create_disassembler()
+{
+ return std::make_unique<xtensa_disassembler>();
+}
+
+device_memory_interface::space_config_vector xtensa_device::memory_space_config() const
+{
+ return space_config_vector {
+ std::make_pair(AS_PROGRAM, &m_space_config),
+ };
+}
+
+void xtensa_device::device_start()
+{
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_space);
+
+ std::fill(std::begin(m_a), std::end(m_a), 0);
+
+ set_icountptr(m_icount);
+
+ state_add(XTENSA_PC, "PC", m_pc);
+ state_add(STATE_GENPC, "GENPC", m_pc);
+ state_add(STATE_GENPCBASE, "CURPC", m_pc);
+ for (int i = 0; i < 16; i++)
+ state_add(XTENSA_A0 + i, string_format("a%d", i).c_str(), m_a[i]);
+
+ save_item(NAME(m_pc));
+ save_item(NAME(m_a));
+}
+
+void xtensa_device::device_reset()
+{
+ // TODO: Reset state
+}
+
+void xtensa_device::execute_run()
+{
+ debugger_instruction_hook(m_pc);
+
+ m_icount = 0;
+}
+
+void xtensa_device::execute_set_input(int inputnum, int state)
+{
+ // TODO
+}
diff --git a/src/devices/cpu/xtensa/xtensa.h b/src/devices/cpu/xtensa/xtensa.h
new file mode 100644
index 00000000000..1c288a36aa7
--- /dev/null
+++ b/src/devices/cpu/xtensa/xtensa.h
@@ -0,0 +1,52 @@
+// license:BSD-3-Clause
+// copyright-holders:AJR
+
+#ifndef MAME_CPU_XTENSA_XTENSA_H
+#define MAME_CPU_XTENSA_XTENSA_H
+
+#pragma once
+
+
+class xtensa_device : public cpu_device
+{
+public:
+ xtensa_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+
+ enum {
+ XTENSA_PC,
+ XTENSA_A0, XTENSA_A1, XTENSA_A2, XTENSA_A3,
+ XTENSA_A4, XTENSA_A5, XTENSA_A6, XTENSA_A7,
+ XTENSA_A8, XTENSA_A9, XTENSA_A10, XTENSA_A11,
+ XTENSA_A12, XTENSA_A13, XTENSA_A14, XTENSA_A15
+ };
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ // device_execute_interface overrides
+ virtual void execute_run() override;
+ virtual void execute_set_input(int inputnum, int state) override;
+
+ // device_disasm_interface overrides
+ virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
+
+ // device_memory_interface overrides
+ virtual space_config_vector memory_space_config() const override;
+
+private:
+ // address space
+ address_space_config m_space_config;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::specific m_space;
+
+ // internal state
+ u32 m_a[16];
+ u32 m_pc;
+ s32 m_icount;
+};
+
+DECLARE_DEVICE_TYPE(XTENSA, xtensa_device)
+
+#endif // MAME_CPU_XTENSA_XTENSA_H
diff --git a/src/mame/skeleton/hudson_poems.cpp b/src/mame/skeleton/hudson_poems.cpp
index e0617978461..c5990858267 100644
--- a/src/mame/skeleton/hudson_poems.cpp
+++ b/src/mame/skeleton/hudson_poems.cpp
@@ -27,57 +27,74 @@
#include "emu.h"
+#include "cpu/xtensa/xtensa.h"
+
#include "screen.h"
#include "speaker.h"
namespace {
-class hudsom_poems : public driver_device
+class hudson_poems_state : public driver_device
{
public:
- hudsom_poems(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag)
+ hudson_poems_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu")
{ }
void hudson_poems(machine_config &config);
-private:
+protected:
virtual void machine_start() override;
virtual void machine_reset() override;
+private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+
+ void mem_map(address_map &map);
+
+ required_device<cpu_device> m_maincpu;
};
-void hudsom_poems::machine_start()
+void hudson_poems_state::machine_start()
{
}
-void hudsom_poems::machine_reset()
+void hudson_poems_state::machine_reset()
{
+ m_maincpu->set_pc(0x20010058);
}
static INPUT_PORTS_START( hudson_poems )
INPUT_PORTS_END
-uint32_t hudsom_poems::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+uint32_t hudson_poems_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
return 0;
}
-void hudsom_poems::hudson_poems(machine_config &config)
+void hudson_poems_state::mem_map(address_map &map)
+{
+ map(0x20000000, 0x207fffff).rom().region("maincpu", 0);
+ map(0x2c000000, 0x2c7fffff).ram();
+}
+
+void hudson_poems_state::hudson_poems(machine_config &config)
{
// 27Mhz XTAL
// Xtensa based CPU?
+ XTENSA(config, m_maincpu, 27_MHz_XTAL);
+ m_maincpu->set_addrmap(AS_PROGRAM, &hudson_poems_state::mem_map);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
screen.set_size(320, 240); // resolution not confirmed
screen.set_visarea(0, 320-1, 0, 240-1);
- screen.set_screen_update(FUNC(hudsom_poems::screen_update));
+ screen.set_screen_update(FUNC(hudson_poems_state::screen_update));
SPEAKER(config, "speaker").front_center();
}
@@ -93,4 +110,4 @@ ROM_END
} // anonymous namespace
-CONS( 2005, marimba, 0, 0, hudson_poems, hudson_poems, hudsom_poems, empty_init, "Konami", "Marimba Tengoku (Japan)", MACHINE_IS_SKELETON )
+CONS( 2005, marimba, 0, 0, hudson_poems, hudson_poems, hudson_poems_state, empty_init, "Konami", "Marimba Tengoku (Japan)", MACHINE_IS_SKELETON )