Skip to content
STIMSMITH

APUOP Common Definition File

Concept WIKI v1 · 8/18/2026

A shared C-macro-based definition file that centrally encodes SPU instruction metadata (identifier, format, opcode, mnemonic, assembler format, register-usage map, and pipeline kind) under the APUOP macro. It serves as a single source of instruction descriptions consumed by multiple tools built on top of the SPU reference model.

Overview

The APUOP Common Definition File is a centralized, C-macro-based specification that defines the non-functional attributes of every Synergistic Processor Unit (SPU) instruction. It is consumed alongside the SPU Reference Model by multiple downstream tools, eliminating duplicated hand-written descriptions of the instruction set across those applications.

Macro Structure

Each instruction (other than its functional behavior) is declared in the common definition file using the APUOP C macro. A representative example for the add instruction is:

APUOP(M_A, RR, 0x0c0, "a", ASM_RR, 00112, FX2)
/* Add RT<-RA+RB */

The macro arguments are interpreted as follows:

Position Meaning
1st Instruction identifier (e.g., M_A)
2nd Instruction format
3rd Opcode (e.g., 0x0c0)
4th Mnemonic (e.g., "a")
5th Assembler format (e.g., ASM_RR)
6th Register-file usage map (5-digit code)
7th Kind of pipeline used to execute the instruction

Every argument is required by at least one downstream application; the SPU reference model itself does not need all of them.

Register-Usage Encoding (6th Argument)

The 6th macro argument encodes which registers are read, written, or both for an instruction. Up to four registers may participate, named RA, RB, RC, and RT.

From the most significant digit, the five digits represent:

  1. Always 0 (reserved).
  2. RC register usage.
  3. RB register usage.
  4. RA register usage.
  5. RT register usage.

Digit values:

  • 0 — register is not used by the instruction.
  • 1 — register is used as a source.
  • 2 — register is used as a target.
  • 3 — register is used both as a source and as a target.

For example, the add instruction "a" reads RA and RB as source registers and writes the sum into target RT, yielding the encoding 00112.

Usage Across Applications

A primary benefit of the common definition file is that adding or modifying an instruction typically requires editing only this one file. Downstream tools that read the macro include:

  • SPU Reference Model — used for instruction-level simulation.
  • Assembler — used to translate mnemonics into object code.
  • Pipeline Simulator — used for timing/pipeline modeling.
  • Logic RTL — a script converts the macro description (notably the register-usage field) into HDL register-dependency-checking logic.
  • Verification environment — shares the same macro to keep functional and implementation views consistent.

Because every field of the APUOP macro is used by at least one consumer, the file acts as the single authoritative instruction-description source for the SPU toolchain.

Example: Instruction Simulator

In the SPU instruction simulator, the assembler and reference model both refer to the common definition file. Only the common file needs to be changed when an instruction is added or modified. The simulator reads a COFF file emitted by the assembler and loads memory contents and the program counter into the SPU-architected memory/register structures before executing instructions.

CITATIONS

6 sources
6 citations
[1] Each SPU instruction's non-functional definition is declared with the APUOP C macro in a common definition file. An SPU Reference Model for Simulation, Random Test Generation and Verification
[2] The macro takes the instruction identifier, instruction format, opcode, mnemonic, assembler format, register-file usage, and pipeline kind as arguments. An SPU Reference Model for Simulation, Random Test Generation and Verification
[3] The reference model itself does not use all the information in the macro; other applications such as the assembler, pipeline simulator, logic RTL, and verification environment also reference it, and each item is used by at least one application. An SPU Reference Model for Simulation, Random Test Generation and Verification
[4] The 6th argument is a five-digit code, with the most significant digit always 0, followed by digits for RC, RB, RA, and RT; 0 = unused, 1 = source, 2 = target, 3 = source and target. An SPU Reference Model for Simulation, Random Test Generation and Verification
[5] A script converts the macro description into the RTL description used by register-dependency checking logic. An SPU Reference Model for Simulation, Random Test Generation and Verification
[6] In the instruction simulator configuration, the assembler and reference model both refer to the common definition file, so only the common definition file must be changed for instruction-set changes. An SPU Reference Model for Simulation, Random Test Generation and Verification