c.add

Add

This instruction is defined by:

  • anyOf:

    • C, version >= 0

    • Zca, version >= 0

This instruction is included in the following profiles:

Encoding

svg

Assembly format

c.add rd, rs2

Synopsis

Add the value in rs2 to rd, and store the result in rd. C.ADD expands into add rd, rd, rs2.

Access

M HS U VS VU

Always

Always

Always

Always

Always

Decode Variables

Bits<5> rs2 = $encoding[6:2];
Bits<5> rd = $encoding[11:7];

Execution

  • IDL

  • Sail

XReg t0 = X[rd];
XReg t1 = X[rs2];
X[rd] = t0 + t1;
{
  let rs1_val = X(rd);
  let rs2_val = X(rs2);
  X(rd) = rs1_val + rs2_val;
  RETIRE_SUCCESS
}