From ec8678ca07947f479a4ddeb61627bfe521a36a71 Mon Sep 17 00:00:00 2001 From: Clo91eaf Date: Sat, 17 Aug 2024 15:13:35 +0800 Subject: [PATCH] [t1rocket] fix wrong bus_size --- t1rocketemu/online_dpi/src/drive.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/t1rocketemu/online_dpi/src/drive.rs b/t1rocketemu/online_dpi/src/drive.rs index 4844810e0f..37ffbc9bb0 100644 --- a/t1rocketemu/online_dpi/src/drive.rs +++ b/t1rocketemu/online_dpi/src/drive.rs @@ -82,8 +82,9 @@ impl ShadowMem { let addr_align = addr & ((!bus_size) + 1); let bus_size = bus_size as usize; - assert_eq!(bus_size, masks.len()); - assert_eq!(bus_size, data.len()); + // should not check this, in scalar narrow write, bus_size is not equal to data.len() + // assert_eq!(bus_size, masks.len()); + // assert_eq!(bus_size, data.len()); for i in 0..bus_size { if masks[i] { @@ -336,7 +337,8 @@ impl Driver { data: &[u8], ) { let size = 1 << awsize; - self.shadow_mem.write_mem_axi(addr, size, 32, strobe, data); + let bus_size = if size == 32 { 32 } else { 4 }; + self.shadow_mem.write_mem_axi(addr, size, bus_size, strobe, data); let data_hex = hex::encode(data); self.last_commit_cycle = get_t();