Skip to content

Commit

Permalink
Fix formula to compute the ways per ram parameter of the hpdcache
Browse files Browse the repository at this point in the history
Signed-off-by: Cesar Fuguet <[email protected]>
  • Loading branch information
Cesar Fuguet committed Jan 30, 2024
1 parent ca8a3c0 commit 3416a5c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions core/include/cva6_hpdcache_default_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,19 @@ package hpdcache_params_pkg;
import cva6_config_pkg::CVA6ConfigNrLoadBufEntries;
// }}}

// Definition of constants used only in this file
// Definition of constants and functions used only in this file
// {{{
localparam int unsigned __BYTES_PER_WAY = CVA6ConfigDcacheByteSize / CVA6ConfigDcacheSetAssoc;

localparam int unsigned __BYTES_PER_CACHELINE = CVA6ConfigDcacheLineWidth / 8;
localparam int unsigned __MAX_RAM_WORD_BITS = 128;

function int unsigned __minu(int unsigned x, int unsigned y);
return x < y ? x : y;
endfunction

function int unsigned __maxu(int unsigned x, int unsigned y);
return y < x ? x : y;
endfunction
// }}}

// Definition of global constants for the HPDcache data and directory
Expand Down Expand Up @@ -61,7 +69,9 @@ package hpdcache_params_pkg;

// Definition of constants and types for HPDcache data memory
// {{{
localparam int unsigned PARAM_DATA_WAYS_PER_RAM_WORD = 128 / PARAM_WORD_WIDTH;
localparam int unsigned PARAM_DATA_WAYS_PER_RAM_WORD =
__minu(__MAX_RAM_WORD_BITS / PARAM_WORD_WIDTH, PARAM_WAYS);

localparam int unsigned PARAM_DATA_SETS_PER_RAM = PARAM_SETS;

// HPDcache DATA RAM macros whether implements:
Expand Down

0 comments on commit 3416a5c

Please sign in to comment.