Skip to content

Commit

Permalink
Debugging float operations
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jul 1, 2021
1 parent 09331d4 commit 9c17a9b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
15 changes: 0 additions & 15 deletions src/data/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ use amplify::num::{u1024, u256, u512};
use half::bf16;
use rustc_apfloat::{ieee, Float};

use crate::reg::RegisterFamily;

/// Trait of different number layouts
pub trait NumberLayout: Copy {
/// Returns how many bits are used by the layout
Expand Down Expand Up @@ -535,19 +533,6 @@ impl Number {
zero
}

#[doc(hidden)]
/// Constructs number representation from a slice taken directly from the register
///
/// Panics if the slice length does not match the registry format. Should be used only
/// internally; for construction numbers from the values coming not from the registers use
/// [`Number::with_layout`] method.
#[inline]
pub(crate) fn with_reg(slice: impl AsRef<[u8]>, reg: impl RegisterFamily) -> Number {
let mut me = Number::from_slice(slice);
me.layout = reg.layout();
me
}

/// Constructs number representation from a slice and a given layout.
///
/// Fails returning `None` if the length of slice does not match the required layout byte
Expand Down
16 changes: 8 additions & 8 deletions src/reg/core_regs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,14 @@ impl CoreRegs {
},

RegAFR::F(f) => match f {
RegF::F16B => self.r128[index].map(|slice| Number::with_reg(slice, f)),
RegF::F16 => self.r128[index].map(|slice| Number::with_reg(slice, f)),
RegF::F32 => self.r128[index].map(|slice| Number::with_reg(slice, f)),
RegF::F64 => self.r128[index].map(|slice| Number::with_reg(slice, f)),
RegF::F80 => self.r128[index].map(|slice| Number::with_reg(slice, f)),
RegF::F128 => self.r128[index].map(|slice| Number::with_reg(slice, f)),
RegF::F256 => self.r128[index].map(|slice| Number::with_reg(slice, f)),
RegF::F512 => self.r128[index].map(|slice| Number::with_reg(slice, f)),
RegF::F16B => self.f16b[index].map(Number::from),
RegF::F16 => self.f16[index].map(Number::from),
RegF::F32 => self.f32[index].map(Number::from),
RegF::F64 => self.f64[index].map(Number::from),
RegF::F80 => self.f80[index].map(Number::from),
RegF::F128 => self.f128[index].map(Number::from),
RegF::F256 => self.f256[index].map(Number::from),
RegF::F512 => self.f512[index].map(Number::from),
},
}
.into()
Expand Down
1 change: 1 addition & 0 deletions src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

//! Alu virtual machine
use alloc::boxed::Box;
use alloc::collections::BTreeMap;

use crate::isa::{InstructionSet, ReservedOp};
Expand Down

0 comments on commit 9c17a9b

Please sign in to comment.