memory: Split the subaccesses delegation information per-slot. [O. Galibert]

This commit is contained in:
Olivier Galibert 2011-05-31 19:17:48 +00:00
parent 8e73d99610
commit a8db172be1

View File

@ -478,7 +478,7 @@ protected:
};
// internal helpers
void configure_subunits(UINT64 handlermask, int handlerbits);
void configure_subunits(UINT64 handlermask, int handlerbits, int &start_slot, int &end_slot);
// internal state
bool m_populated; // populated?
@ -586,12 +586,12 @@ private:
// internal state
access_handler m_read;
access_handler m_subread;
access_handler m_subread[8];
const input_port_config * m_ioport;
bool m_sub_is_legacy;
bool m_sub_is_legacy[8];
legacy_info m_legacy_info;
legacy_info m_sublegacy_info;
legacy_info m_sublegacy_info[8];
};
@ -687,12 +687,12 @@ private:
// internal state
access_handler m_write;
access_handler m_subwrite;
access_handler m_subwrite[8];
const input_port_config * m_ioport;
bool m_sub_is_legacy;
bool m_sub_is_legacy[8];
legacy_info m_legacy_info;
legacy_info m_sublegacy_info;
legacy_info m_sublegacy_info[8];
};
@ -4383,7 +4383,7 @@ handler_entry::~handler_entry()
// mask
//-------------------------------------------------
void handler_entry::configure_subunits(UINT64 handlermask, int handlerbits)
void handler_entry::configure_subunits(UINT64 handlermask, int handlerbits, int &start_slot, int &end_slot)
{
UINT64 unitmask = ((UINT64)1 << handlerbits) - 1;
assert(handlermask != 0);
@ -4408,6 +4408,7 @@ void handler_entry::configure_subunits(UINT64 handlermask, int handlerbits)
// fill in the shifts
m_subunits = 0;
start_slot = m_subunits;
for (int unitnum = 0; unitnum < maxunits; unitnum++)
{
UINT32 shift = (unitnum^shift_xor_mask) * handlerbits;
@ -4422,6 +4423,7 @@ void handler_entry::configure_subunits(UINT64 handlermask, int handlerbits)
m_subunits++;
}
}
end_slot = m_subunits;
// compute the inverse mask
m_invsubmask = 0;
@ -4471,17 +4473,20 @@ void handler_entry_read::set_delegate(read8_delegate delegate, UINT64 mask, cons
// if mismatched bus width, configure a stub
if (m_datawidth != 8)
{
configure_subunits(mask, 8);
int start_slot, end_slot;
configure_subunits(mask, 8, start_slot, end_slot);
if (info)
{
m_sublegacy_info = *info;
m_sub_is_legacy = true;
}
for (int i=start_slot; i != end_slot; i++)
{
m_sublegacy_info[i] = *info;
m_sub_is_legacy[i] = true;
}
else
{
m_subread.r8 = delegate;
m_sub_is_legacy = false;
}
for (int i=start_slot; i != end_slot; i++)
{
m_subread[i].r8 = delegate;
m_sub_is_legacy[i] = false;
}
if (m_datawidth == 16)
set_delegate(read16_delegate(&handler_entry_read::read_stub_16, delegate.name(), this));
else if (m_datawidth == 32)
@ -4515,17 +4520,20 @@ void handler_entry_read::set_delegate(read16_delegate delegate, UINT64 mask, con
// if mismatched bus width, configure a stub
if (m_datawidth != 16)
{
configure_subunits(mask, 16);
int start_slot, end_slot;
configure_subunits(mask, 16, start_slot, end_slot);
if (info)
{
m_sublegacy_info = *info;
m_sub_is_legacy = true;
}
for (int i=start_slot; i != end_slot; i++)
{
m_sublegacy_info[i] = *info;
m_sub_is_legacy[i] = true;
}
else
{
m_subread.r16 = delegate;
m_sub_is_legacy = false;
}
for (int i=start_slot; i != end_slot; i++)
{
m_subread[i].r16 = delegate;
m_sub_is_legacy[i] = false;
}
if (m_datawidth == 32)
set_delegate(read32_delegate(&handler_entry_read::read_stub_32, delegate.name(), this));
else if (m_datawidth == 64)
@ -4557,17 +4565,20 @@ void handler_entry_read::set_delegate(read32_delegate delegate, UINT64 mask, con
// if mismatched bus width, configure a stub
if (m_datawidth != 32)
{
configure_subunits(mask, 32);
int start_slot, end_slot;
configure_subunits(mask, 32, start_slot, end_slot);
if (info)
{
m_sublegacy_info = *info;
m_sub_is_legacy = true;
}
for (int i=start_slot; i != end_slot; i++)
{
m_sublegacy_info[i] = *info;
m_sub_is_legacy[i] = true;
}
else
{
m_subread.r32 = delegate;
m_sub_is_legacy = false;
}
for (int i=start_slot; i != end_slot; i++)
{
m_subread[i].r32 = delegate;
m_sub_is_legacy[i] = false;
}
if (m_datawidth == 64)
set_delegate(read64_delegate(&handler_entry_read::read_stub_64, delegate.name(), this));
}
@ -4709,10 +4720,10 @@ UINT16 handler_entry_read::read_stub_16(address_space &space, offs_t offset, UIN
{
offs_t aoffset = offset * si.m_multiplier + si.m_offset;
UINT8 val;
if (m_sub_is_legacy)
val = m_sublegacy_info.handler.space8(m_sublegacy_info.object.space, aoffset);
if (m_sub_is_legacy[index])
val = m_sublegacy_info[index].handler.space8(m_sublegacy_info[index].object.space, aoffset);
else
val = m_subread.r8(space, aoffset, submask);
val = m_subread[index].r8(space, aoffset, submask);
result |= val << si.m_shift;
}
}
@ -4736,15 +4747,15 @@ UINT32 handler_entry_read::read_stub_32(address_space &space, offs_t offset, UIN
{
offs_t aoffset = offset * si.m_multiplier + si.m_offset;
UINT16 val = 0;
if (m_sub_is_legacy)
if (m_sub_is_legacy[index])
{
switch (si.m_size)
{
case 8:
val = m_sublegacy_info.handler.space8(m_sublegacy_info.object.space, aoffset);
val = m_sublegacy_info[index].handler.space8(m_sublegacy_info[index].object.space, aoffset);
break;
case 16:
val = m_sublegacy_info.handler.space16(m_sublegacy_info.object.space, aoffset, submask);
val = m_sublegacy_info[index].handler.space16(m_sublegacy_info[index].object.space, aoffset, submask);
break;
}
}
@ -4753,10 +4764,10 @@ UINT32 handler_entry_read::read_stub_32(address_space &space, offs_t offset, UIN
switch (si.m_size)
{
case 8:
val = m_subread.r8(space, aoffset, submask);
val = m_subread[index].r8(space, aoffset, submask);
break;
case 16:
val = m_subread.r16(space, aoffset, submask);
val = m_subread[index].r16(space, aoffset, submask);
break;
}
}
@ -4783,18 +4794,18 @@ UINT64 handler_entry_read::read_stub_64(address_space &space, offs_t offset, UIN
{
offs_t aoffset = offset * si.m_multiplier + si.m_offset;
UINT32 val = 0;
if (m_sub_is_legacy)
if (m_sub_is_legacy[index])
{
switch (si.m_size)
{
case 8:
val = m_sublegacy_info.handler.space8(m_sublegacy_info.object.space, aoffset);
val = m_sublegacy_info[index].handler.space8(m_sublegacy_info[index].object.space, aoffset);
break;
case 16:
val = m_sublegacy_info.handler.space16(m_sublegacy_info.object.space, aoffset, submask);
val = m_sublegacy_info[index].handler.space16(m_sublegacy_info[index].object.space, aoffset, submask);
break;
case 32:
val = m_sublegacy_info.handler.space32(m_sublegacy_info.object.space, aoffset, submask);
val = m_sublegacy_info[index].handler.space32(m_sublegacy_info[index].object.space, aoffset, submask);
break;
}
}
@ -4803,13 +4814,13 @@ UINT64 handler_entry_read::read_stub_64(address_space &space, offs_t offset, UIN
switch (si.m_size)
{
case 8:
val = m_subread.r8(space, aoffset, submask);
val = m_subread[index].r8(space, aoffset, submask);
break;
case 16:
val = m_subread.r16(space, aoffset, submask);
val = m_subread[index].r16(space, aoffset, submask);
break;
case 32:
val = m_subread.r32(space, aoffset, submask);
val = m_subread[index].r32(space, aoffset, submask);
break;
}
}
@ -4881,17 +4892,20 @@ void handler_entry_write::set_delegate(write8_delegate delegate, UINT64 mask, co
// if mismatched bus width, configure a stub
if (m_datawidth != 8)
{
configure_subunits(mask, 8);
int start_slot, end_slot;
configure_subunits(mask, 8, start_slot, end_slot);
if (info)
{
m_sublegacy_info = *info;
m_sub_is_legacy = true;
}
for (int i=start_slot; i != end_slot; i++)
{
m_sublegacy_info[i] = *info;
m_sub_is_legacy[i] = true;
}
else
{
m_subwrite.w8 = delegate;
m_sub_is_legacy = false;
}
for (int i=start_slot; i != end_slot; i++)
{
m_subwrite[i].w8 = delegate;
m_sub_is_legacy[i] = false;
}
if (m_datawidth == 16)
set_delegate(write16_delegate(&handler_entry_write::write_stub_16, delegate.name(), this));
else if (m_datawidth == 32)
@ -4920,17 +4934,20 @@ void handler_entry_write::set_delegate(write16_delegate delegate, UINT64 mask, c
// if mismatched bus width, configure a stub
if (m_datawidth != 16)
{
configure_subunits(mask, 16);
int start_slot, end_slot;
configure_subunits(mask, 16, start_slot, end_slot);
if (info)
{
m_sublegacy_info = *info;
m_sub_is_legacy = true;
}
for (int i=start_slot; i != end_slot; i++)
{
m_sublegacy_info[i] = *info;
m_sub_is_legacy[i] = true;
}
else
{
m_subwrite.w16 = delegate;
m_sub_is_legacy = false;
}
for (int i=start_slot; i != end_slot; i++)
{
m_subwrite[i].w16 = delegate;
m_sub_is_legacy[i] = false;
}
if (m_datawidth == 32)
set_delegate(write32_delegate(&handler_entry_write::write_stub_32, delegate.name(), this));
else if (m_datawidth == 64)
@ -4938,7 +4955,7 @@ void handler_entry_write::set_delegate(write16_delegate delegate, UINT64 mask, c
}
else
{
m_subwrite.w16 = delegate;
m_write.w16 = delegate;
if (info)
m_legacy_info = *info;
}
@ -4957,17 +4974,20 @@ void handler_entry_write::set_delegate(write32_delegate delegate, UINT64 mask, c
// if mismatched bus width, configure a stub
if (m_datawidth != 32)
{
configure_subunits(mask, 32);
int start_slot, end_slot;
configure_subunits(mask, 32, start_slot, end_slot);
if (info)
{
m_sublegacy_info = *info;
m_sub_is_legacy = true;
}
for (int i=start_slot; i != end_slot; i++)
{
m_sublegacy_info[i] = *info;
m_sub_is_legacy[i] = true;
}
else
{
m_subwrite.w32 = delegate;
m_sub_is_legacy = false;
}
for (int i=start_slot; i != end_slot; i++)
{
m_subwrite[i].w32 = delegate;
m_sub_is_legacy[i] = false;
}
if (m_datawidth == 64)
set_delegate(write64_delegate(&handler_entry_write::write_stub_64, delegate.name(), this));
}
@ -5103,10 +5123,10 @@ void handler_entry_write::write_stub_16(address_space &space, offs_t offset, UIN
{
offs_t aoffset = offset * si.m_multiplier + si.m_offset;
UINT8 adata = data >> si.m_shift;
if (m_sub_is_legacy)
m_sublegacy_info.handler.space8(m_sublegacy_info.object.space, aoffset, adata);
if (m_sub_is_legacy[index])
m_sublegacy_info[index].handler.space8(m_sublegacy_info[index].object.space, aoffset, adata);
else
m_subwrite.w8(space, aoffset, adata, submask);
m_subwrite[index].w8(space, aoffset, adata, submask);
}
}
}
@ -5127,15 +5147,15 @@ void handler_entry_write::write_stub_32(address_space &space, offs_t offset, UIN
{
offs_t aoffset = offset * si.m_multiplier + si.m_offset;
UINT16 adata = data >> si.m_shift;
if (m_sub_is_legacy)
if (m_sub_is_legacy[index])
{
switch (si.m_size)
{
case 8:
m_sublegacy_info.handler.space8(m_sublegacy_info.object.space, aoffset, adata);
m_sublegacy_info[index].handler.space8(m_sublegacy_info[index].object.space, aoffset, adata);
break;
case 16:
m_sublegacy_info.handler.space16(m_sublegacy_info.object.space, aoffset, adata, submask);
m_sublegacy_info[index].handler.space16(m_sublegacy_info[index].object.space, aoffset, adata, submask);
break;
}
}
@ -5144,10 +5164,10 @@ void handler_entry_write::write_stub_32(address_space &space, offs_t offset, UIN
switch (si.m_size)
{
case 8:
m_subwrite.w8(space, aoffset, adata, submask);
m_subwrite[index].w8(space, aoffset, adata, submask);
break;
case 16:
m_subwrite.w16(space, aoffset, adata, submask);
m_subwrite[index].w16(space, aoffset, adata, submask);
break;
}
}
@ -5171,18 +5191,18 @@ void handler_entry_write::write_stub_64(address_space &space, offs_t offset, UIN
{
offs_t aoffset = offset * si.m_multiplier + si.m_offset;
UINT32 adata = data >> si.m_shift;
if (m_sub_is_legacy)
if (m_sub_is_legacy[index])
{
switch (si.m_size)
{
case 8:
m_sublegacy_info.handler.space8(m_sublegacy_info.object.space, aoffset, adata);
m_sublegacy_info[index].handler.space8(m_sublegacy_info[index].object.space, aoffset, adata);
break;
case 16:
m_sublegacy_info.handler.space16(m_sublegacy_info.object.space, aoffset, adata, submask);
m_sublegacy_info[index].handler.space16(m_sublegacy_info[index].object.space, aoffset, adata, submask);
break;
case 32:
m_sublegacy_info.handler.space32(m_sublegacy_info.object.space, aoffset, adata, submask);
m_sublegacy_info[index].handler.space32(m_sublegacy_info[index].object.space, aoffset, adata, submask);
break;
}
}
@ -5191,13 +5211,13 @@ void handler_entry_write::write_stub_64(address_space &space, offs_t offset, UIN
switch (si.m_size)
{
case 8:
m_subwrite.w8(space, aoffset, adata, submask);
m_subwrite[index].w8(space, aoffset, adata, submask);
break;
case 16:
m_subwrite.w16(space, aoffset, adata, submask);
m_subwrite[index].w16(space, aoffset, adata, submask);
break;
case 32:
m_subwrite.w32(space, aoffset, adata, submask);
m_subwrite[index].w32(space, aoffset, adata, submask);
break;
}
}