c.sext.h
Sign-extend halfword, 16-bit encoding
- Extension
- Zcb
- XLEN
- RV32 and RV64
- Assembly (riscv-unified-db)
c.sext.h xd- Length
- 16-bit (compressed)
Encoding
| 1513 | 1210 | 97 | 65 | 42 | 10 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 100 | 111 | rs1′/rs2′ | 11 | 011 | 01 | ||||||||||
Match 0x9c6d, mask 0xfc7f. Source: c.sext.h rd_rs1_p 1..0=1 15..13=4 12..10=7 6..5=3 4..2=3 in riscv-opcodes/extensions/rv_zcb.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| rs1′/rs2′ | 9:7 | rd_rs1_p |
Description
Takes a single source/destination operand. This instruction sign-extends the least-significant halfword of the source to XLEN by copying the most-significant bit in the halfword (i.e., bit 15) to all of the more-significant bits.
Description from riscv-unified-db, reformatted.
Operation
if (implemented?(ExtensionName::C) && MISA_CSR_IMPLEMENTED && (CSR[misa].C == 1'b0)) {
reserved_instruction($encoding);
}
X[creg2reg(xd)] = $signed(X[creg2reg(xd)][15:0]);Pseudocode in riscv-unified-db’s IDL, quoted unchanged.