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

SETADC

T1 tenstorrent alu insn
SETADC (Set one ADC counter)
SourceTenstorrent Official Tensix ISA Documentation (Wormhole & Blackhole) (tenstorrent_tt_isa)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeWormholeB0
Tenstorrent Wormhole B0 & Blackhole A0
License & VersionApache-2.0
main
Upstreamhttps://github.com/tenstorrent/tt-isa-documentation
Privilegeuser
ExtensionsTensix, Miscellaneous Unit, WormholeB0

Summary

Backend execution unit: Miscellaneous Unit

Syntax / Encoding

TT_SETADC(((/* bool */ PK) << 2) +
          ((/* bool */ U1) << 1) +
            /* bool */ U0,
            /* u1 */ Channel,
            /* u2 */ XYZW,
            /* u18 */ NewValue)

Binary Encodings (1)

WidthFormatBit PatternMask / Match
32Tensix-32b01010000xxxxxxxxxxxxxxxxxxxxxxxx0xff000000 / 0x50000000

Reference Notes

# `SETADC` (Set one ADC counter)

**Summary:**

**Backend execution unit:** [Miscellaneous Unit](MiscellaneousUnit.md)

## Syntax

```c
TT_SETADC(((/* bool */ PK) << 2) +
          ((/* bool */ U1) << 1) +
            /* bool */ U0,
            /* u1 */ Channel,
            /* u2 */ XYZW,
            /* u18 */ NewValue)
```

The high two bits of `NewValue` are `ThreadOverride`. Use of a non-zero `ThreadOverride` is `UnsupportedFunctionality` and is strongly discouraged. On both Wormhole and Blackhole, an override can corrupt the named thread's ADCs if that thread, or another override, reaches them in the same cycle; see [overriding another thread's ADCs](ADCs.md#overriding-another-threads-adcs).

## Encoding

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

## Functional model

```c
uint2_t ThreadOverride = NewValue >> 16;
if (ThreadOverride) {
  UnsupportedFunctionality(); // Wormhole and Blackhole hardware behave as below
}
uint2_t WhichThread = ThreadOverride == 0 ? CurrentThread : ThreadOverride - 1;
if (U0) ApplyTo(ADCs[WhichThread].Unpacker[0]);
if (U1) ApplyTo(ADCs[WhichThread].Unpacker[1]);
if (PK) ApplyTo(ADCs[WhichThread].Packers);

void ApplyTo(ADC& ADC_) {
  auto& Ch = ADC_.Channel[Channel];
  switch (XYZW) {
  case 0: Ch.X = NewValue, Ch.X_Cr = NewValue; break;
  case 1: Ch.Y = NewValue, Ch.Y_Cr = NewValue; break;
  case 2: Ch.Z = NewValue, Ch.Z_Cr = NewValue; break;
  case 3: Ch.W = NewValue, Ch.W_Cr = NewValue; break;
  }
}
```