From f70082329d751ee8a358437feb34134e283b27d8 Mon Sep 17 00:00:00 2001 From: iCatButler Date: Tue, 7 Jun 2016 15:57:46 +0100 Subject: Initial PGXP CPU commit - Restructured project to base interface on PSX instructions - Support for all relevant CPU arithmetic and logic instructions - Debug output available via deferred PGXP calls - Remove most dependencies on PCSXR - Still very much a work in progress (lots of errors) - Add extra debug information to GPU plugin (w values) --- libpcsxcore/pgxp_cpu.h | 115 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 libpcsxcore/pgxp_cpu.h (limited to 'libpcsxcore/pgxp_cpu.h') diff --git a/libpcsxcore/pgxp_cpu.h b/libpcsxcore/pgxp_cpu.h new file mode 100644 index 00000000..c97929b1 --- /dev/null +++ b/libpcsxcore/pgxp_cpu.h @@ -0,0 +1,115 @@ +/*************************************************************************** +* Copyright (C) 2016 by iCatButler * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +***************************************************************************/ + +/************************************************************************** +* pgxp_cpu.h +* PGXP - Parallel/Precision Geometry Xform Pipeline +* +* Created on: 07 Jun 2016 +* Author: iCatButler +***************************************************************************/ + +#ifndef _PGXP_CPU_H_ +#define _PGXP_CPU_H_ + +#include "psxcommon.h" + +#define PGXP_TRACE 9 +#define PGXP_CPU_DEBUG + +struct PGXP_value_Tag; +typedef struct PGXP_value_Tag PGXP_value; + +extern PGXP_value* CPU_reg; +#define CPU_Hi CPU_reg[33] +#define CPU_Lo CPU_reg[34] + +// -- CPU functions + +// Load 32-bit word +void PGXP_CPU_LWL(u32 instr, u32 rtVal, u32 addr); +void PGXP_CPU_LW(u32 instr, u32 rtVal, u32 addr); +void PGXP_CPU_LWR(u32 instr, u32 rtVal, u32 addr); + +// Load 16-bit +void PGXP_CPU_LH(u32 instr, u16 rtVal, u32 addr); +void PGXP_CPU_LHU(u32 instr, u16 rtVal, u32 addr); + +// Load 8-bit +void PGXP_CPU_LB(u32 instr, u8 rtVal, u32 addr); +void PGXP_CPU_LBU(u32 instr, u8 rtVal, u32 addr); + +// Store 32-bit word +void PGXP_CPU_SWL(u32 instr, u32 rtVal, u32 addr); +void PGXP_CPU_SW(u32 instr, u32 rtVal, u32 addr); +void PGXP_CPU_SWR(u32 instr, u32 rtVal, u32 addr); + +// Store 16-bit +void PGXP_CPU_SH(u32 instr, u16 rtVal, u32 addr); + +// Store 8-bit +void PGXP_CPU_SB(u32 instr, u8 rtVal, u32 addr); + +// Arithmetic with immediate value +void PGXP_CPU_ADDI(u32 instr, u32 rtVal, u32 rsVal); +void PGXP_CPU_ADDIU(u32 instr, u32 rtVal, u32 rsVal); +void PGXP_CPU_ANDI(u32 instr, u32 rtVal, u32 rsVal); +void PGXP_CPU_ORI(u32 instr, u32 rtVal, u32 rsVal); +void PGXP_CPU_XORI(u32 instr, u32 rtVal, u32 rsVal); +void PGXP_CPU_SLTI(u32 instr, u32 rtVal, u32 rsVal); +void PGXP_CPU_SLTIU(u32 instr, u32 rtVal, u32 rsVal); + +// Load Upper +void PGXP_CPU_LUI(u32 instr, u32 rtVal); + +// Register Arithmetic +void PGXP_CPU_ADD(u32 instr, u32 rdVal, u32 rsVal, u32 rtVal); +void PGXP_CPU_ADDU(u32 instr, u32 rdVal, u32 rsVal, u32 rtVal); +void PGXP_CPU_SUB(u32 instr, u32 rdVal, u32 rsVal, u32 rtVal); +void PGXP_CPU_SUBU(u32 instr, u32 rdVal, u32 rsVal, u32 rtVal); +void PGXP_CPU_AND(u32 instr, u32 rdVal, u32 rsVal, u32 rtVal); +void PGXP_CPU_OR(u32 instr, u32 rdVal, u32 rsVal, u32 rtVal); +void PGXP_CPU_XOR(u32 instr, u32 rdVal, u32 rsVal, u32 rtVal); +void PGXP_CPU_NOR(u32 instr, u32 rdVal, u32 rsVal, u32 rtVal); +void PGXP_CPU_SLT(u32 instr, u32 rdVal, u32 rsVal, u32 rtVal); +void PGXP_CPU_SLTU(u32 instr, u32 rdVal, u32 rsVal, u32 rtVal); + +// Register mult/div +void PGXP_CPU_MULT(u32 instr, u32 hiVal, u32 loVal, u32 rsVal, u32 rtVal); +void PGXP_CPU_MULTU(u32 instr, u32 hiVal, u32 loVal, u32 rsVal, u32 rtVal); +void PGXP_CPU_DIV(u32 instr, u32 hiVal, u32 loVal, u32 rsVal, u32 rtVal); +void PGXP_CPU_DIVU(u32 instr, u32 hiVal, u32 loVal, u32 rsVal, u32 rtVal); + +// Shift operations (sa) +void PGXP_CPU_SLL(u32 instr, u32 rdVal, u32 rtVal); +void PGXP_CPU_SRL(u32 instr, u32 rdVal, u32 rtVal); +void PGXP_CPU_SRA(u32 instr, u32 rdVal, u32 rtVal); + +// Shift operations variable +void PGXP_CPU_SLLV(u32 instr, u32 rdVal, u32 rtVal, u32 rsVal); +void PGXP_CPU_SRLV(u32 instr, u32 rdVal, u32 rtVal, u32 rsVal); +void PGXP_CPU_SRAV(u32 instr, u32 rdVal, u32 rtVal, u32 rsVal); + +// Move registers +void PGXP_CPU_MFHI(u32 instr, u32 rdVal, u32 hiVal); +void PGXP_CPU_MTHI(u32 instr, u32 hiVal, u32 rdVal); +void PGXP_CPU_MFLO(u32 instr, u32 rdVal, u32 loVal); +void PGXP_CPU_MTLO(u32 instr, u32 loVal, u32 rdVal); + +#endif //_PGXP_CPU_H_ \ No newline at end of file -- cgit v1.2.3