VIF: Simplify reverse FIFO

Removes the extra step of moving PATH2 data into the VIF FIFO
This commit is contained in:
PSI-Rockin 2020-11-02 19:23:12 -05:00
parent cb93eef70f
commit 804b99c623
2 changed files with 13 additions and 37 deletions

View file

@ -962,10 +962,10 @@ uint32_t DMAC::read32(uint32_t address)
value = channels[VIF0].tag_address;
break;
case 0x10008040:
reg = channels[VIF0].tag_save0;
value = channels[VIF0].tag_save0;
break;
case 0x10008050:
reg = channels[VIF0].tag_save1;
value = channels[VIF0].tag_save1;
break;
case 0x10009000:
value = channels[VIF1].control;
@ -980,10 +980,10 @@ uint32_t DMAC::read32(uint32_t address)
value = channels[VIF1].tag_address;
break;
case 0x10009040:
reg = channels[VIF1].tag_save0;
value = channels[VIF1].tag_save0;
break;
case 0x10009050:
reg = channels[VIF1].tag_save1;
value = channels[VIF1].tag_save1;
break;
case 0x1000A000:
value = channels[GIF].control;
@ -998,10 +998,10 @@ uint32_t DMAC::read32(uint32_t address)
value = channels[GIF].tag_address;
break;
case 0x1000A040:
reg = channels[GIF].tag_save0;
value = channels[GIF].tag_save0;
break;
case 0x1000A050:
reg = channels[GIF].tag_save1;
value = channels[GIF].tag_save1;
break;
case 0x1000B000:
value = channels[IPU_FROM].control;
@ -1058,7 +1058,7 @@ uint32_t DMAC::read32(uint32_t address)
value = channels[SPR_FROM].quadword_count;
break;
case 0x1000D080:
reg = channels[SPR_FROM].scratchpad_address;
value = channels[SPR_FROM].scratchpad_address;
break;
case 0x1000D400:
value = channels[SPR_TO].control;
@ -1073,7 +1073,7 @@ uint32_t DMAC::read32(uint32_t address)
value = channels[SPR_TO].tag_address;
break;
case 0x1000D480:
reg = channels[SPR_TO].scratchpad_address;
value = channels[SPR_TO].scratchpad_address;
break;
case 0x1000E000:
value |= control.master_enable;

View file

@ -94,26 +94,7 @@ bool VectorInterface::check_vif_stall(uint32_t value)
void VectorInterface::update(int cycles)
{
if (fifo_reverse)
{
vif_cmd_status = VIF_IDLE;
while (cycles--)
{
if (FIFO.size() <= (fifo_size - 4))
{
auto fifo_data = gif->read_GSFIFO();
//Check the GS still wants to send data
if (!std::get<1>(fifo_data))
return;
for (int i = 0; i < 4; i++)
FIFO.push(std::get<0>(fifo_data)._u32[i]);
}
else
break;
}
return;
}
//Since the loop processes per-word, we need to multiply cycles by 4
//This allows us to process one quadword per bus cycle
@ -167,7 +148,6 @@ void VectorInterface::update(int cycles)
stall_condition_active = false;
}
if ((command & 0x60) == 0x60)
{
vif_cmd_status = VIF_TRANSFER;
@ -986,16 +966,11 @@ bool VectorInterface::feed_DMA(uint128_t quad)
std::tuple<uint128_t, uint32_t>VectorInterface::readFIFO()
{
uint128_t quad;
if (FIFO.empty())
return std::make_tuple(quad, false);
if (!fifo_reverse)
Errors::die("[VIF] FIFO read when not reversed!");
for (int i = 0; i < 4; i++)
{
quad._u32[i] = FIFO.front();
FIFO.pop();
}
return std::make_tuple(quad, true);
auto fifo_data = gif->read_GSFIFO();
return fifo_data;
}
uint32_t VectorInterface::get_stat()
@ -1055,6 +1030,7 @@ void VectorInterface::set_stat(uint32_t value)
{
if ((!fifo_reverse && ((value >> 23) & 0x1)) || (fifo_reverse && !((value >> 23) & 0x1)))
{
vif_cmd_status = VIF_IDLE;
while (!FIFO.empty())
FIFO.pop();
}