diff options
author | 2019-06-16 23:45:57 +0200 | |
---|---|---|
committer | 2019-06-16 23:46:22 +0200 | |
commit | 68d9445979335ea14a659381cc4dae94322818a7 (patch) | |
tree | b49d0009021775525aea4778d9253ae2020db0eb | |
parent | 92b0401142f9da9dd68e24156864ae29bc76f986 (diff) |
-tdc1008: Initial untested implementation of the TRW TDC1008 Multiplier-Accumulator. [Ryan Holtz]
-dpb7000: Added TDC1008 devices for the Filter Card, albeit not hooked up yet, nw
-rw-r--r-- | scripts/src/machine.lua | 12 | ||||
-rw-r--r-- | scripts/target/mame/arcade.lua | 1 | ||||
-rw-r--r-- | scripts/target/mame/mess.lua | 1 | ||||
-rw-r--r-- | src/devices/machine/tdc1008.cpp | 265 | ||||
-rw-r--r-- | src/devices/machine/tdc1008.h | 105 | ||||
-rw-r--r-- | src/mame/drivers/dpb7000.cpp | 16 |
6 files changed, 400 insertions, 0 deletions
diff --git a/scripts/src/machine.lua b/scripts/src/machine.lua index e58809b2470..8ab1a7754ee 100644 --- a/scripts/src/machine.lua +++ b/scripts/src/machine.lua @@ -2773,6 +2773,18 @@ end --------------------------------------------------- -- +--@src/devices/machine/tdc1008.h,MACHINES["TDC1008"] = true +--------------------------------------------------- + +if (MACHINES["TDC1008"]~=null) then + files { + MAME_DIR .. "src/devices/machine/tdc1008.cpp", + MAME_DIR .. "src/devices/machine/tdc1008.h", + } +end + +--------------------------------------------------- +-- --@src/devices/machine/te7750.h,MACHINES["TE7750"] = true --------------------------------------------------- diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 9a548a9b19f..5e93acfdd28 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -594,6 +594,7 @@ MACHINES["SMPC"] = true MACHINES["STVCD"] = true --MACHINES["SUN4C_MMU"] = true MACHINES["TC0091LVC"] = true +--MACHINES["TDC1008"] = true MACHINES["TE7750"] = true MACHINES["TICKET"] = true MACHINES["TIMEKPR"] = true diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 5771e5c5070..1b85619611b 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -604,6 +604,7 @@ MACHINES["SPG2XX"] = true MACHINES["STVCD"] = true MACHINES["SUN4C_MMU"] = true MACHINES["TC0091LVC"] = true +MACHINES["TDC1008"] = true --MACHINES["TE7750"] = true MACHINES["TIMEKPR"] = true MACHINES["TMC0430"] = true diff --git a/src/devices/machine/tdc1008.cpp b/src/devices/machine/tdc1008.cpp new file mode 100644 index 00000000000..db0762193d5 --- /dev/null +++ b/src/devices/machine/tdc1008.cpp @@ -0,0 +1,265 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/*************************************************************************** + + tdc1008.cpp + TRW TDC1008 VLSI Multiplier - Accumulator + + TODO: + - Three-State Control lines (TSX, TSM, TSL) are not yet implemented. + +***************************************************************************/ + +#include "emu.h" +#include "tdc1008.h" + +/*****************************************************************************/ + +DEFINE_DEVICE_TYPE(TDC1008, tdc1008_device, "tdc1008", "TRW TDC1008 Multiplier-Accumulator") + +//------------------------------------------------- +// tdc1008_device - constructor +//------------------------------------------------- + +tdc1008_device::tdc1008_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, TDC1008, tag, owner, clock) + , m_x_in(0) + , m_y_in(0) + , m_xtp_in(0) + , m_msp_in(0) + , m_lsp_in(0) + , m_p_in(0) + , m_tsx(false) + , m_tsm(false) + , m_tsl(false) + , m_clk_x(false) + , m_clk_y(false) + , m_clk_p(false) + , m_prel(false) + , m_rnd(false) + , m_tc(false) + , m_acc(false) + , m_sub(false) + , m_xtp(*this) + , m_msp(*this) + , m_lsp(*this) + , m_p(*this) +{ +} + + +void tdc1008_device::device_start() +{ + save_item(NAME(m_x_in)); + save_item(NAME(m_y_in)); + save_item(NAME(m_xtp_in)); + save_item(NAME(m_msp_in)); + save_item(NAME(m_lsp_in)); + save_item(NAME(m_p_in)); + save_item(NAME(m_tsx)); + save_item(NAME(m_tsm)); + save_item(NAME(m_tsl)); + save_item(NAME(m_clk_x)); + save_item(NAME(m_clk_y)); + save_item(NAME(m_clk_p)); + save_item(NAME(m_prel)); + save_item(NAME(m_rnd)); + save_item(NAME(m_tc)); + save_item(NAME(m_acc)); + save_item(NAME(m_sub)); + save_item(NAME(m_x.u)); + save_item(NAME(m_y.u)); + save_item(NAME(m_p_out.u)); + + m_xtp.resolve_safe(); + m_msp.resolve_safe(); + m_lsp.resolve_safe(); + m_p.resolve_safe(); +} + +void tdc1008_device::device_reset() +{ + m_x_in = 0; + m_y_in = 0; + m_xtp_in = 0; + m_msp_in = 0; + m_lsp_in = 0; + m_p_in = 0; + m_tsx = false; + m_tsm = false; + m_tsl = false; + m_clk_x = false; + m_clk_y = false; + m_clk_p = false; + m_prel = false; + m_rnd = false; + m_tc = false; + m_acc = false; + m_sub = false; + + m_x.u = 0; + m_y.u = 0; + m_p_out.u = 0; +} + +WRITE8_MEMBER(tdc1008_device::x_w) +{ + m_x_in = data; +} + +WRITE8_MEMBER(tdc1008_device::y_w) +{ + m_y_in = data; +} + +WRITE_LINE_MEMBER(tdc1008_device::tsx_w) +{ + m_tsx = (bool)state; + if (m_prel && m_tsx) + m_p_out.u = (m_p_out.u & 0x0ffff) | (m_xtp_in << 16); +} + +WRITE_LINE_MEMBER(tdc1008_device::tsm_w) +{ + m_tsm = (bool)state; + if (m_prel && m_tsm) + m_p_out.u = (m_p_out.u & 0x700ff) | (m_msp_in << 8); +} + +WRITE_LINE_MEMBER(tdc1008_device::tsl_w) +{ + m_tsl = (bool)state; + if (m_prel && m_tsl) + m_p_out.u = (m_p_out.u & 0x7ff00) | m_lsp_in; +} + +WRITE8_MEMBER(tdc1008_device::xtp_w) +{ + m_xtp_in = data; + if (m_prel && m_tsx) + m_p_out.u = (m_p_out.u & 0x0ffff) | (m_xtp_in << 16); +} + +WRITE8_MEMBER(tdc1008_device::msp_w) +{ + m_msp_in = data; + if (m_prel && m_tsm) + m_p_out.u = (m_p_out.u & 0x700ff) | (m_msp_in << 8); +} + +WRITE8_MEMBER(tdc1008_device::lsp_w) +{ + m_lsp_in = data; + if (m_prel && m_tsl) + m_p_out.u = (m_p_out.u & 0x7ff00) | m_lsp_in; +} + +WRITE32_MEMBER(tdc1008_device::output_w) +{ + m_p_in = data; +} + +WRITE_LINE_MEMBER(tdc1008_device::clk_x_w) +{ + bool old = m_clk_x; + m_clk_x = (bool)state; + if (!old && m_clk_x) + m_x.u = m_x_in; +} + +WRITE_LINE_MEMBER(tdc1008_device::clk_y_w) +{ + bool old = m_clk_y; + m_clk_y = (bool)state; + if (!old && m_clk_y) + m_y.u = m_y_in; +} + +WRITE_LINE_MEMBER(tdc1008_device::clk_p_w) +{ + bool old = m_clk_p; + m_clk_p = (bool)state; + if (!old && m_clk_p) + { + if (m_tc) + { + int32_t new_product = (int32_t)m_x.s * (int32_t)m_y.s; + if (m_rnd) + { + new_product += 0x80; + } + if (m_acc) + { + if (m_sub) + m_p_out.s = new_product - m_p_out.s; + else + m_p_out.s = new_product + m_p_out.s; + } + else + { + m_p_out.s = new_product; + } + } + else + { + uint32_t new_product = (uint32_t)m_x.u * (uint32_t)m_y.u; + if (m_rnd) + { + new_product += 0x80; + } + if (m_acc) + { + if (m_sub) + m_p_out.u = new_product - m_p_out.u; + else + m_p_out.u = new_product + m_p_out.u; + } + else + { + m_p_out.u = new_product; + } + } + + if (!m_tsx && !m_prel) + m_xtp(m_p_out.u >> 16); + if (!m_tsm && !m_prel) + m_msp((uint8_t)(m_p_out.u >> 8)); + if (!m_tsl && !m_prel) + m_lsp((uint8_t)m_p_out.u); + m_p(m_p_out.u); + } +} + +WRITE_LINE_MEMBER(tdc1008_device::prel_w) +{ + m_prel = (bool)state; + if (m_prel) + { + if (m_tsx) + m_p_out.u = (m_p_out.u & 0x0ffff) | (m_xtp_in << 16); + if (m_tsm) + m_p_out.u = (m_p_out.u & 0x700ff) | (m_msp_in << 8); + if (m_tsl) + m_p_out.u = (m_p_out.u & 0x7ff00) | m_lsp_in; + } +} + +WRITE_LINE_MEMBER(tdc1008_device::rnd_w) +{ + m_rnd = (bool)state; +} + +WRITE_LINE_MEMBER(tdc1008_device::tc_w) +{ + m_tc = (bool)state; +} + +WRITE_LINE_MEMBER(tdc1008_device::acc_w) +{ + m_acc = (bool)state; +} + +WRITE_LINE_MEMBER(tdc1008_device::sub_w) +{ + m_sub = (bool)state; +} diff --git a/src/devices/machine/tdc1008.h b/src/devices/machine/tdc1008.h new file mode 100644 index 00000000000..54f60411c9c --- /dev/null +++ b/src/devices/machine/tdc1008.h @@ -0,0 +1,105 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/*************************************************************************** + + tdc1008.h + TRW TDC1008 VLSI Multiplier - Accumulator + +***************************************************************************/ + +#ifndef MAME_MACHINE_TDC1008_TDC1008_H +#define MAME_MACHINE_TDC1008_TDC1008_H + +#pragma once + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> tdc1008_device + +class tdc1008_device : public device_t +{ +public: + // construction/destruction + tdc1008_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + + DECLARE_WRITE8_MEMBER(x_w); + DECLARE_WRITE8_MEMBER(y_w); + DECLARE_WRITE_LINE_MEMBER(tsx_w); + DECLARE_WRITE_LINE_MEMBER(tsm_w); + DECLARE_WRITE_LINE_MEMBER(tsl_w); + DECLARE_WRITE_LINE_MEMBER(clk_x_w); + DECLARE_WRITE_LINE_MEMBER(clk_y_w); + DECLARE_WRITE_LINE_MEMBER(clk_p_w); + DECLARE_WRITE_LINE_MEMBER(prel_w); + DECLARE_WRITE_LINE_MEMBER(rnd_w); + DECLARE_WRITE_LINE_MEMBER(tc_w); + DECLARE_WRITE_LINE_MEMBER(acc_w); + DECLARE_WRITE_LINE_MEMBER(sub_w); + + // Output preloads by group + DECLARE_WRITE8_MEMBER(xtp_w); + DECLARE_WRITE8_MEMBER(msp_w); + DECLARE_WRITE8_MEMBER(lsp_w); + + // Full output preload + DECLARE_WRITE32_MEMBER(output_w); + + // Outputs by group + auto xtp() { return m_xtp.bind(); } + auto msp() { return m_msp.bind(); } + auto lsp() { return m_lsp.bind(); } + + // Full output + auto p() { return m_p.bind(); } + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + union input_reg + { + int8_t s; + uint8_t u; + }; + + union output_reg + { + int32_t s; + uint32_t u; + }; + + uint8_t m_x_in; + uint8_t m_y_in; + uint8_t m_xtp_in; + uint8_t m_msp_in; + uint8_t m_lsp_in; + uint32_t m_p_in; + bool m_tsx; + bool m_tsm; + bool m_tsl; + bool m_clk_x; + bool m_clk_y; + bool m_clk_p; + bool m_prel; + bool m_rnd; + bool m_tc; + bool m_acc; + bool m_sub; + + input_reg m_x; + input_reg m_y; + output_reg m_p_out; + + devcb_write8 m_xtp; + devcb_write8 m_msp; + devcb_write8 m_lsp; + devcb_write32 m_p; +}; + +// device type definition +DECLARE_DEVICE_TYPE(TDC1008, tdc1008_device) + +#endif // MAME_MACHINE_TDC1008_TDC1008_H diff --git a/src/mame/drivers/dpb7000.cpp b/src/mame/drivers/dpb7000.cpp index 18cfe0cb1b4..2a4c49b3383 100644 --- a/src/mame/drivers/dpb7000.cpp +++ b/src/mame/drivers/dpb7000.cpp @@ -16,6 +16,7 @@ #include "machine/am2910.h" #include "machine/com8116.h" #include "machine/input_merger.h" +#include "machine/tdc1008.h" #include "video/mc6845.h" #include "emupal.h" #include "screen.h" @@ -62,6 +63,10 @@ public: , m_diskseq_prom(*this, "diskseq_prom") , m_fddcpu(*this, "fddcpu") , m_fdd_serial(*this, "fddserial") + , m_filter_cd(*this, "filter_cd") + , m_filter_ce(*this, "filter_ce") + , m_filter_cf(*this, "filter_cf") + , m_filter_cg(*this, "filter_cg") { } @@ -146,6 +151,11 @@ private: uint8_t m_fdd_port1; uint8_t m_fdd_track; + required_device<tdc1008_device> m_filter_cd; + required_device<tdc1008_device> m_filter_ce; + required_device<tdc1008_device> m_filter_cf; + required_device<tdc1008_device> m_filter_cg; + emu_timer *m_diskseq_clk; emu_timer *m_field_in_clk; emu_timer *m_field_out_clk; @@ -1095,6 +1105,12 @@ void dpb7000_state::dpb7000(machine_config &config) m_fdd_serial->rxd_handler().set(FUNC(dpb7000_state::fddcpu_debug_rx)); config.m_perfect_cpu_quantum = subtag("fddcpu"); + + // Filter Card + TDC1008(config, m_filter_cd); + TDC1008(config, m_filter_ce); + TDC1008(config, m_filter_cf); + TDC1008(config, m_filter_cg); } |