Rv32
rv32
¶
RISC-V 32-bit (RV32) dialect operations and types.
This module defines the RV32-specific variant of RISC-V operations, using 5-bit immediates for 32-bit architectures.
RV32 = Dialect('rv32', [SlliOp, SrliOp, SraiOp, BclrIOp, BextIOp, BinvIOp, BsetIOp, RorIOp, LiOp, GetRegisterOp], [])
module-attribute
¶
LiOp
¶
Bases: LiOperation[I32]
Loads a 32-bit immediate into rd.
This is an assembler pseudo-instruction.
See external documentation.
Source code in xdsl/dialects/rv32.py
name = 'rv32.li'
class-attribute
instance-attribute
¶
__init__(immediate: int | IntegerAttr[I32] | str | LabelAttr, *, rd: IntRegisterType = Registers.UNALLOCATED_INT, comment: str | StringAttr | None = None)
¶
Source code in xdsl/dialects/rv32.py
custom_parse_attributes(parser: Parser) -> dict[str, Attribute]
classmethod
¶
RV32RdRsImmShiftOperation
¶
Bases: RdRsImmShiftOperation[UI5, I32]
Base class for RISC-V 32-bit shift immediate operations with rd, rs1 and imm5.
Source code in xdsl/dialects/rv32.py
traits = lazy_traits_def(lambda: (ImmShiftOpRV32HasCanonicalizationPatternsTrait(),))
class-attribute
instance-attribute
¶
__init__(rs1: Operation | SSAValue, immediate: int | IntegerAttr[UI5], *, rd: IntRegisterType = Registers.UNALLOCATED_INT, comment: str | StringAttr | None = None)
¶
Source code in xdsl/dialects/rv32.py
ImmShiftOpRV32HasCanonicalizationPatternsTrait
dataclass
¶
Bases: ImmShiftOpHasCanonicalizationPatternsTrait[I32]
Trait for RISC-V 32-bit shift immediate operations with canonicalization patterns.
Source code in xdsl/dialects/rv32.py
SlliOp
dataclass
¶
Bases: RV32RdRsImmShiftOperation
Performs logical left shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate.
x[rd] = x[rs1] << shamt
See external documentation.
Source code in xdsl/dialects/rv32.py
name = 'rv32.slli'
class-attribute
instance-attribute
¶
SrliOp
dataclass
¶
Bases: RV32RdRsImmShiftOperation
Performs logical right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate.
x[rd] = x[rs1] >>u shamt
See external documentation.
Source code in xdsl/dialects/rv32.py
BclrIOp
dataclass
¶
Bases: RV32RdRsImmShiftOperation
This instruction returns rs1 with a single bit cleared at the index specified in shamt. The index is read from the lower log2(XLEN) bits of shamt. For RV32, the encodings corresponding to shamt[5]=1 are reserved.
See external documentation.
Source code in xdsl/dialects/rv32.py
name = 'rv32.bclri'
class-attribute
instance-attribute
¶
BextIOp
dataclass
¶
Bases: RV32RdRsImmShiftOperation
This instruction returns a single bit extracted from rs1 at the index specified in shamt. The index is read from the lower log2(XLEN) bits of shamt. For RV32, the encodings corresponding to shamt[5]=1 are reserved.
See external documentation.
Source code in xdsl/dialects/rv32.py
BinvIOp
dataclass
¶
Bases: RV32RdRsImmShiftOperation
This instruction returns rs1 with a single bit inverted at the index specified in shamt. The index is read from the lower log2(XLEN) bits of shamt. For RV32, the encodings corresponding to shamt[5]=1 are reserved.
See external documentation.
Source code in xdsl/dialects/rv32.py
name = 'rv32.binvi'
class-attribute
instance-attribute
¶
BsetIOp
dataclass
¶
Bases: RV32RdRsImmShiftOperation
This instruction returns rs1 with a single bit set at the index specified in shamt. The index is read from the lower log2(XLEN) bits of shamt. For RV32, the encodings corresponding to shamt[5]=1 are reserved.
See external documentation.
Source code in xdsl/dialects/rv32.py
name = 'rv32.bseti'
class-attribute
instance-attribute
¶
RorIOp
dataclass
¶
Bases: RV32RdRsImmShiftOperation
This instruction performs a rotate right of rs1 by the amount in the least-significant log2(XLEN) bits of shamt. For RV32, the encodings corresponding to shamt[5]=1 are reserved.
See external documentation.
Source code in xdsl/dialects/rv32.py
SraiOp
dataclass
¶
Bases: RV32RdRsImmShiftOperation
Performs arithmetic right shift on the value in register rs1 by the shift amount held in the lower 5 bits of the immediate.
x[rd] = x[rs1] >>s shamt
See external documentation.
Source code in xdsl/dialects/rv32.py
name = 'rv32.srai'
class-attribute
instance-attribute
¶
GetRegisterOp
dataclass
¶
Bases: GetAnyRegisterOperation[IntRegisterType]