c.addw

Add word

This instruction is defined by:

Encoding

svg

Synopsis

Add the 32-bit values in xs2 from xd, and store the result in xd. The xd and xs2 register indexes should be used as xd+8 and xs2+8 (registers x8-x15). C.ADDW expands into addw xd, xd, xs2.

Access

M

HS

U

VS

VU

Always

Always

Always

Always

Always

Decode Variables

Bits<3> xs2 = $encoding[4:2];
Bits<3> xd = $encoding[9:7];

Execution

  • Pruned, XLEN == 64

  • Original

Bits<32> t0 = X[creg2reg(xd)][31:0];
Bits<32> t1 = X[creg2reg(xs2)][31:0];
X[creg2reg(xd)] = $signed(t0 + t1);
Bits<32> t0 = X[creg2reg(xd)][31:0];
Bits<32> t1 = X[creg2reg(xs2)][31:0];
X[creg2reg(xd)] = $signed(t0 + t1);