diff options
author | Curt Coder <curtcoder@mail.com> | 2012-02-05 15:49:34 +0000 |
---|---|---|
committer | Curt Coder <curtcoder@mail.com> | 2012-02-05 15:49:34 +0000 |
commit | 1f2506041222e12bb18df8c6e85769749c4aba4b (patch) | |
tree | 8beb8d36a7d1d2f93871326c3aef4dd5555faa9e | |
parent | 97685083b189669700d76c4cffbc10aef6ae9437 (diff) |
Added PLS100 (82S100) PLA emulation which utilizes a binary JED fusemap. [Curt Coder]
-rw-r--r-- | .gitattributes | 2 | ||||
-rw-r--r-- | src/emu/emu.mak | 15 | ||||
-rw-r--r-- | src/emu/machine/pls100.c | 136 | ||||
-rw-r--r-- | src/emu/machine/pls100.h | 94 |
4 files changed, 240 insertions, 7 deletions
diff --git a/.gitattributes b/.gitattributes index c2f0d13e524..bff6e3ff0c7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -935,6 +935,8 @@ src/emu/machine/pic8259.c svneol=native#text/plain src/emu/machine/pic8259.h svneol=native#text/plain src/emu/machine/pit8253.c svneol=native#text/plain src/emu/machine/pit8253.h svneol=native#text/plain +src/emu/machine/pls100.c svneol=native#text/plain +src/emu/machine/pls100.h svneol=native#text/plain src/emu/machine/ram.c svneol=native#text/plain src/emu/machine/ram.h svneol=native#text/plain src/emu/machine/rescap.h svneol=native#text/plain diff --git a/src/emu/emu.mak b/src/emu/emu.mak index 8cd85435986..3cfe6a21167 100644 --- a/src/emu/emu.mak +++ b/src/emu/emu.mak @@ -222,11 +222,12 @@ EMUMACHINEOBJS = \ $(EMUMACHINE)/nmc9306.o \ $(EMUMACHINE)/nvram.o \ $(EMUMACHINE)/pc16552d.o \ - $(EMUMACHINE)/pci.o \ + $(EMUMACHINE)/pci.o \ $(EMUMACHINE)/pd4990a.o \ $(EMUMACHINE)/pic8259.o \ $(EMUMACHINE)/pit8253.o \ - $(EMUMACHINE)/ram.o \ + $(EMUMACHINE)/pls100.o \ + $(EMUMACHINE)/ram.o \ $(EMUMACHINE)/roc10937.o \ $(EMUMACHINE)/rp5c01.o \ $(EMUMACHINE)/rp5c15.o \ @@ -275,19 +276,19 @@ EMUVIDEOOBJS = \ $(EMUVIDEO)/hd44102.o \ $(EMUVIDEO)/hd61830.o \ $(EMUVIDEO)/hd63484.o \ - $(EMUVIDEO)/i8275.o \ + $(EMUVIDEO)/i8275.o \ $(EMUVIDEO)/k053250.o \ $(EMUVIDEO)/mc6845.o \ $(EMUVIDEO)/msm6255.o \ $(EMUVIDEO)/pc_cga.o \ $(EMUVIDEO)/cgapal.o \ $(EMUVIDEO)/pc_vga.o \ - $(EMUVIDEO)/poly.o \ - $(EMUVIDEO)/psx.o \ + $(EMUVIDEO)/poly.o \ + $(EMUVIDEO)/psx.o \ $(EMUVIDEO)/ramdac.o \ $(EMUVIDEO)/resnet.o \ $(EMUVIDEO)/rgbutil.o \ - $(EMUVIDEO)/s2636.o \ + $(EMUVIDEO)/s2636.o \ $(EMUVIDEO)/saa5050.o \ $(EMUVIDEO)/sed1330.o \ $(EMUVIDEO)/tlc34076.o \ @@ -295,7 +296,7 @@ EMUVIDEOOBJS = \ $(EMUVIDEO)/tms9927.o \ $(EMUVIDEO)/tms9928a.o \ $(EMUVIDEO)/upd3301.o \ - $(EMUVIDEO)/v9938.o \ + $(EMUVIDEO)/v9938.o \ $(EMUVIDEO)/vector.o \ $(EMUVIDEO)/voodoo.o \ diff --git a/src/emu/machine/pls100.c b/src/emu/machine/pls100.c new file mode 100644 index 00000000000..c4114b896af --- /dev/null +++ b/src/emu/machine/pls100.c @@ -0,0 +1,136 @@ +/********************************************************************** + + PLS100 16xPAL_TERMSx8 Programmable Logic Array emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#include "emu.h" +#include "pls100.h" + + + +//************************************************************************** +// DEVICE TYPE DEFINITION +//************************************************************************** + +const device_type PLS100 = &device_creator<pls100_device>; + + + +//************************************************************************** +// INLINE HELPERS +//************************************************************************** + +//------------------------------------------------- +// parse_fusemap - +//------------------------------------------------- + +inline void pls100_device::parse_fusemap() +{ + jed_data jed; + jedbin_parse(machine().region(tag())->base(), machine().region(tag())->bytes(), &jed); + UINT32 fusenum = 0; + m_xor = 0; + + for (int term = 0; term < PAL_TERMS; term++) + { + m_and_comp[term] = 0; + m_and_true[term] = 0; + m_or[term] = 0; + + for (int i = 0; i < PAL_INPUTS; i++) + { + m_and_comp[term] |= jed_get_fuse(&jed, fusenum++) << i; + m_and_true[term] |= jed_get_fuse(&jed, fusenum++) << i; + } + + for (int f = 0; f < PAL_OUTPUTS; f++) + { + m_or[term] |= !jed_get_fuse(&jed, fusenum++) << f; + } + } + + for (int f = 0; f < PAL_OUTPUTS; f++) + { + m_xor |= jed_get_fuse(&jed, fusenum++) << f; + } +} + + +//------------------------------------------------- +// get_product - +//------------------------------------------------- + +inline int pls100_device::get_product(int term) +{ + UINT16 input_true = m_and_true[term] | m_i; + UINT16 input_comp = m_and_comp[term] | (m_i ^ 0xffff); + + return (input_true & input_comp) == 0xffff; +} + + +//------------------------------------------------- +// update_outputs - +//------------------------------------------------- + +inline void pls100_device::update_outputs() +{ + m_s = 0; + + for (int term = 0; term < PAL_TERMS; term++) + { + if (get_product(term)) + { + m_s |= m_or[term]; + } + } +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// pls100_device - constructor +//------------------------------------------------- + +pls100_device::pls100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PLS100, "PLS100", tag, owner, clock) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pls100_device::device_start() +{ + // parse fusemap + assert(machine().region(tag()) != NULL); + parse_fusemap(); + + // register for state saving + save_item(NAME(m_i)); + save_item(NAME(m_s)); +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +UINT8 pls100_device::read(UINT16 input) +{ + m_i = input; + + update_outputs(); + + return m_s ^ m_xor; +} diff --git a/src/emu/machine/pls100.h b/src/emu/machine/pls100.h new file mode 100644 index 00000000000..a344ef74854 --- /dev/null +++ b/src/emu/machine/pls100.h @@ -0,0 +1,94 @@ +/********************************************************************** + + PLS100 16x48x8 Programmable Logic Array emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +********************************************************************** + _____ _____ + FE 1 |* \_/ | 28 Vcc + I7 2 | | 27 I8 + I6 3 | | 26 I9 + I5 4 | | 25 I10 + I4 5 | | 24 I11 + I3 6 | 82S100 | 23 I12 + I2 7 | 82S101 | 22 I13 + I1 8 | PLS100 | 21 I14 + I0 9 | PLS101 | 20 I15 + F7 10 | | 19 _CE + F6 11 | | 18 F0 + F5 12 | | 17 F1 + F4 13 | | PAL_OUTPUTS F2 + GND 14 |_____________| 15 F3 + +**********************************************************************/ + + +#pragma once + +#ifndef __PLS100__ +#define __PLS100__ + +#include "emu.h" +#include "jedparse.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define PAL_INPUTS 16 +#define PAL_OUTPUTS 8 +#define PAL_TERMS 48 + + + +///************************************************************************* +// INTERFACE CONFIGURATION MACROS +///************************************************************************* + +#define MCFG_PLS100_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, PLS100, 0) + + + +///************************************************************************* +// TYPE DEFINITIONS +///************************************************************************* + +// ======================> pls100_device + +class pls100_device : public device_t +{ +public: + // construction/destruction + pls100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + UINT8 read(UINT16 input); + +protected: + // device-level overrides + virtual void device_start(); + +private: + inline void parse_fusemap(); + inline int get_product(int term); + inline void update_outputs(); + + UINT16 m_i; + UINT8 m_s; + UINT16 m_and_true[PAL_TERMS]; + UINT16 m_and_comp[PAL_TERMS]; + UINT16 m_or[PAL_TERMS]; + UINT8 m_xor; +}; + + +// device type definition +extern const device_type PLS100; + + + +#endif |