(
symbol: &str,
symbols: &super::symbol_table::SymbolTable,
section_bases: &std::collections::HashMap<SectionKind, u64>,
)
| 318 | } |
| 319 | if !(-4096..=4094).contains(&offset) { |
| 320 | return Err(AssemblerError::new(format!( |
| 321 | "branch to `{target}` offset {offset} out of B-type range [-4096, 4094]" |
| 322 | ))); |
| 323 | } |
| 324 | let off = offset as i32; |
| 325 | |
| 326 | let inst: RealInstruction = match kind { |
| 327 | BranchKind::Beq => RealInstruction::Beq(Beq::new(rs1, rs2, off)), |
| 328 | BranchKind::Bne => RealInstruction::Bne(Bne::new(rs1, rs2, off)), |
| 329 | BranchKind::Blt => RealInstruction::Blt(Blt::new(rs1, rs2, off)), |
| 330 | BranchKind::Bge => RealInstruction::Bge(Bge::new(rs1, rs2, off)), |
| 331 | BranchKind::Bltu => RealInstruction::Bltu(Bltu::new(rs1, rs2, off)), |
| 332 | BranchKind::Bgeu => RealInstruction::Bgeu(Bgeu::new(rs1, rs2, off)), |
| 333 | }; |
| 334 | Ok(inst.encode()) |
| 335 | } |
| 336 | |
| 337 | fn encode_jal( |
| 338 | rd: u8, |
no test coverage detected