base: Rework bitunions so they can be more flexible.

They are now oriented around a class which makes it easy to provide
custom setter/getter functions which let you set or read bits in an
arbitrary way.

Future additions may add the ability to add custom bitfield methods,
and index-able bitfields.

Change-Id: Ibd6d4d9e49107490f6dad30a4379a8c93bda9333
Reviewed-on: https://gem5-review.googlesource.com/7201
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>
This commit is contained in:
Gabe Black
2018-01-06 05:30:46 -08:00
parent ecec887507
commit cd9450c1d9
6 changed files with 250 additions and 193 deletions

View File

@@ -491,13 +491,10 @@ X86ISA::I8042::write(PacketPtr pkt)
void
X86ISA::I8042::serialize(CheckpointOut &cp) const
{
uint8_t statusRegData = statusReg.__data;
uint8_t commandByteData = commandByte.__data;
SERIALIZE_SCALAR(dataPort);
SERIALIZE_SCALAR(commandPort);
SERIALIZE_SCALAR(statusRegData);
SERIALIZE_SCALAR(commandByteData);
SERIALIZE_SCALAR(statusReg);
SERIALIZE_SCALAR(commandByte);
SERIALIZE_SCALAR(dataReg);
SERIALIZE_SCALAR(lastCommand);
mouse.serialize("mouse", cp);
@@ -507,20 +504,14 @@ X86ISA::I8042::serialize(CheckpointOut &cp) const
void
X86ISA::I8042::unserialize(CheckpointIn &cp)
{
uint8_t statusRegData;
uint8_t commandByteData;
UNSERIALIZE_SCALAR(dataPort);
UNSERIALIZE_SCALAR(commandPort);
UNSERIALIZE_SCALAR(statusRegData);
UNSERIALIZE_SCALAR(commandByteData);
UNSERIALIZE_SCALAR(statusReg);
UNSERIALIZE_SCALAR(commandByte);
UNSERIALIZE_SCALAR(dataReg);
UNSERIALIZE_SCALAR(lastCommand);
mouse.unserialize("mouse", cp);
keyboard.unserialize("keyboard", cp);
statusReg.__data = statusRegData;
commandByte.__data = commandByteData;
}
void

View File

@@ -77,16 +77,13 @@ X86ISA::Speaker::write(PacketPtr pkt)
void
X86ISA::Speaker::serialize(CheckpointOut &cp) const
{
uint8_t controlValData = controlVal.__data;
SERIALIZE_SCALAR(controlValData);
SERIALIZE_SCALAR(controlVal);
}
void
X86ISA::Speaker::unserialize(CheckpointIn &cp)
{
uint8_t controlValData;
UNSERIALIZE_SCALAR(controlValData);
controlVal.__data = controlValData;
UNSERIALIZE_SCALAR(controlVal);
}
X86ISA::Speaker *