Implement SLLI and fix sign extension of immediates for I-type and S-type instructions
This commit is contained in:
@@ -52,12 +52,12 @@ impl Instruction {
|
||||
|
||||
#[inline]
|
||||
pub fn imm_i(self) -> DWord {
|
||||
(self.0 as i64 >> 20) as DWord
|
||||
(self.0 as i32 as i64 >> 20) as DWord
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn imm_s(self) -> DWord {
|
||||
(self.0 as i64 >> (25 - 5) & (0x7f << 5)) as DWord | (self.0 >> 7 & 0b1111) as DWord
|
||||
(self.0 as i32 as i64 >> (25 - 5) & (0x7f << 5)) as DWord | (self.0 >> 7 & 0b1111) as DWord
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -88,12 +88,12 @@ impl Instruction {
|
||||
// The following are AFAIK only used for shift by immediate operations
|
||||
|
||||
#[inline]
|
||||
fn funct6(self) -> u8 {
|
||||
pub fn funct6(self) -> u8 {
|
||||
(self.0 >> 26 & 0x3f) as u8
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn imm_shamt(self) -> usize {
|
||||
pub fn imm_shamt(self) -> usize {
|
||||
(self.0 >> 20 & 0x3f) as usize
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user