xc1700e: new device

This commit is contained in:
Patrick Mackinlay 2019-02-20 13:25:12 +07:00
parent b84397f786
commit 455195eecf
3 changed files with 212 additions and 0 deletions

View File

@ -3869,3 +3869,15 @@ if (MACHINES["I82357"]~=null) then
MAME_DIR .. "src/devices/machine/i82357.h",
}
end
---------------------------------------------------
--
--@src/devices/machine/xc1700e.h,MACHINES["XC1700E"] = true
---------------------------------------------------
if (MACHINES["XC1700E"]~=null) then
files {
MAME_DIR .. "src/devices/machine/xc1700e.cpp",
MAME_DIR .. "src/devices/machine/xc1700e.h",
}
end

View File

@ -0,0 +1,83 @@
// license:BSD-3-Clause
// copyright-holders:Patrick Mackinlay
/*
* An implementation of the Xilinx XC1700E family of serial configuration PROM
* devices, including:
*
* Part Capacity Variants
* -------- --------- ----------------
* XC1736E 36,288
* XC1765E 65,536 XC1765EL
* XC17128E 131,072 XC17128EL
* XC17256E 262,144 XC17256EL
* XC17512L 524,288
* XC1701 1,048,576 XC1701L, XQ1701L
* XC1702L 2,097,152
* XC1704L 4,194,304
*
* The input C̅E̅ and CLK lines have not been explicitly implemented; these are
* assumed to be asserted as expected before/during data read. Similarly, the
* RESET/O̅E̅ or OE/R̅E̅S̅E̅T̅ is implicitly handled by device_reset(). The effect of
* C̅E̅O̅ can be obtained by connecting the cascade_r callback to the data_r of
* the cascaded device and resetting all devices when needed.
*
* This implementation assumes the input data is stored least-significant bit
* first; i.e. the first bit read out of the device is held in the LSB of the
* first byte of the memory region. This convention matches at least one
* dumping device tested.
*
* Sources:
*
* http://www.xilinx.com/support/documentation/data_sheets/ds027.pdf
*
*/
#include "emu.h"
#include "xc1700e.h"
#define VERBOSE 0
#include "logmacro.h"
DEFINE_DEVICE_TYPE(XC1736E, xc1736e_device, "xc1736e", "Xilinx 36,288 bit Serial PROM")
DEFINE_DEVICE_TYPE(XC1765E, xc1765e_device, "xc1765e", "Xilinx 65,536 bit Serial PROM")
DEFINE_DEVICE_TYPE(XC17128E, xc17128e_device, "xc17128e", "Xilinx 131,072 bit Serial PROM")
DEFINE_DEVICE_TYPE(XC17256E, xc17256e_device, "xc17256e", "Xilinx 262,144 bit Serial PROM")
DEFINE_DEVICE_TYPE(XC17512L, xc17512l_device, "xc17512l", "Xilinx 524,288 bit Serial PROM")
DEFINE_DEVICE_TYPE(XC1701, xc1701_device, "xc1701", "Xilinx 1,048,576 bit Serial PROM")
DEFINE_DEVICE_TYPE(XC1702L, xc1702l_device, "xc1702l", "Xilinx 2,097,152 bit Serial PROM")
DEFINE_DEVICE_TYPE(XC1704L, xc1704l_device, "xc1704l", "Xilinx 4,194,304 bit Serial PROM")
base_xc1700e_device::base_xc1700e_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 capacity)
: device_t(mconfig, type, tag, owner, clock)
, m_capacity(capacity)
, m_region(*this, DEVICE_SELF)
, m_cascade_cb(*this)
{
}
void base_xc1700e_device::device_start()
{
m_cascade_cb.resolve_safe(1);
save_item(NAME(m_address));
}
void base_xc1700e_device::device_reset()
{
m_address = 0;
}
int base_xc1700e_device::data_r()
{
if (m_address < m_capacity)
{
int const data = BIT(m_region->as_u8(m_address >> 3), m_address & 7);
m_address++;
return data;
}
else
return m_cascade_cb();
}

View File

@ -0,0 +1,117 @@
// license:BSD-3-Clause
// copyright-holders:Patrick Mackinlay
#ifndef MAME_MACHINE_XC1700E_H
#define MAME_MACHINE_XC1700E_H
#pragma once
class base_xc1700e_device : public device_t
{
public:
// configuration
auto cascade_r() { return m_cascade_cb.bind(); }
// output line
int data_r();
protected:
base_xc1700e_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u32 capacity);
// device_t overrides
virtual void device_start() override;
virtual void device_reset() override;
private:
// device configuration
const u32 m_capacity;
required_memory_region m_region;
devcb_read_line m_cascade_cb;
// device state
unsigned m_address;
};
DECLARE_DEVICE_TYPE(XC1736E, xc1736e_device)
DECLARE_DEVICE_TYPE(XC1765E, xc1765e_device)
DECLARE_DEVICE_TYPE(XC17128E, xc17128e_device)
DECLARE_DEVICE_TYPE(XC17256E, xc17256e_device)
DECLARE_DEVICE_TYPE(XC17512L, xc17512l_device)
DECLARE_DEVICE_TYPE(XC1701, xc1701_device)
DECLARE_DEVICE_TYPE(XC1702L, xc1702l_device)
DECLARE_DEVICE_TYPE(XC1704L, xc1704l_device)
class xc1736e_device : public base_xc1700e_device
{
public:
xc1736e_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
: base_xc1700e_device(mconfig, XC1736E, tag, owner, clock, 36'288UL)
{
}
};
class xc1765e_device : public base_xc1700e_device
{
public:
xc1765e_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
: base_xc1700e_device(mconfig, XC1765E, tag, owner, clock, 65'536UL)
{
}
};
class xc17128e_device : public base_xc1700e_device
{
public:
xc17128e_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
: base_xc1700e_device(mconfig, XC17128E, tag, owner, clock, 131'072UL)
{
}
};
class xc17256e_device : public base_xc1700e_device
{
public:
xc17256e_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
: base_xc1700e_device(mconfig, XC17256E, tag, owner, clock, 262'144UL)
{
}
};
class xc17512l_device : public base_xc1700e_device
{
public:
xc17512l_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
: base_xc1700e_device(mconfig, XC17512L, tag, owner, clock, 524'288UL)
{
}
};
class xc1701_device : public base_xc1700e_device
{
public:
xc1701_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
: base_xc1700e_device(mconfig, XC1701, tag, owner, clock, 1'048'576UL)
{
}
};
class xc1702l_device : public base_xc1700e_device
{
public:
xc1702l_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
: base_xc1700e_device(mconfig, XC1702L, tag, owner, clock, 2'097'152UL)
{
}
};
class xc1704l_device : public base_xc1700e_device
{
public:
xc1704l_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0)
: base_xc1700e_device(mconfig, XC1704L, tag, owner, clock, 4'194'304UL)
{
}
};
#endif // MAME_MACHINE_XC1700E_H