254 definitions in 12 files, 224 with an encoding diagram. src/isa/ppc
| File | Definitions | Other | What |
|---|---|---|---|
| package.lisp | 0 | 0 | the ISA.PPC package: the PPU (PowerPC 64 + VMX); exports the state contract other areas use. |
| model.lisp | 0 | 3 | PowerPC CPU models: the build's model, chosen at build time. |
| state.lisp | 0 | 1 | the PPU's architected state (the contract other areas use). |
| util.lisp | 0 | 30 | the PowerPC ISA (PPU), its register accessors and MSB-0 helpers. |
| alu.lisp | 71 | 6 | PPU fixed-point arithmetic, logical, compare, rotate, shift. |
| branch.lisp | 23 | 11 | PPU branches, CR logical ops, SPR moves, system call, sync. |
| ldst.lisp | 25 | 17 | PPU fixed-point and floating-point loads and stores. |
| fpu.lisp | 17 | 60 | PPU scalar floating point and the FPSCR. |
| vmx.lisp | 88 | 33 | the PPU's VMX (AltiVec) unit. |
| exec.lisp | 0 | 5 | the PPU executor, decoder and step function. |
| asm.lisp | 30 | 1 | a compile-time PPU assembler built from the definsn records. |
| model/cell.lisp | 0 | 1 | the PowerPC model of the Cell Broadband Engine's PPU (the PS3's). |
Package ISA.PPC. One description of the PowerPC for every machine that
has one: what Book I-III leave to the implementation belongs to a CPU
model chosen at build time (XSPE_PPC_MODEL; the PS3 sets cell). The ISA
and its state keep the name ppu.
| File | Contents |
|---|---|
model.lisp | the model mechanism: defppcmodel, *ppc-model*, ppc-model-case, ppc-model-feature-case, ppc-model-value (all expanded at transpile time) |
model/cell.lisp | the Cell PPU: features :estimate-tables, :fctiw-sext, :vmx-left-right; 128-byte cache line and reservation granule; 79.8 MHz timebase |
state.lisp | the ppu struct (HLE contract; slots added at the end only) |
util.lisp | defisa ppu, defppu, MSB-0 helpers (msb-bit, msb-field, ppc-mask, rotl32x), GPR/FPR/VR/CR/XER accessors, CR0 and XER CA/OV/SO updates, branch-to, raise |
alu.lisp | fixed-point arithmetic, logical, compare, trap, rotate, shift |
branch.lisp | b/bc/bclr/bcctr, CR logical, mcrf, mfocrf/mtocrf, mfspr/mtspr/mftb (time base defhost), sc, sync and cache hints |
ldst.lisp | integer loads/stores (all widths, update, indexed, byte-reversed, multiple, string), reservations, dcbz, FP loads/stores |
fpu.lisp | scalar FP instructions and the FPSCR, on core's IEEE primitives (docs/float.md) |
vmx.lisp | VMX integer and float lanes, VSCR, vector loads/stores |
exec.lisp | ppu-execute, ppu-decode, ppu-step, ppu-run |
asm.lisp | compile-time assembler from the :asm specs, extended mnemonics |
Tests: tests/isa/ppc/*.lisp (assembled programs run through ppu-step, ctil's
output against tests/golden/; ECL under XSPE_ECL_ORACLE).
ppu-step sets npc = pc + 4, executes, then pc = npc. Only a
taken branch writes npc (branch-to). Link forms set LR to pc + 4.(ppu-exc cpu)
(+exc-trap+, +exc-illegal+, +exc-spr+), pc stays at it, the caller
decides and clears it.definsn; the assembler maps
the suffixes ., o, l, a. Instructions with a fixed Rc bit
(andi., stwcx.) carry the dot in their name.mulhw high word = sign extension; mfocrf other fields 0; fctiw
high word = the model's (:fctiw-sext, the Cell: sign extension; else
0); mffs high word 0; element loads leave the other elements unchanged.model.lisp's
macros, so the generated C holds only the selected model's code. A new
model is a file model/<name>.lisp with its defppcmodel (gekko and
broadway would add paired singles under (ppc-model-case ((:gekko
:broadway) ...))); tests: tests/isa/ppc/model.lisp.fadd, ffma, fcvt, fflags
..., docs/float.md) with PowerPC's rules written around them: NaN
results, the VX* kinds, FR, single precision through round to odd.fdaz, fftz), NaN = first NaN of
vA, vB, vC quieted, invalid -> 0x7FC00000. SAT is sticky in VSCR.(ppu-assemble program org) / (ppu-load-program program
org); labels are symbols, branch operands labels or byte displacements,
operands in assembler order ((lwz 3 8 1) is lwz r3,8(r1)).vrefp, vrsqrtefp: the Cell's estimate values (now correctly rounded;
a model feature once known); vexptefp, vlogefp. (fres and
frsqrte give the Cell's estimates under :estimate-tables.):timebase-hz), but the unix
resolute's host-timebase counts at the Cell's 79.8 MHz; a second model
needs the frequency passed to the host.mfmsr, rfid, mtmsr, SLB/TLB), eciwx/ecowx.mcrxr (not in 64-bit PowerISA) and other SPRs (CTRL, PIR, ...) as needed by
the HLE.Made from xspe at b2fac33349db by tools/gen-xspe.py. xspe is GPL-3.0-or-later.