(MESS) c64: Precalculate PLA outputs for approximately 5% speedup. [Curt Coder]

This commit is contained in:
Curt Coder 2014-06-28 03:58:41 +00:00
parent a601a9ad9c
commit 0b963f3c31
2 changed files with 42 additions and 11 deletions

View File

@ -30,22 +30,23 @@ const device_type MOS8721 = &device_creator<mos8721_device>;
// pla_device - constructor
//-------------------------------------------------
pla_device::pla_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, int inputs, int outputs, int terms, UINT32 input_mask, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
m_inputs(inputs),
m_outputs(outputs),
m_terms(terms),
m_input_mask(((UINT64)input_mask << 32) | input_mask)
pla_device::pla_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, int inputs, int outputs, int terms, UINT32 input_mask, const char *shortname, const char *source) :
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
m_inputs(inputs),
m_outputs(outputs),
m_terms(terms),
m_input_mask(((UINT64)input_mask << 32) | input_mask)
{
}
pls100_device::pls100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: pla_device(mconfig, PLS100, "PLS100", tag, owner, clock, 16, 8, 48, 0xffff, "pls100", __FILE__)
pls100_device::pls100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
pla_device(mconfig, PLS100, "PLS100", tag, owner, clock, 16, 8, 48, 0xffff, "pls100", __FILE__),
m_output(*this, "output")
{
}
mos8721_device::mos8721_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: pla_device(mconfig, MOS8721, "MOS8721", tag, owner, clock, 27, 18, 379, 0x7ffffff, "mos8721", __FILE__) // TODO actual number of terms is unknown
mos8721_device::mos8721_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
pla_device(mconfig, MOS8721, "MOS8721", tag, owner, clock, 27, 18, 379, 0x7ffffff, "mos8721", __FILE__) // TODO actual number of terms is unknown
{
}
@ -70,6 +71,18 @@ void pla_device::device_start()
m_cache_ptr = 0;
}
void pls100_device::device_start()
{
pla_device::device_start();
m_output.allocate(0x10000);
for (UINT32 input = 0; input < 0x10000; input++)
{
m_output[input] = pla_device::read(input);
}
}
//-------------------------------------------------
// parse_fusemap -
@ -163,3 +176,13 @@ UINT32 pla_device::read(UINT32 input)
return s >> 32;
}
//-------------------------------------------------
// read -
//-------------------------------------------------
UINT32 pls100_device::read(UINT32 input)
{
return m_output[input];
}

View File

@ -68,7 +68,7 @@ public:
// construction/destruction
pla_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, int inputs, int outputs, int terms, UINT32 output_mask, const char *shortname, const char *source);
UINT32 read(UINT32 input);
virtual UINT32 read(UINT32 input);
protected:
// device-level overrides
@ -101,6 +101,14 @@ class pls100_device : public pla_device
{
public:
pls100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// device-level overrides
virtual void device_start();
virtual UINT32 read(UINT32 input);
private:
optional_shared_ptr<UINT8> m_output;
};