Skip to content

Commit

Permalink
Fix data width warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cfuguet committed Nov 1, 2024
1 parent 59e290e commit 1b14a1d
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
4 changes: 3 additions & 1 deletion rtl/src/common/hpdcache_mux.sv
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ module hpdcache_mux
);
// }}}

typedef int unsigned uint32;

if (NINPUT == 1) begin : gen_single_input
assign data_o = data_i[0];

Expand All @@ -74,7 +76,7 @@ module hpdcache_mux
begin : data_out_mux_comb
data_o = '0;
for (int unsigned i = 0; i < NINPUT; i++) begin
data_o |= (i == unsigned'(sel_i)) ? data_i[i] : '0;
data_o |= (i == uint32'(sel_i)) ? data_i[i] : '0;
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion rtl/src/hpdcache_core_arbiter.sv
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ import hpdcache_pkg::*;
always_comb
begin : resp_demux
for (int unsigned i = 0; i < HPDcacheCfg.u.nRequesters; i++) begin
core_rsp_valid_o[i] = core_rsp_valid_i && (i == unsigned'(core_rsp_i.sid));
core_rsp_valid_o[i] = core_rsp_valid_i && (i == hpdcache_uint32'(core_rsp_i.sid));
core_rsp_o[i] = core_rsp_i;
end
end
Expand Down
4 changes: 2 additions & 2 deletions rtl/src/hpdcache_flush.sv
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ import hpdcache_pkg::*;

// FIFO for memory request metadata
//
localparam int unsigned MemReqFlits = HPDcacheCfg.u.memDataWidth < HPDcacheCfg.clWidth ?
localparam hpdcache_uint32 MemReqFlits = HPDcacheCfg.u.memDataWidth < HPDcacheCfg.clWidth ?
(HPDcacheCfg.clWidth / HPDcacheCfg.u.memDataWidth) - 1 : 0;

assign flush_mem_req_wmeta = '{
Expand Down Expand Up @@ -353,7 +353,7 @@ import hpdcache_pkg::*;
//
hpdcache_mem_len_t write_flits_cnt_q;

assign flush_mem_req_rlast = (write_flits_cnt_q == MemReqFlits);
assign flush_mem_req_rlast = (hpdcache_uint32'(write_flits_cnt_q) == MemReqFlits);

always_ff @(posedge clk_i or negedge rst_ni)
begin
Expand Down
12 changes: 6 additions & 6 deletions rtl/src/hpdcache_mshr.sv
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ import hpdcache_pkg::*;

found_available_way = 0;
for (int unsigned i = 0; i < HPDcacheCfg.u.mshrWays; i++) begin
if (!mshr_valid_q[i*HPDcacheCfg.u.mshrSets + unsigned'(alloc_set)]) begin
if (!mshr_valid_q[i*HPDcacheCfg.u.mshrSets + hpdcache_uint32'(alloc_set)]) begin
found_available_way = mshr_way_t'(i);
break;
end
Expand All @@ -175,7 +175,7 @@ import hpdcache_pkg::*;

found_available = 1'b0;
for (int unsigned i = 0; i < HPDcacheCfg.u.mshrWays; i++) begin
if (!mshr_valid_q[i*HPDcacheCfg.u.mshrSets + unsigned'(check_set_st1)]) begin
if (!mshr_valid_q[i*HPDcacheCfg.u.mshrSets + hpdcache_uint32'(check_set_st1)]) begin
found_available = 1'b1;
break;
end
Expand Down Expand Up @@ -260,8 +260,8 @@ import hpdcache_pkg::*;
automatic bit v_valid;
automatic bit v_match_set;
automatic bit v_match_tag;
v_valid = mshr_valid_q[w*HPDcacheCfg.u.mshrSets + unsigned'(check_set_st1)];
v_match_set = (mshr_cache_set_q[w*HPDcacheCfg.u.mshrSets + unsigned'(check_set_st1)] ==
v_valid = mshr_valid_q[w*HPDcacheCfg.u.mshrSets + hpdcache_uint32'(check_set_st1)];
v_match_set = (mshr_cache_set_q[w*HPDcacheCfg.u.mshrSets + hpdcache_uint32'(check_set_st1)] ==
check_cache_set_q);
v_match_tag = (mshr_rentry[w].tag == check_tag_i);
v_hit_way[w] = (v_valid && v_match_tag && v_match_set);
Expand Down Expand Up @@ -297,7 +297,7 @@ import hpdcache_pkg::*;
always_comb
begin : mshr_wbyteenable_comb
for (int unsigned i = 0; i < HPDcacheCfg.u.mshrWays; i++) begin
mshr_wbyteenable[i] = (unsigned'(alloc_way_o) == i) ? '1 : '0;
mshr_wbyteenable[i] = (hpdcache_uint32'(alloc_way_o) == i) ? '1 : '0;
end
end

Expand Down Expand Up @@ -338,7 +338,7 @@ import hpdcache_pkg::*;
always_comb
begin : mshr_wmask_comb
for (int unsigned i = 0; i < HPDcacheCfg.u.mshrWays; i++) begin
mshr_wmask[i] = (unsigned'(alloc_way_o) == i) ? '1 : '0;
mshr_wmask[i] = (hpdcache_uint32'(alloc_way_o) == i) ? '1 : '0;
end
end

Expand Down
8 changes: 4 additions & 4 deletions rtl/src/hpdcache_wbuf.sv
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ import hpdcache_pkg::*;
always_comb
begin : wbuf_write_be_comb
for (int unsigned w = 0; w < WBUF_DATA_NWORDS; w++) begin
if (w == unsigned'(write_addr_i[WBUF_OFFSET_WIDTH-1:WBUF_WORD_OFFSET])) begin
if (w == hpdcache_uint32'(write_addr_i[WBUF_OFFSET_WIDTH-1:WBUF_WORD_OFFSET])) begin
write_be[w] = write_be_i;
end else begin
write_be[w] = '0;
Expand Down Expand Up @@ -485,7 +485,7 @@ import hpdcache_pkg::*;
end

WBUF_OPEN: begin
match_open_ptr = (i == unsigned'(wbuf_write_hit_open_dir_ptr));
match_open_ptr = (i == hpdcache_uint32'(wbuf_write_hit_open_dir_ptr));
timeout = (wbuf_dir_q[i].cnt == (cfg_threshold_i - 1));
read_hit = read_flush_hit_i & wbuf_write_hit_open & match_open_ptr;
write_hit = write_i
Expand Down Expand Up @@ -521,7 +521,7 @@ import hpdcache_pkg::*;
end

WBUF_PEND: begin
match_pend_ptr = (i == unsigned'(wbuf_write_hit_pend_dir_ptr));
match_pend_ptr = (i == hpdcache_uint32'(wbuf_write_hit_pend_dir_ptr));
write_hit = write_i
& wbuf_write_hit_pend
& match_pend_ptr
Expand All @@ -544,7 +544,7 @@ import hpdcache_pkg::*;
end

WBUF_SENT: begin
if (mem_resp_write_valid_i && (i == unsigned'(ack_id))) begin
if (mem_resp_write_valid_i && (i == hpdcache_uint32'(ack_id))) begin
wbuf_dir_state_d[i] = WBUF_FREE;
end
end
Expand Down
2 changes: 1 addition & 1 deletion rtl/src/hwpf_stride/hwpf_stride_arb.sv
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ import hpdcache_pkg::*;
always_comb
begin : resp_demux
for (int unsigned i = 0; i < NUM_HW_PREFETCH; i++) begin
hwpf_stride_rsp_valid_o[i] = hpdcache_rsp_valid_i && (i == unsigned'(hpdcache_rsp_i.tid));
hwpf_stride_rsp_valid_o[i] = hpdcache_rsp_valid_i && (i == hpdcache_uint32'(hpdcache_rsp_i.tid));
hwpf_stride_rsp_o[i] = hpdcache_rsp_i;
end
end
Expand Down
4 changes: 2 additions & 2 deletions rtl/src/utils/hpdcache_to_l15.sv
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ module hpdcache_to_l15 import hpdcache_pkg::*; import wt_cache_pkg::*;
always_comb
begin: lzc_comb
first_one_pos = '0;
for (int unsigned i = unsigned'(HPDcacheMemDataWidth/8); i > 0; i--) begin
for (int unsigned i = hpdcache_uint32'(HPDcacheMemDataWidth/8); i > 0; i--) begin
if (req_wbe[i-1]) begin
first_one_pos = i-1;
break;
Expand Down Expand Up @@ -454,4 +454,4 @@ module hpdcache_to_l15 import hpdcache_pkg::*; import wt_cache_pkg::*;
initial assert (NUM_THREAD_IDS == (hpdcache_pkg::HPDCACHE_MSHR_SETS * hpdcache_pkg::HPDCACHE_MSHR_WAYS)) else
$error("The number of thread ids should be equal to the number of MSHRs of the D$");
// }}}
endmodule
endmodule

0 comments on commit 1b14a1d

Please sign in to comment.