Go compiler for PlayStation 2 VU1 microcode (VCL and VSM to VU1 objects), CC0
- Go 99.2%
- Shell 0.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .forgejo/workflows | ||
| cmd | ||
| docs | ||
| internal | ||
| oracle | ||
| spec | ||
| testdata | ||
| .gitattributes | ||
| .gitignore | ||
| go.mod | ||
| LICENSE | ||
| NOTICE.md | ||
| README.md | ||
vcl
A Go compiler for PlayStation 2 VU1 microcode. It compiles VCL source (old and new syntax, gasp-style macros) or VSM assembly to a .vo object. It replaces openvcl, masp and dvp-as with one tool that ps2build invokes, and it ships a disassembler.
| Command | Purpose |
|---|---|
vcl |
Preprocess, compile and assemble .vcl and .vsm; cost reports |
vcl-objdump |
Inspect and disassemble .vo objects (llvm-objdump-style options) |
vcl -c shader.vcl -o shader.vo # object for linking into an EE program
vcl -S shader.vcl -o shader.vsm # scheduled assembly text
vcl -fcost-report shader.vcl -S # static cost of the generated code
vcl-objdump -d shader.vo # disassemble
Options and the cost report are described in docs/usage.md. What was measured on a real console, and what it means for the generated code, is in docs/hardware-notes.md. The plan and parity gate are in docs/plan.md.
Status
- All 13 ps2gl renderers compile to code that matches the reference compiler's results on PCSX2 and on a real console.
- The cost analyzer agrees with the reference tool on 265 spec vectors and on all renderer outputs.
vcl-objdumpoutput reassembles to identical bytes for the whole corpus.- Generated code is within about 2 to 6 percent of the reference compiler on the hot loops. Where it is slower, the reference output is wrong on hardware (see the hardware notes) or the difference comes from scheduling.
Development
go build ./...
go vet ./...
gofmt -l .
go test ./...
Setting VCL_SPEC_DIR to the spec vector directory also runs the vector suites.
Licensing
CC0 1.0. The compiler is a clean-room reimplementation of openvcl (see NOTICE.md).