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
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
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
50 51 52 53 54 55 56 57 58 59 | |
custom_parse_attributes(parser: Parser) -> dict[str, Attribute]
classmethod
Source code in xdsl/dialects/rv32.py
61 62 63 64 65 | |
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
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
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
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
ImmShiftOpRV32HasCanonicalizationPatternsTrait
dataclass
Bases: ImmShiftOpHasCanonicalizationPatternsTrait[I32]
Trait for RISC-V 32-bit shift immediate operations with canonicalization patterns.
Source code in xdsl/dialects/rv32.py
94 95 96 97 98 99 | |
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
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
name = 'rv32.slli'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I32]) -> IntegerAttr[I32]
Source code in xdsl/dialects/rv32.py
115 116 117 | |
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
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
name = 'rv32.srli'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I32]) -> IntegerAttr[I32]
Source code in xdsl/dialects/rv32.py
133 134 135 136 137 | |
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
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
name = 'rv32.bclri'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I32]) -> IntegerAttr[I32]
Source code in xdsl/dialects/rv32.py
152 153 154 | |
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
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
name = 'rv32.bexti'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I32]) -> IntegerAttr[I32]
Source code in xdsl/dialects/rv32.py
169 170 171 172 173 | |
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
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
name = 'rv32.binvi'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I32]) -> IntegerAttr[I32]
Source code in xdsl/dialects/rv32.py
188 189 190 | |
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
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
name = 'rv32.bseti'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I32]) -> IntegerAttr[I32]
Source code in xdsl/dialects/rv32.py
205 206 207 | |
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
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
name = 'rv32.rori'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I32]) -> IntegerAttr[I32]
Source code in xdsl/dialects/rv32.py
221 222 223 224 225 226 227 228 | |
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
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
name = 'rv32.srai'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I32]) -> IntegerAttr[I32]
Source code in xdsl/dialects/rv32.py
244 245 246 | |
GetRegisterOp
dataclass
Bases: GetAnyRegisterOperation[IntRegisterType]
Source code in xdsl/dialects/rv32.py
249 250 251 | |