Previous 199869 Revisions Next

r31133 Saturday 28th June, 2014 at 03:58:41 UTC by Curt Coder
(MESS) c64: Precalculate PLA outputs for approximately 5% speedup. [Curt Coder]
[src/emu/machine]pla.c pla.h

trunk/src/emu/machine/pla.c
r31132r31133
3030//  pla_device - constructor
3131//-------------------------------------------------
3232
33pla_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)
34   : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
35      m_inputs(inputs),
36      m_outputs(outputs),
37      m_terms(terms),
38      m_input_mask(((UINT64)input_mask << 32) | input_mask)
33pla_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) :
34   device_t(mconfig, type, name, tag, owner, clock, shortname, source),
35   m_inputs(inputs),
36   m_outputs(outputs),
37   m_terms(terms),
38   m_input_mask(((UINT64)input_mask << 32) | input_mask)
3939{
4040}
4141
42pls100_device::pls100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
43   : pla_device(mconfig, PLS100, "PLS100", tag, owner, clock, 16, 8, 48, 0xffff, "pls100", __FILE__)
42pls100_device::pls100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
43   pla_device(mconfig, PLS100, "PLS100", tag, owner, clock, 16, 8, 48, 0xffff, "pls100", __FILE__),
44   m_output(*this, "output")
4445{
4546}
4647
47mos8721_device::mos8721_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
48   : pla_device(mconfig, MOS8721, "MOS8721", tag, owner, clock, 27, 18, 379, 0x7ffffff, "mos8721", __FILE__) // TODO actual number of terms is unknown
48mos8721_device::mos8721_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
49   pla_device(mconfig, MOS8721, "MOS8721", tag, owner, clock, 27, 18, 379, 0x7ffffff, "mos8721", __FILE__) // TODO actual number of terms is unknown
4950{
5051}
5152
r31132r31133
7071   m_cache_ptr = 0;
7172}
7273
74void pls100_device::device_start()
75{
76   pla_device::device_start();
7377
78   m_output.allocate(0x10000);
79
80   for (UINT32 input = 0; input < 0x10000; input++)
81   {
82      m_output[input] = pla_device::read(input);
83   }
84}
85
86
7487//-------------------------------------------------
7588//  parse_fusemap -
7689//-------------------------------------------------
r31132r31133
163176
164177   return s >> 32;
165178}
179
180
181//-------------------------------------------------
182//  read -
183//-------------------------------------------------
184
185UINT32 pls100_device::read(UINT32 input)
186{
187   return m_output[input];
188}
trunk/src/emu/machine/pla.h
r31132r31133
6868   // construction/destruction
6969   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);
7070
71   UINT32 read(UINT32 input);
71   virtual UINT32 read(UINT32 input);
7272
7373protected:
7474   // device-level overrides
r31132r31133
101101{
102102public:
103103   pls100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
104
105   // device-level overrides
106   virtual void device_start();
107
108   virtual UINT32 read(UINT32 input);
109
110private:
111   optional_shared_ptr<UINT8> m_output;
104112};
105113
106114

Previous 199869 Revisions Next


© 1997-2024 The MAME Team