I’m writing a decode function for a C++ MIPS emulator I am making. What should my decode function send to my CPU::excute() function after the decode? What should I do with the pc?
A trap instruction typically invokes a trap handler, which is a piece of code it jumps to, usually based on an initial trap vector (just an address). From there the trap handler is up to you. A typical case would be to use the trap number to look up a routine in a table and jump to it, and so extend the effective instruction set of the CPU.
You’ll need to look up what the chip you’re trying to emulate does, and do the same thing, if you hope to have your emulator execute actual code written for the chip.