Tachyon: Difference between revisions

From PSP Developer wiki
Jump to navigation Jump to search
(Add information about the Allegrex CPU & registers)
(Add some info about the ME)
Line 62: Line 62:
The Media Engine ("ME") is a second MIPS based CPU core that was not directly accessible by licensed developers. Instead, Sony runs code on the ME to facilitate decoding audio and video assets, along with the help of more specialized hardware like the Virtual Mobile Engine and "AVC".
The Media Engine ("ME") is a second MIPS based CPU core that was not directly accessible by licensed developers. Instead, Sony runs code on the ME to facilitate decoding audio and video assets, along with the help of more specialized hardware like the Virtual Mobile Engine and "AVC".


The ME runs at the same clock frequency as the main CPU core.
The ME runs at the same clock frequency as the main CPU core. It seems to have the same instruction set.


The ME has two co-processors:
The ME has two co-processors:
*COP0 - general system control
*COP0 - general system control
*COP1 - 32-bit Floating Point Unit
*COP1 - 32-bit Floating Point Unit
It has three instructions the main CPU doesn't have (or used):
*DBREAK (also present on other MIPS processors): used only once in the ME firmware
*MTVME
*MFVME
These two last instructions actually have the same opcodes as LDL and SDL, which this CPU doesn't have.
The instructions are actually encoded like this:
<pre>
ldl $reg, off($a3) <=> mfvme $reg, $off
sdl $reg, off($a3) <=> mtvme $reg, $off
</pre>
They might be used to store and retrieve information from and to the VME. They seem to be only used for video decoding.


== Graphics Engine ==
== Graphics Engine ==
Line 73: Line 86:


The VME appears to be one half of Sony's "Virtual Mobile Engine Concept 2" where a CPU would take care of "lightweight control tasks" and reconfigurable hardware logic (the VME) would do all of the "heavy work in a power efficient manner". See [https://www.yumpu.com/en/document/read/10961029/virtual-mobile-enginetm-vme-sony Virtual Mobile Engine - LSI that "Changes its Spots"].
The VME appears to be one half of Sony's "Virtual Mobile Engine Concept 2" where a CPU would take care of "lightweight control tasks" and reconfigurable hardware logic (the VME) would do all of the "heavy work in a power efficient manner". See [https://www.yumpu.com/en/document/read/10961029/virtual-mobile-enginetm-vme-sony Virtual Mobile Engine - LSI that "Changes its Spots"].
It might be something like a reconfigurable DSP; noone has been able to interpret its "firmware" yet.
It can be accessed from the ME through the mfvme/mtvme instructions or through DMA with addresses from 0x440F8000 to 0x44100000 (excluded).


== Versions ==  
== Versions ==  

Revision as of 19:16, 22 January 2023

Tachyon is the codename of the PSP main CPU SoC IC. It is a Sony custom-made LSI which holds the main CPU (Allegrex), the VFPU coprocessor, the Media Engine CPU and its embedded DRAM, the Graphics Engine, the AVC decoder, the Virtual Mobile Engine DSP, the Kirk and Spock crypto engines, and the 4KB embedded mask ROM which holds the iplloader and routines to boot into service mode. Tachyon has one primary CPU core which is responsible for running the XMB and games, and a second CPU core (Media Engine) which implements the audio and video decoding functionality of the PSP.

PSP CXD2962GG















Main Core "SC"

The PSP's CPU, named Allegrex, is a dual core 32-bit Little Endian MIPS based on the R4000 design with a few custom instructions.

Both CPU cores have their own 16 KiB Instruction and 16 KiB Data caches. The main CPU has an internal 16 KiB of scratchpad RAM that is accessed directly without going through the system bus.

The main CPU has three coprocessors:

  • COP0 - general system control
  • COP1 - 32-bit Floating Point Unit
  • COP2 - Vector Floating Point Unit (up to 3.2 GFLOPS)

It has some instructions from MIPS IV: EXT, INS, WSBW, SEB, SEH, ROTR, ROT(R)V, BITREV, CLZ, CLO. It doesn't seem to have:

  • 64bit instructions (of course)
  • LL, LDC1, LDC2, LWC2, SC, SDC1, SDC2, SWC2 (some of them are actually replaced by VFPU instructions, with different names)
  • T* (Trap and TLB) instructions
  • BLTZAL, BGEZAL, BLTZALL, BGEZALL
  • COP2 (VFPU) branching instructions

