cache_ctrl: Generalise AXI offset generation (#2573)

For `XLEN = 64`, some tools (e.g. VCS) still elaborate the offset generation block for `XLEN = 32`, throwing an elaboration error (illegal bit access). Fix this by generating the AXI offset in an equivalent, parameter-agnostic and tool-friendly way.
This commit is contained in:
Nils Wistoff 2024-11-04 19:24:57 +11:00 committed by GitHub
parent 9e670f64c6
commit aeb0b646bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -117,7 +117,8 @@ module cache_ctrl
// cache-line offset -> multiple of XLEN // cache-line offset -> multiple of XLEN
cl_offset = mem_req_q.index[CVA6Cfg.DCACHE_OFFSET_WIDTH-1:$clog2(CVA6Cfg.XLEN/8)] << cl_offset = mem_req_q.index[CVA6Cfg.DCACHE_OFFSET_WIDTH-1:$clog2(CVA6Cfg.XLEN/8)] <<
$clog2(CVA6Cfg.XLEN); // shift by log2(XLEN) to the left $clog2(CVA6Cfg.XLEN); // shift by log2(XLEN) to the left
axi_offset = '0; // XLEN offset within AXI request
axi_offset = (mem_req_q.index >> $clog2(CVA6Cfg.XLEN / 8)) << $clog2(CVA6Cfg.XLEN);
// default assignments // default assignments
state_d = state_q; state_d = state_q;
mem_req_d = mem_req_q; mem_req_d = mem_req_q;
@ -138,11 +139,6 @@ module cache_ctrl
mem_req_d.killed |= req_port_i.kill_req; mem_req_d.killed |= req_port_i.kill_req;
if (CVA6Cfg.XLEN == 32) begin
axi_offset = mem_req_q.index[$clog2(CVA6Cfg.AxiDataWidth/8)-1:$clog2(CVA6Cfg.XLEN/8)] <<
$clog2(CVA6Cfg.XLEN);
end
case (state_q) case (state_q)
IDLE: begin IDLE: begin