← Home

sext.h

Sign-extend halfword

Sign-extends the least-significant halfword in the source to XLEN by copying the most-significant bit in the halfword (i.e., bit 15) to all of the more-significant bits.

Assembly format

sext.h xd, xs1

Encoding

313029282726252423222120191817161514131211109876543210
011000000101xs1001xd0010011

Decode variables

VariableBitsWidth
xs1[19:15]5
xd[11:7]5

Execution

if (xlen() == 32) {
  X[xd] = {{16{X[xs1][15]}}, X[xs1][15:0]};
} else if (xlen() == 64) {
  X[xd] = {{48{X[xs1][15]}}, X[xs1][15:0]};
}

Defined by

Zbb

Access

SUVSVU
AlwaysAlwaysAlwaysAlways

Version af3eaf9+cheriot.f635218

Data from the RISC-V Unified Database, copyright RISC-V International and contributors.

CHERIoT extensions from the CHERIoT specification and Sail model, copyright Microsoft and the CHERIoT Platform contributors.

This site is provided as a community resource and is NOT affiliated with nor endorsed by RISC-V International.