ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 913 microarchs · 15,555 chips · 105 sources
Arch:
Tier:

SETC16

T1 tenstorrent alu insn
SETC16 (Write 16 bits to thread-specific backend configuration)
SourceTenstorrent Official Tensix ISA Documentation (Wormhole & Blackhole) (tenstorrent_tt_isa)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeBlackholeA0 / WormholeB0
Tenstorrent Wormhole B0 & Blackhole A0
License & VersionApache-2.0
main
Upstreamhttps://github.com/tenstorrent/tt-isa-documentation
Privilegeuser
ExtensionsTensix, Configuration Unit, BlackholeA0, WormholeB0
Note: Matrix Unit (FPU) and Vector Unit (SFPU) instructions read DEST_TARGET_REG_CFG_MATH_Offset and ADDR_MOD_DST_SEC[i] as they leave the issuing thread, so a SETC16 of these fields needs no STALLWAIT before or after it: instructions ahead of the SETC16 in the thread's instruction stream use the old value, even while they…

Summary

Write 16 bits to thread-specific backend configuration. Writes are always performed against the configuration bank specific to the thread issuing the instruction.

Syntax / Encoding

TT_SETC16(/* u8 */ CfgIndex, /* u16 */ NewValue)

Binary Encodings (1)

WidthFormatBit PatternMask / Match
32Tensix-32b10110010xxxxxxxxxxxxxxxxxxxxxxxx0xff000000 / 0xb2000000

Operands

NameDescription
CfgIndex
NewValue

Reference Notes

# `SETC16` (Write 16 bits to thread-specific backend configuration)

**Summary:** Write 16 bits to thread-specific backend configuration. Writes are always performed against the configuration bank specific to the thread issuing the instruction.

**Backend execution unit:** [Configuration Unit](ConfigurationUnit.md)

## Syntax

```c
TT_SETC16(/* u8 */ CfgIndex, /* u16 */ NewValue)
```

## Encoding

![](../../../Diagrams/Out/Bits32_SETC16.svg)

## Functional model

```c
if (CfgIndex >= THD_STATE_SIZE) {
  NonContractualBehavior {
    // Current silicon behavior (not architecturally guaranteed): only the low 6 bits of CfgIndex are used. Where they
    // are below THD_STATE_SIZE, ThreadConfig[CurrentThread][CfgIndex % 64] is written as by an in-range SETC16, except
    // that writing the UNPACK_MISC_CFG_CfgContextCntReset fields this way does not reset the unpacker configuration
    // context counters (see "Special cases" in BackendConfiguration.md); otherwise nothing is written.
    if ((CfgIndex % 64) < THD_STATE_SIZE) {
      ThreadConfig[CurrentThread][CfgIndex % 64].Value = NewValue;
    }
    return;
  }
}

ThreadConfig[CurrentThread][CfgIndex].Value = NewValue;
```

Note that `CfgIndex` values line up exactly with the `Name_ADDR32` constants in `cfg_defines.h`, but only for the `// Registers for THREAD` section of `cfg_defines.h` (use [`WRCFG`](WRCFG.md) for all other sections of `cfg_defines.h`).

## Instruction scheduling

Matrix Unit (FPU) and Vector Unit (SFPU) instructions read `DEST_TARGET_REG_CFG_MATH_Offset` and `ADDR_MOD_DST_SEC[i]` as they leave the issuing thread, so a `SETC16` of these fields needs no `STALLWAIT` before or after it: instructions ahead of the `SETC16` in the thread's instruction stream use the old value, even while they are still executing, and the instruction right after it uses the new value.

`CFG_STATE_ID_StateID` is different: a Matrix Unit (FPU) instruction picks its `Config` bank by the thread's `CFG_STATE_ID_StateID` when it starts executing, not when it is issued, so if the Matrix Unit instruction just before a `SETC16` of `CFG_STATE_ID_StateID` is still waiting behind earlier Matrix Unit work, it uses the configuration (data formats, `ALU_ACC_CTRL_Fp32_enabled` and so on) of the bank the `SETC16` selects. To switch banks without affecting instructions already issued, first use `STALLWAIT` with block B7 and conditions C7 and C14.