Make macros for R/I-type operations and use them to implement basically every single one i think

This commit is contained in:
2025-12-26 18:14:32 +01:00
parent 75e843f5f9
commit 34034dd5db
5 changed files with 145 additions and 113 deletions

View File

@@ -85,15 +85,10 @@ impl Instruction {
imm_20 | imm_10_1 | imm_11 | imm_19_12
}
// The following are AFAIK only used for shift by immediate operations
/// Technically part of immediate. Only used to determine shift type for immediate shifts afaik
/// 32bit ones use funct7 in this way
#[inline]
pub fn funct6(self) -> u8 {
(self.0 >> 26 & 0x3f) as u8
}
#[inline]
pub fn imm_shamt(self) -> usize {
(self.0 >> 20 & 0x3f) as usize
}
}