Go compiler for PlayStation 2 VU1 microcode (VCL and VSM to VU1 objects), CC0
  • Go 99.2%
  • Shell 0.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Simon Hochrein 3a2913f388
All checks were successful
Build / build (push) Successful in 56s
Add .DS_Store to .gitignore
2026-10-08 17:17:01 -05:00
.forgejo/workflows Default to VU mode when assembling; add CI smoke test and cross-compile steps 2026-10-07 11:00:20 -05:00
cmd Default to VU mode when assembling; add CI smoke test and cross-compile steps 2026-10-07 11:00:20 -05:00
docs Print ilwr/iswr operands without a zero offset; document remaining spec vector differences 2026-10-07 13:21:29 -05:00
internal Print ilwr/iswr operands without a zero offset; document remaining spec vector differences 2026-10-07 13:21:29 -05:00
oracle Add the oracle build and ps2gl corpus capture scripts 2026-10-05 23:43:54 -05:00
spec Add round-2 spec, coverage notes and naming rules 2026-10-06 07:06:55 -05:00
testdata Default to VU mode when assembling; add CI smoke test and cross-compile steps 2026-10-07 11:00:20 -05:00
.gitattributes Add the vcl project skeleton 2026-10-05 23:33:47 -05:00
.gitignore Add .DS_Store to .gitignore 2026-10-08 17:17:01 -05:00
go.mod Add the vcl project skeleton 2026-10-05 23:33:47 -05:00
LICENSE Add the vcl project skeleton 2026-10-05 23:33:47 -05:00
NOTICE.md Add the vcl project skeleton 2026-10-05 23:33:47 -05:00
README.md Document the tools, options, cost report and hardware findings 2026-10-07 12:12:02 -05:00

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-objdump output 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).