It also has its own instructions:

  • HALT: opcode 0x70000000. This instructions waits for an interruption to wake it up.
  • MFIC: opcode 0x70000024 with mask 0xFFFF07FF. It retrieves the interrupt controller state (1: interruptions enabled, 0: interruptions disabled) into the register described by mask 0x0000F800.
  • MTIC: opcode 0x70000026 with mask 0xFFFF07FF. It sets the interrupt controller state to the value which is in the register described by mask 0x0000F800.

The CPU defaults to 222MHz, but can be configured to run from 1-333 MHz.

The CPU cores are connected to main memory and other peripherals like the Graphics Engine through a system bus that is limited to 1/2 of the CPU's configured clock speed.

Since the PSP doesn't have a MMU, the COP0 registers related to TLBs are unused. The PSP also uses the obscure instructions cfc0/ctc0 to access "control registers" which are used by the PSP firmware to store various low level data.

CPU registers

The PSP calling convention seems a bit non-standard:

  • Arguments are passed through the arguments $a0, $a1, $a2, $a3, $t0, $t1, $t2, $t3, then on the stack
  • Registers $s0, $s1, $s2, $s3, $s4, $s5, $s6, $s7, $fp (used as a normal register), $ra (return address), $sp (stack pointer) are saved (or restored) by the callee
  • Registers $t4, $t5, $t6, $t7, $t8, $t9 are temporary registers, not saved by the callee
  • Registers $v0, $v1 contain the return value of a function: $v0 for the lower 32-bits and $v1 for the higher 32-bits (if appliable)

Some registers are used only by the kernel:

  • $gp and $k0 are used in only a few specific places in the kernel
  • $k1 is used to check permissions: each time an user function is called, it shifts $k1 left by 11 bits. The function is in user mode if the $k1 value has then its first (highest value) bit set. In then checks either if a pointer has its higher bit set, and/or if its end has its higher bit set, and/or if its size has its higher bit set. If one of those bits is set and we're in user mode, the function returns an error (if it checked the pointer/buffer, which is not always the case).
  • $at is used as a temporary register, for hardware manipulation sometimes (to store the hardware register address when reading/writing from/to it).

Media Engine

The Media Engine ("ME") is a second MIPS based CPU core that was not directly accessible by licensed developers. Instead, Sony runs code on the ME to facilitate decoding audio and video assets, along with the help of more specialized hardware like the Virtual Mobile Engine and "AVC".

The ME runs at the same clock frequency as the main CPU core. It seems to have the same instruction set.

The ME has two co-processors:

  • COP0 - general system control
  • COP1 - 32-bit Floating Point Unit

It has three instructions the main CPU doesn't have (or used):

  • DBREAK (also present on other MIPS processors): used only once in the ME firmware
  • MTVME
  • MFVME

These two last instructions actually have the same opcodes as LDL and SDL, which this CPU doesn't have. The instructions are actually encoded like this:

 ldl $reg, off($a3) <=> mfvme $reg, $off
 sdl $reg, off($a3) <=> mtvme $reg, $off

They might be used to store and retrieve information from and to the VME. They seem to be only used for video decoding.

Graphics Engine

Virtual Mobile Engine

The VME appears to be one half of Sony's "Virtual Mobile Engine Concept 2" where a CPU would take care of "lightweight control tasks" and reconfigurable hardware logic (the VME) would do all of the "heavy work in a power efficient manner". See Virtual Mobile Engine - LSI that "Changes its Spots".

It might be something like a reconfigurable DSP; noone has been able to interpret its "firmware" yet.

It can be accessed from the ME through the mfvme/mtvme instructions or through DMA with addresses from 0x440F8000 to 0x44100000 (excluded).

Versions

PSP-1000

  • CPU and DDR are discrete ICs on the motherboard
  • 32 MiB main memory (DDR)
  • 2 MiB Media Engine memory (eDRAM)

PSP-2000 and later

  • DDR is brought into the CPU's package
  • 64 MiB main memory (DDR)
  • 4 MiB Media Engine memory (eDRAM)

See also

https://www.extremetech.com/extreme/56942-sony-details-psp-chip-specs

https://www.copetti.org/writings/consoles/playstation-portable/