Decode the FOp mnemonic with format suffix (.s/.d).
(funct5: u8, fmt: u8)
| 331 | 5 => "csrrwi", |
| 332 | 6 => "csrrsi", |
| 333 | 7 => "csrrci", |
| 334 | _ => "csr??", |
| 335 | }, |
| 336 | Self::FLoad { funct3, .. } => { |
| 337 | if *funct3 == 2 { |
| 338 | "flw" |
| 339 | } else { |
| 340 | "fld" |
| 341 | } |
| 342 | } |
| 343 | Self::FStore { funct3, .. } => { |
| 344 | if *funct3 == 2 { |
| 345 | "fsw" |
| 346 | } else { |
| 347 | "fsd" |
| 348 | } |
| 349 | } |
| 350 | Self::FOp { .. } => "f.op", |
| 351 | Self::FMac { op, .. } => match op { |
| 352 | FMacOp::Fmadd => "fmadd", |
| 353 | FMacOp::Fmsub => "fmsub", |
| 354 | FMacOp::Fnmsub => "fnmsub", |
| 355 | FMacOp::Fnmadd => "fnmadd", |
| 356 | }, |
| 357 | Self::Atomic { funct5, .. } => match funct5 { |
| 358 | 2 => "lr.w", |
| 359 | 3 => "sc.w", |
| 360 | 1 => "amoswap", |
| 361 | 0 => "amoadd", |
| 362 | 4 => "amoxor", |
| 363 | 8 => "amoor", |
| 364 | 12 => "amoand", |
| 365 | 16 => "amomin", |
| 366 | 20 => "amomax", |
| 367 | 24 => "amominu", |
| 368 | 28 => "amomaxu", |
| 369 | _ => "amo??", |
| 370 | }, |
| 371 | } |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | // --- ABI register names for disassembly --- |
| 376 | |
| 377 | fn reg_name(r: usize) -> &'static str { |
| 378 | integer_register_name(r).unwrap_or("??") |
| 379 | } |
| 380 | |
| 381 | fn freg_name(r: usize) -> &'static str { |
| 382 | float_register_name(r).unwrap_or("f??") |
| 383 | } |
| 384 | |
| 385 | impl std::fmt::Display for DecodedInsn { |
| 386 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 387 | match self { |
| 388 | Self::Lui { rd, imm } => { |
| 389 | write!( |
| 390 | f, |
nothing calls this directly
no outgoing calls
no test coverage detected