vu

122 definitions in 4 files, 122 with an encoding diagram. src/isa/vu

Files

FileDefinitionsOtherWhat
package.lisp00the ISA.VU package: the PS2's vector units in micro mode, and the VIF that feeds them.
state.lisp04a vector unit's state in micro mode, and a VIF's.
micro.lisp12240the vector units' micro mode: upper (FMAC) and lower (integer, load/store, FDIV, EFU, branch) instructions as two ISAs, and the pair's execution.
vif.lisp030the VIF: VIF codes as an instruction set on a vector unit's memories and registers.

README

src/isa/vu: the PS2's vector units in micro mode, and the VIF

Package ISA.VU (uses CL and CORE; its arithmetic is ISA.MIPS's, see below). VU0 and VU1 run micro programs from their micro memories: 64-bit instructions, an upper (FMAC) and a lower (integer, load/store, FDIV, EFU, branch) half issued together. The VIF decodes the codes a DMA channel sends into a VU's memories and registers. Both are ISAs:

FileRole
package.lispthe package and its exports
state.lispthe vu struct (vf, vi, ACC, Q P I R, MAC/status/clip flags, TPC, memories' bases), the vif struct (its registers, the code being received)
micro.lispISA VU-UPPER and ISA VU-LOWER (32-bit words, definsn with encodings and semantics), their executors and decoders, vu-step (the pair), vu-run (to the E bit's delay slot)
vif.lispthe VIF codes: NOP STCYCL OFFSET BASE ITOP STMOD MSKPATH3 MARK FLUSH* MSCAL* MSCNT STMASK STROW STCOL MPG DIRECT DIRECTHL UNPACK; vif-word

Micro instructions

The encodings follow [VUUM]'s tables, and their positions were checked against PCSX2's micro decode tables ([PCSX2] pcsx2/VUops.cpp: _UPPER_OPCODE, _UPPER_FD_00..11, _LOWER_OPCODE, LowerOP, LowerOP_T3_00..11) for every instruction (vu_vu). Upper word: I E M D T flags (31-27), dest (24-21), ft, fs, fd, op (bc in bits 1-0).

The VIF

[VUUM] ch. 6 and PCSX2's Vif_Codes.cpp, Vif_Unpack.cpp. UNPACK writes vectors of 1-4 elements of 32/16/8 bits (or 5-5-5-1), signed unless USN; V2 writes v0 v1 v0 v1, V3 reads as V4 (both hardware facts PCSX2 records); CYCLE's CL/WL skip or fill; MODE 1 offsets by ROW, 2 accumulates ROW, 3 sets ROW; the MASK register writes data, ROW, COL or nothing per element and cycle row. MSCAL on VIF1 swaps the double buffer (TOP <- TOPS, DBF flips, TOPS <- BASE (+ OFST)). A machine provides what the VIF reaches outside its VU by defining again vif-direct-qword (DIRECT's quadwords: the GIF's PATH2), vif-start-micro, vif-raise (the interrupt bit), vif-mskpath3, and for the VU vu-xgkick and vu-xtop (src/sys/ps2/vu.lisp). Not yet: the VIF's stall on the interrupt bit, FLUSH waits, STAT's busy bits (transfers end at once).

Tests

vu_vu: decoding at every table position (and illegal ones), a program (broadcast add, an accumulation loop with a branch and its delay slot, the pair's read-before-write, the I bit, a store, DIV in the E bit's delay slot), MAC and status flags; VIF UNPACK in seven formats and modes, masks, MPG and MSCAL, the double buffer.


Made from xspe at b2fac33349db by tools/gen-xspe.py. xspe is GPL-3.0-or-later.