VU: Have the VU base class take a reference to the VU memory

This commit is contained in:
hch12907 2018-12-24 01:20:23 +08:00
parent cbb6054c96
commit 65b1ae5dd2
4 changed files with 14 additions and 2 deletions

View file

@ -30,7 +30,7 @@ int CVuInterpreter::time_step(const int ticks_available)
// PC & Instructions stuff...
const uword pc = unit->pc.read_uword() & 0x0FFF;
const udword raw_inst = r.ee.bus.read_uword(BusContext::Vu, 0x11000000 | (0x8000 * unit->core_id + pc));
const udword raw_inst = unit->micro_mem->read_uword(pc);
const uword upper_raw_inst = (raw_inst >> 32) & 0xFFFFFFFF;
const VuInstruction upper_inst = VuInstruction(upper_raw_inst);

View file

@ -31,7 +31,9 @@ struct VuInstruction : public MipsInstruction
static constexpr Bitfield W = Bitfield(21, 1);
VuInstruction(const uword value) :
MipsInstruction(value)
MipsInstruction(value),
lower_info(nullptr),
upper_info(nullptr)
{
}

View file

@ -15,6 +15,8 @@ VuUnit_Base::VuUnit_Base(const int core_id) :
SizedHwordRegister(), SizedHwordRegister(), SizedHwordRegister(), SizedHwordRegister(),
SizedHwordRegister(), SizedHwordRegister(), SizedHwordRegister(), SizedHwordRegister(),
SizedHwordRegister(), SizedHwordRegister(), SizedHwordRegister(), SizedHwordRegister()},
micro_mem(nullptr),
vu_mem(nullptr),
bus(8), // TODO: fine tune.
operation_state(VuOperationState::Ready)
{
@ -27,6 +29,8 @@ VuUnit_Vu0::VuUnit_Vu0(const int core_id) :
ccr{nullptr},
cop0(nullptr)
{
micro_mem = &memory_micro;
vu_mem = &memory_mem;
}
bool VuUnit_Vu0::is_usable()
@ -40,4 +44,6 @@ VuUnit_Vu1::VuUnit_Vu1(const int core_id) :
memory_micro(Constants::SIZE_16KB),
memory_mem(Constants::SIZE_16KB)
{
micro_mem = &memory_micro;
vu_mem = &memory_mem;
}

View file

@ -30,6 +30,10 @@ public:
/// ID of the VU.
int core_id;
/// Reference to the VU memory, actual storage is located in the derived classes
ArrayByteMemory* micro_mem;
ArrayByteMemory* vu_mem;
/// VU floating point registers (VF) (128-bit) and integer registers (VI) (16-bit).
/// The first VI register is a constant 0 register.
/// See VU Users Manual page 18.