From a27b57009b390ffd648ee78e6b0977d466045ce2 Mon Sep 17 00:00:00 2001 From: Dennis Date: Sun, 12 Sep 2021 19:38:09 -0700 Subject: [PATCH] Fix two issues to get AMBA widget compile clean under Verilator The former issue was a Lint warning. HADDR % HSIZE is a modulo operation of a 32-bit and 3-bit variable. It is cleaner to only use the LSB of HADDR. Furthermore, Verilator does not support unpacked arrays in packages. --- srdl2sv/components/widgets/srdl2sv_amba3ahblite.sv | 2 +- srdl2sv/components/widgets/srdl2sv_if_pkg.sv | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/srdl2sv/components/widgets/srdl2sv_amba3ahblite.sv b/srdl2sv/components/widgets/srdl2sv_amba3ahblite.sv index e937e27..47bff9f 100644 --- a/srdl2sv/components/widgets/srdl2sv_amba3ahblite.sv +++ b/srdl2sv/components/widgets/srdl2sv_amba3ahblite.sv @@ -100,7 +100,7 @@ module srdl2sv_amba3ahblite logic [31:0] addr_q; OP_t operation_q; - wire addr_err = (HADDR % HSIZE) != 0; + wire addr_err = (HADDR[2:0] % HSIZE) != 3'b0; always_ff @ (posedge HCLK) begin diff --git a/srdl2sv/components/widgets/srdl2sv_if_pkg.sv b/srdl2sv/components/widgets/srdl2sv_if_pkg.sv index afa1bf7..0b80d0a 100644 --- a/srdl2sv/components/widgets/srdl2sv_if_pkg.sv +++ b/srdl2sv/components/widgets/srdl2sv_if_pkg.sv @@ -1,6 +1,6 @@ package srdl2sv_if_pkg; -typedef struct { +typedef struct packed { // .Verilator does not support unpacked structs in packages logic [31:0] addr; logic [31:0] data; logic w_vld; @@ -8,7 +8,7 @@ typedef struct { logic [ 3:0] byte_en; } b2r_t; -typedef struct { +typedef struct packed { // .Verilator does not support unpacked structs in packages logic [31:0] data; logic rdy; logic err;