Skip to content

Commit

Permalink
update PSEMU/Coprocessor.h
Browse files Browse the repository at this point in the history
  • Loading branch information
Cherrytree56567 committed Oct 8, 2023
1 parent 3927367 commit 1382291
Showing 1 changed file with 50 additions and 3 deletions.
53 changes: 50 additions & 3 deletions PSEMU/Coprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,55 @@
#include <fstream>
#include <bitset>

class Coprocessor0 {
public:
uint regs[64];
using uint = std::uint32_t;
using ulong = std::uint64_t;
using byte = std::int8_t;
using ushort = std::uint16_t;

union Cop0STAT {
uint raw;
struct {
uint IEc : 1; /* Interrupt Enable (current) */
uint KUc : 1; /* Kernel-User Mode (current) */
uint IEp : 1; /* Interrupt Enable (previous) */
uint KUp : 1; /* Kernel-User Mode (previous) */
uint IEo : 1; /* Interrupt Enable (old) */
uint KUo : 1; /* Kernel-User Mode (old) */
uint reserved1 : 2;
uint Sw : 2; /* Software Interrupt Mask */
uint Intr : 6; /* Hardware Interrupt Mask */
uint IsC : 1; /* Isolate Cache */
uint reserved2 : 1;
uint PZ : 1; /* Parity Zero */
uint reserved3 : 1;
uint PE : 1; /* Parity Error */
uint TS : 1; /* TLB Shutdown */
uint BEV : 1; /* Bootstrap Exception Vectors */
uint reserved4 : 5;
uint Cu : 4; /* Coprocessor Usability */
};
};

union Cop0CAUSE {
uint raw;

struct {
uint : 2;
uint exc_code : 5; /* Exception Code */
uint : 1;
uint Sw : 2; /* Software Interrupts */
uint IP : 6; /* Interrupt Pending */
uint : 12;
uint CE : 2; /* Coprocessor Error */
uint BT : 1; /* Branch Taken */
uint BD : 1; /* Branch Delay */
};
};

union Cop0 {
uint regs[64];

struct {
uint r0;
uint r1;
uint r2;
Expand All @@ -31,4 +76,6 @@ class Coprocessor0 {
uint epc; /* Exception Program Counter */
uint PRId; /* Processor Revision Identifier */
uint reserved[32];
};
};

0 comments on commit 1382291

Please sign in to comment.