pureikyubu/SRC/DSP
2020-05-05 13:38:27 +03:00
..
Scripts Common.lib and project tuning 2020-04-11 00:09:28 +03:00
DspAnalyzer.cpp Dsp Readme 2020-03-30 11:39:20 +03:00
DspAnalyzer.h Dsp Limit regs 2020-05-05 03:17:35 +03:00
DspCommands.cpp Update DspCommands.cpp 2020-05-05 03:10:33 +03:00
DspCommands.h TLB support enabled 2020-05-05 13:38:27 +03:00
DspCore.cpp Debugger Step Over functionality 2020-05-05 03:07:13 +03:00
DspCore.h Debugger Step Over functionality 2020-05-05 03:07:13 +03:00
DspDisasm.cpp Dsp Limit regs 2020-05-05 03:17:35 +03:00
DspDisasm.h DSP as standalone component 2020-03-30 11:21:16 +03:00
DspInterpreter.cpp Gekko breakpoints in debugger by F9 key functional again 2020-05-05 13:05:14 +03:00
DspInterpreter.h Gekko breakpoints in debugger by F9 key functional again 2020-05-05 13:05:14 +03:00
pch.cpp DSP as standalone component 2020-03-30 11:21:16 +03:00
pch.h JDI in Common 2020-04-11 19:43:39 +03:00
Readme.md Release 0.11 2020-04-01 22:17:26 +03:00

GAMECUBE DSP

Low-level DSP emulation module.

DspCore

How does the DSP core work.

The Run method executes the Update method until it is stopped by the Suspend method or it encounters a breakpoint.

Suspend method stops DSP thread execution indifinitely (same as HALT instruction).

The Step debugging method is used to unconditionally execute next DSP instruction (by interpreter).

The Update method checks the value of Gekko TBR. If its value has exceeded the limit for the execution of one DSP instruction (or segment in case of Jitc), interpreter/Jitc Execute method is called.

DspCore uses the interpreter and recompiler at the same time, of their own free will, depending on the situation.

DSP analyzer

This component analyzes the DSP instructions and is used by all interested systems (disassembler, interpreter and recompiler). That is, in fact, this is a universal decoder.

I decided to divide all the DSP instructions into groups (by higher 4 bits). Decoder implemented as simple if-else.

Hybrid (packaged) instructions are stored into two different groups in AnalyseInfo struct.

The simplest example of AnalyzeInfo consumption can be found in the disassembler.

The DSP instruction format is so tightly packed and has a lot of entropy, so I could make a mistake in decoding somewhere. All this then has to appear.

GameCube DSP interpreter

The development idea is as follows - to do at least something (critical mass of code), then do some reverse engineering of the microcodes and IROM and bring the emulation to an adequate state.

Interpreter architecture

The interpreter is not involved in instruction decoding. It receives ready-made information from the analyzer (AnalyzeInfo struct).

This is a new concept of emulation of processor systems, which I decided to try on the GameCube DSP.

Various Notes from known Macronix datasheets

  • TRAP-- Always call to hex 000C address

Mailbox Sync

Specifics of Mailbox registers (registers consist of two halves) impose some features on their emulation.

When accessed, Dead Lock may occur when the processor hangs on the polling DSP Mailbox, and the DSP hangs on polling the CPU Mailbox. This happens due to the almost simultaneous writing to both Mailbox from two "ends".

DSP JDI

The debugging interface specification provided by this component can be found in Data\DspJdi.json.