MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / parse_csr_rmw

Function parse_csr_rmw

crates/asm-to-binary/src/assembler/parser.rs:619–634  ·  view source on GitHub ↗

Parse `rd, csr, rs1` for the full CSR read-modify-write instructions.

(mnemonic: &str, operands: &str)

Source from the content-addressed store, hash-verified

617 })
618}
619
620// Parse `rs, label` for a zero-register branch (`beqz`/`bnez`).
621// Expands to `beq/bne rs, x0, label`.
622fn parse_branch_zero(kind: BranchKind, operands: &str) -> Option<AsmToken> {
623 let comma = operands.find(',')?;
624 let rs1 = parse_int_reg(operands[..comma].trim())?;
625 let target = operands[comma + 1..].trim().to_owned();
626 if target.is_empty() {
627 return None;
628 }
629 Some(AsmToken::Branch {
630 kind,
631 rs1,
632 rs2: 0,
633 target,
634 })
635}
636
637// Map a CSR name or numeric literal to its 12-bit address.

Callers 1

parse_instruction_lineFunction · 0.85

Calls 3

parse_int_regFunction · 0.85
parse_csr_nameFunction · 0.85
collectMethod · 0.80

Tested by

no test coverage detected