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.
This commit is contained in:
Dennis Potter 2021-09-12 19:38:09 -07:00
parent 240fba8e12
commit a27b57009b
Signed by: Dennis
GPG Key ID: 186A8AD440942BAF
2 changed files with 3 additions and 3 deletions

View File

@ -100,7 +100,7 @@ module srdl2sv_amba3ahblite
logic [31:0] addr_q; logic [31:0] addr_q;
OP_t operation_q; OP_t operation_q;
wire addr_err = (HADDR % HSIZE) != 0; wire addr_err = (HADDR[2:0] % HSIZE) != 3'b0;
always_ff @ (posedge HCLK) always_ff @ (posedge HCLK)
begin begin

View File

@ -1,6 +1,6 @@
package srdl2sv_if_pkg; package srdl2sv_if_pkg;
typedef struct { typedef struct packed { // .Verilator does not support unpacked structs in packages
logic [31:0] addr; logic [31:0] addr;
logic [31:0] data; logic [31:0] data;
logic w_vld; logic w_vld;
@ -8,7 +8,7 @@ typedef struct {
logic [ 3:0] byte_en; logic [ 3:0] byte_en;
} b2r_t; } b2r_t;
typedef struct { typedef struct packed { // .Verilator does not support unpacked structs in packages
logic [31:0] data; logic [31:0] data;
logic rdy; logic rdy;
logic err; logic err;