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

CMPDMAREG

T1 tenstorrent alu insn
CMPDMAREG (Perform comparison on GPRs)
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, Scalar Unit, WormholeB0
Note: The RightImm6 variant takes three cycles. The RightReg variant takes three cycles if LeftReg and RightReg come from the same aligned group of four GPRs, or four cycles otherwise.

Summary

Performs an unsigned comparison (less than, greater than, or equal) between two Tensix GPRs, or between a Tensix GPR and an unsigned 6-bit immediate. The result is a single bit (true or false).

Syntax / Encoding

TT_CMPDMAREG(0, /* u3 */ Mode, /* u6 */ ResultReg, /* u6 */ RightReg , /* u6 */ LeftReg)
TT_CMPDMAREG(1, /* u3 */ Mode, /* u6 */ ResultReg, /* u6 */ RightImm6, /* u6 */ LeftReg)

Binary Encodings (2)

WidthFormatBit PatternMask / Match
32Tensix-32b010111010xxxxxxxxxxxxxxxxxxxxxxx0xff800000 / 0x5d000000
32Tensix-32b010111011xxxxxxxxxxxxxxxxxxxxxxx0xff800000 / 0x5d800000

Operands

NameDescription
Mode
ResultReg
RightReg
LeftReg
RightImm6

Reference Notes

# `CMPDMAREG` (Perform comparison on GPRs)

**Summary:** Performs an unsigned comparison (less than, greater than, or equal) between two Tensix GPRs, or between a Tensix GPR and an unsigned 6-bit immediate. The result is a single bit (true or false).

This instruction is `UnsupportedFunctionality` and its use is strongly discouraged: it has no known usage.

**Backend execution unit:** [Scalar Unit (ThCon)](ScalarUnit.md)

## Syntax

```c
TT_CMPDMAREG(0, /* u3 */ Mode, /* u6 */ ResultReg, /* u6 */ RightReg , /* u6 */ LeftReg)
TT_CMPDMAREG(1, /* u3 */ Mode, /* u6 */ ResultReg, /* u6 */ RightImm6, /* u6 */ LeftReg)
```

## Encoding

![](../../../Diagrams/Out/Bits32_CMPDMAREG.svg)
![](../../../Diagrams/Out/Bits32_CMPDMAREGi.svg)

## Functional model

```c
UnsupportedFunctionality(); // No known usage
uint32_t LeftVal = GPRs[CurrentThread][LeftReg];
uint32_t RightVal = GPRs[CurrentThread][RightReg]; // RightReg  variant
uint32_t RightVal = RightImm6;                     // RightImm6 variant
bool ResultVal;
switch (Mode) {
case CMPDMAREG_MODE_GT: ResultVal = LeftVal  > RightVal; break;
case CMPDMAREG_MODE_LT: ResultVal = LeftVal <  RightVal; break;
case CMPDMAREG_MODE_EQ: ResultVal = LeftVal == RightVal; break;
default: UndefinedBehavior(); break;
}
GPRs[CurrentThread][ResultReg] = ResultVal ? 1 : 0;
```

Supporting definitions:
```c
#define CMPDMAREG_MODE_GT 0
#define CMPDMAREG_MODE_LT 1
#define CMPDMAREG_MODE_EQ 2
```

## Performance

The `RightImm6` variant takes three cycles. The `RightReg` variant takes three cycles if `LeftReg` and `RightReg` come from the same aligned group of four GPRs, or four cycles otherwise.