Skip to content

Commit

Permalink
[difftest] refactor unused check, add some path
Browse files Browse the repository at this point in the history
  • Loading branch information
Clo91eaf committed Jul 17, 2024
1 parent e79b73b commit 4cf9ba4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions difftest/online_drive/src/dpi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,16 @@ unsafe fn load_from_payload(
let strobe = &byte_vec[0..strb_width_in_byte];
let data = &byte_vec[strb_width_in_byte..];

let masks: Vec<bool> = strobe
let mut masks: Vec<bool> = strobe
.into_iter()
.flat_map(|strb| {
let mask: Vec<bool> = (0..8).map(|i| (strb & (1 << i)) != 0).collect();
mask
})
.collect();
if masks.len() == 0 {
masks.push(true);
}
assert!(
masks.len() == data.len(),
"strobe bit width is not aligned with data byte width"
Expand Down Expand Up @@ -197,7 +200,7 @@ unsafe extern "C" fn axi_write_indexedAccessPort_rs(
payload: *const SvBitVecVal,
) {
debug!(
"axi_write_indexed (channel_id={channel_id}, awid={awid}, awaddr={awaddr}, \
"axi_write_indexed (channel_id={channel_id}, awid={awid}, awaddr={awaddr:#x}, \
awlen={awlen}, awsize={awsize}, awburst={awburst}, awlock={awlock}, awcache={awcache}, \
awprot={awprot}, awqos={awqos}, awregion={awregion})"
);
Expand Down
6 changes: 3 additions & 3 deletions difftest/online_drive/src/drive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl Driver {
fn read_mem(&mut self, addr: u32, size: u32, alignment_bytes: u32) -> Vec<u8> {
assert!(
addr % size == 0 || addr % alignment_bytes == 0,
"unaligned access addr={addr} size={size}bytes dlen={alignment_bytes}bytes"
"unaligned access addr={addr:#x} size={size}bytes dlen={alignment_bytes}bytes"
);
let residue_addr = addr % alignment_bytes;
let aligned_addr = addr - residue_addr;
Expand Down Expand Up @@ -139,8 +139,8 @@ impl Driver {
debug!("write mem: size={size}, addr={addr:#x}");

assert!(
(addr % size == 0 || addr % alignment_bytes == 0) && size >= alignment_bytes,
"unaligned write access addr={addr} size={size}bytes dlen={alignment_bytes}bytes"
addr % size == 0 || addr % alignment_bytes == 0,
"unaligned write access addr={addr:#x} size={size}bytes dlen={alignment_bytes}bytes"
);

masks.iter().enumerate().filter(|(_, &m)| m).for_each(|(i, _)| {
Expand Down

0 comments on commit 4cf9ba4

Please sign in to comment.