Rv64
rv64
RISC-V 64-bit (RV64) dialect operations and types.
This module defines the RV64-specific variant of RISC-V operations, using 6-bit immediates for 64-bit architectures.
RV64 = Dialect('rv64', [SlliOp, SrliOp, SraiOp, SlliwOp, SrliwOp, BclrIOp, BextIOp, BinvIOp, BsetIOp, RorIOp, LiOp, LdOp, SdOp, GetRegisterOp], [])
module-attribute
LiOp
Bases: LiOperation[I64]
Loads a 64-bit immediate into rd.
This is an assembler pseudo-instruction.
See external documentation.
Source code in xdsl/dialects/rv64.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
name = 'rv64.li'
class-attribute
instance-attribute
__init__(immediate: int | IntegerAttr[I64] | str | LabelAttr, *, rd: IntRegisterType = Registers.UNALLOCATED_INT, comment: str | StringAttr | None = None)
Source code in xdsl/dialects/rv64.py
67 68 69 70 71 72 73 74 75 76 | |
custom_parse_attributes(parser: Parser) -> dict[str, Attribute]
classmethod
Source code in xdsl/dialects/rv64.py
78 79 80 81 82 | |
RV64RdRsImmShiftOperation
Bases: RdRsImmShiftOperation[UI6, I64]
Base class for RISC-V 64-bit shift immediate operations with rd, rs1 and imm6.
Source code in xdsl/dialects/rv64.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
traits = lazy_traits_def(lambda: (ImmShiftOpRV64HasCanonicalizationPatternsTrait(),))
class-attribute
instance-attribute
__init__(rs1: Operation | SSAValue, immediate: int | IntegerAttr[UI6], *, rd: IntRegisterType = Registers.UNALLOCATED_INT, comment: str | StringAttr | None = None)
Source code in xdsl/dialects/rv64.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
assembly_line_args() -> tuple[AssemblyInstructionArg, ...]
Source code in xdsl/dialects/rv64.py
110 111 | |
ImmShiftOpRV64HasCanonicalizationPatternsTrait
dataclass
Bases: ImmShiftOpHasCanonicalizationPatternsTrait[I64]
Trait for RISC-V 64-bit shift immediate operations with canonicalization patterns.
Source code in xdsl/dialects/rv64.py
114 115 116 117 118 119 | |
SlliOp
dataclass
Bases: RV64RdRsImmShiftOperation
Performs logical left shift on the value in register rs1 by the shift amount held in the 6-bit immediate.
x[rd] = x[rs1] << shamt
See external documentation.
Source code in xdsl/dialects/rv64.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
name = 'rv64.slli'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I64]) -> IntegerAttr[I64]
Source code in xdsl/dialects/rv64.py
135 136 137 | |
SrliOp
dataclass
Bases: RV64RdRsImmShiftOperation
Performs logical right shift on the value in register rs1 by the shift amount held in the 6-bit immediate.
x[rd] = x[rs1] >>u shamt
See external documentation.
Source code in xdsl/dialects/rv64.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
name = 'rv64.srli'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I64]) -> IntegerAttr[I64]
Source code in xdsl/dialects/rv64.py
153 154 155 156 157 | |
BclrIOp
dataclass
Bases: RV64RdRsImmShiftOperation
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/rv64.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
name = 'rv64.bclri'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I64]) -> IntegerAttr[I64]
Source code in xdsl/dialects/rv64.py
172 173 174 | |
BextIOp
dataclass
Bases: RV64RdRsImmShiftOperation
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/rv64.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
name = 'rv64.bexti'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I64]) -> IntegerAttr[I64]
Source code in xdsl/dialects/rv64.py
189 190 191 192 193 | |
BinvIOp
dataclass
Bases: RV64RdRsImmShiftOperation
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/rv64.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
name = 'rv64.binvi'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I64]) -> IntegerAttr[I64]
Source code in xdsl/dialects/rv64.py
208 209 210 | |
BsetIOp
dataclass
Bases: RV64RdRsImmShiftOperation
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/rv64.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
name = 'rv64.bseti'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I64]) -> IntegerAttr[I64]
Source code in xdsl/dialects/rv64.py
225 226 227 | |
RorIOp
dataclass
Bases: RV64RdRsImmShiftOperation
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/rv64.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
name = 'rv64.rori'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I64]) -> IntegerAttr[I64]
Source code in xdsl/dialects/rv64.py
241 242 243 244 245 246 247 248 249 | |
SraiOp
dataclass
Bases: RV64RdRsImmShiftOperation
Performs arithmetic right shift on the value in register rs1 by the shift amount held in the 6-bit immediate.
x[rd] = x[rs1] >>s shamt
See external documentation.
Source code in xdsl/dialects/rv64.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | |
name = 'rv64.srai'
class-attribute
instance-attribute
py_operation(rs1: IntegerAttr[I64]) -> IntegerAttr[I64]
Source code in xdsl/dialects/rv64.py
265 266 267 | |
SlliwOp
dataclass
Bases: RV64RdRsImmShiftOperation
Performs logical left shift on the lower 32 bits of the value in register rs1 by the shift amount held in the immediate (RV64-only instruction). The result is sign-extended to 64 bits.
x[rd] = sext((x[rs1] << shamt)[31:0])
See external documentation.
Source code in xdsl/dialects/rv64.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
name = 'rv64.slliw'
class-attribute
instance-attribute
traits = traits_def(AlwaysSpeculatable())
class-attribute
instance-attribute
SrliwOp
dataclass
Bases: RV64RdRsImmShiftOperation
Performs arithmetic right shift on the 32-bit of value in register rs1 by the shift amount held in the lower 5 bits of the immediate. (RV64-only instruction). The result is sign-extended to 64 bits.
x[rd] = sext((x[rs1] << shamt)[31:0])
See external documentation.
Source code in xdsl/dialects/rv64.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
name = 'rv64.srliw'
class-attribute
instance-attribute
traits = traits_def(AlwaysSpeculatable())
class-attribute
instance-attribute
LdOp
dataclass
Bases: RdRsImmIntegerOperation
Loads a 64-bit value from memory into register rd for RV64I.
x[rd] = M[x[rs1] + sext(offset)][63:0]
See external documentation.
Source code in xdsl/dialects/rv64.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |
name = 'rv64.ld'
class-attribute
instance-attribute
traits = traits_def(MemoryReadEffect())
class-attribute
instance-attribute
assembly_line() -> str | None
Source code in xdsl/dialects/rv64.py
321 322 323 324 325 326 327 328 | |
SdOp
dataclass
Bases: RsRsImmIntegerOperation
Store 64-bit, values from register rs2 to memory.
M[x[rs1] + sext(offset)] = x[rs2][63:0]
See external documentation.
Source code in xdsl/dialects/rv64.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |
name = 'rv64.sd'
class-attribute
instance-attribute
assembly_line() -> str | None
Source code in xdsl/dialects/rv64.py
344 345 346 347 348 349 350 351 | |
GetRegisterOp
dataclass
Bases: GetAnyRegisterOperation[IntRegisterType]
Source code in xdsl/dialects/rv64.py
354 355 356 | |