mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
commit renode changes
This commit is contained in:
parent
0bad1ad755
commit
c880eda822
2 changed files with 18 additions and 2 deletions
|
|
@ -52,6 +52,8 @@ impl Scalar {
|
||||||
let mut x_u64 = [0u64; 5];
|
let mut x_u64 = [0u64; 5];
|
||||||
LittleEndian::read_u64_into(&self.bytes, &mut x_u64[0..4]);
|
LittleEndian::read_u64_into(&self.bytes, &mut x_u64[0..4]);
|
||||||
|
|
||||||
|
log::info!("x_u64: {:x?}", x_u64);
|
||||||
|
|
||||||
let width = 1 << w;
|
let width = 1 << w;
|
||||||
let window_mask = width - 1;
|
let window_mask = width - 1;
|
||||||
|
|
||||||
|
|
@ -66,7 +68,14 @@ impl Scalar {
|
||||||
let bit_buf: u64;
|
let bit_buf: u64;
|
||||||
if bit_idx < 64 - w {
|
if bit_idx < 64 - w {
|
||||||
// This window's bits are contained in a single u64
|
// This window's bits are contained in a single u64
|
||||||
bit_buf = x_u64[u64_idx] >> bit_idx;
|
/*
|
||||||
|
let mut lower = x_u64[u64_idx] as u32;
|
||||||
|
let upper = (x_u64[u64_idx] >> 32) as u32;
|
||||||
|
lower >>= bit_idx;
|
||||||
|
lower |= upper << (32 - bit_idx);
|
||||||
|
bit_buf = ((upper >> bit_idx) as u64) << 32 | lower as u64;*/
|
||||||
|
bit_buf = x_u64[u64_idx] >> bit_idx; /////////////////////////////// <----------- culprit
|
||||||
|
log::info!("bit_buf: {:x}", bit_buf);
|
||||||
} else {
|
} else {
|
||||||
// Combine the current u64's bits with the bits from the next u64
|
// Combine the current u64's bits with the bits from the next u64
|
||||||
bit_buf = (x_u64[u64_idx] >> bit_idx) | (x_u64[1+u64_idx] << (64 - bit_idx));
|
bit_buf = (x_u64[u64_idx] >> bit_idx) | (x_u64[1+u64_idx] << (64 - bit_idx));
|
||||||
|
|
@ -85,9 +94,15 @@ impl Scalar {
|
||||||
}
|
}
|
||||||
|
|
||||||
if window < width/2 {
|
if window < width/2 {
|
||||||
|
log::info!("carry 0 width {} naf[{}] = {}; c.{} bb.{:x} wm.{} idx64.{} idxbit.{} xu64[0].{:x}", width, pos, window,
|
||||||
|
carry, bit_buf, window_mask, u64_idx, bit_idx, x_u64[0],
|
||||||
|
);
|
||||||
carry = 0;
|
carry = 0;
|
||||||
naf[pos] = window as i8;
|
naf[pos] = window as i8;
|
||||||
} else {
|
} else {
|
||||||
|
log::info!("carry 1 width {} naf[{}] = {}/{}; c.{} bb.{:x} wm.{} idx64.{} idxbit.{} xu64[0].{:x}", width, pos, window, (window as i8).wrapping_sub(width as i8),
|
||||||
|
carry, bit_buf, window_mask, u64_idx, bit_idx, x_u64[0]
|
||||||
|
);
|
||||||
carry = 1;
|
carry = 1;
|
||||||
naf[pos] = (window as i8).wrapping_sub(width as i8);
|
naf[pos] = (window as i8).wrapping_sub(width as i8);
|
||||||
}
|
}
|
||||||
|
|
@ -99,6 +114,7 @@ impl Scalar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// see https://godbolt.org/z/K8MK1v6f9 for the compiler explorer version of this
|
||||||
#[xous::xous_main]
|
#[xous::xous_main]
|
||||||
fn xmain() -> ! {
|
fn xmain() -> ! {
|
||||||
log_server::init_wait().unwrap();
|
log_server::init_wait().unwrap();
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ fn try_main() -> Result<(), DynError> {
|
||||||
let mut args = env::args();
|
let mut args = env::args();
|
||||||
let task = args.nth(1);
|
let task = args.nth(1);
|
||||||
match task.as_deref() {
|
match task.as_deref() {
|
||||||
Some("renode-image") => renode_image(false, &hw_pkgs)?,
|
Some("renode-image") => renode_image(false, &minimal_pkgs)?,
|
||||||
Some("renode-test") => renode_image(false, &cbtest_pkgs)?,
|
Some("renode-test") => renode_image(false, &cbtest_pkgs)?,
|
||||||
Some("libstd-test") => renode_image_extra(false, &base_pkgs, args.collect())?,
|
Some("libstd-test") => renode_image_extra(false, &base_pkgs, args.collect())?,
|
||||||
Some("renode-aes-test") => renode_image(false, &aestest_pkgs)?,
|
Some("renode-aes-test") => renode_image(false, &aestest_pkgs)?,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue