Skip to content

Commit

Permalink
Add HPDcache as a possible cache subsystem
Browse files Browse the repository at this point in the history
Signed-off-by: Cesar Fuguet <[email protected]>
  • Loading branch information
cfuguet committed Oct 8, 2023
1 parent f0bd20b commit 013bc22
Show file tree
Hide file tree
Showing 15 changed files with 204 additions and 66 deletions.
6 changes: 3 additions & 3 deletions core/controller.sv
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ module controller import ariane_pkg::*; #(
flush_ex_o = 1'b1;
// this is not needed in the case since we
// have a write-through cache in this case
if (DCACHE_TYPE == int'(cva6_config_pkg::WB)) begin
if (DCACHE_TYPE == int'(config_pkg::WB)) begin
flush_dcache = 1'b1;
fence_active_d = 1'b1;
end
Expand All @@ -103,15 +103,15 @@ module controller import ariane_pkg::*; #(
flush_icache_o = 1'b1;
// this is not needed in the case since we
// have a write-through cache in this case
if (DCACHE_TYPE == int'(cva6_config_pkg::WB)) begin
if (DCACHE_TYPE == int'(config_pkg::WB)) begin
flush_dcache = 1'b1;
fence_active_d = 1'b1;
end
end

// this is not needed in the case since we
// have a write-through cache in this case
if (DCACHE_TYPE == int'(cva6_config_pkg::WB)) begin
if (DCACHE_TYPE == int'(config_pkg::WB)) begin
// wait for the acknowledge here
if (flush_dcache_ack_i && fence_active_q) begin
fence_active_d = 1'b0;
Expand Down
55 changes: 53 additions & 2 deletions core/cva6.sv
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ module cva6 import ariane_pkg::*; #(
dcache_req_ports_cache_acc[1].data_gnt &= !dcache_req_ports_ex_cache[2].data_req;
end

if (DCACHE_TYPE == int'(cva6_config_pkg::WT)) begin : gen_cache_wt
if (DCACHE_TYPE == int'(config_pkg::WT)) begin : gen_cache_wt
// this is a cache subsystem that is compatible with OpenPiton
wt_cache_subsystem #(
.CVA6Cfg ( CVA6ExtendCfg ),
Expand Down Expand Up @@ -970,8 +970,59 @@ module cva6 import ariane_pkg::*; #(
.inval_valid_i ( inval_valid ),
.inval_ready_o ( inval_ready )
);
end else begin : gen_cache_wb
end else if (DCACHE_TYPE == int'(config_pkg::HPDCACHE)) begin : hpdcache_subsystem_gen
cva6_hpdcache_subsystem #(
.CVA6Cfg ( CVA6ExtendCfg ),
.NumPorts ( NumPorts ),
.noc_req_t ( noc_req_t ),
.noc_resp_t ( noc_resp_t ),
.cmo_req_t ( logic /*FIXME*/ ),
.cmo_rsp_t ( logic /*FIXME*/ )
) i_cache_subsystem (
.clk_i ( clk_i ),
.rst_ni ( rst_ni ),

.icache_en_i ( icache_en_csr ),
.icache_flush_i ( icache_flush_ctrl_cache ),
.icache_miss_o ( icache_miss_cache_perf ),
.icache_areq_i ( icache_areq_ex_cache ),
.icache_areq_o ( icache_areq_cache_ex ),
.icache_dreq_i ( icache_dreq_if_cache ),
.icache_dreq_o ( icache_dreq_cache_if ),

.dcache_enable_i ( dcache_en_csr_nbdcache ),
.dcache_flush_i ( dcache_flush_ctrl_cache ),
.dcache_flush_ack_o ( dcache_flush_ack_cache_ctrl ),
.dcache_miss_o ( dcache_miss_cache_perf ),

.dcache_amo_req_i ( amo_req ),
.dcache_amo_resp_o ( amo_resp ),

.dcache_cmo_req_i ( '0/*FIXME*/ ),
.dcache_cmo_resp_o ( /*FIXME*/ ),

.dcache_req_ports_i ( dcache_req_to_cache ),
.dcache_req_ports_o ( dcache_req_from_cache ),

.wbuffer_empty_o ( dcache_commit_wbuffer_empty ),
.wbuffer_not_ni_o ( dcache_commit_wbuffer_not_ni ),

.hwpf_base_set_i ( '0/*FIXME*/ ),
.hwpf_base_i ( '0/*FIXME*/ ),
.hwpf_base_o ( /*FIXME*/ ),
.hwpf_param_set_i ( '0/*FIXME*/ ),
.hwpf_param_i ( '0/*FIXME*/ ),
.hwpf_param_o ( /*FIXME*/ ),
.hwpf_throttle_set_i ( '0/*FIXME*/ ),
.hwpf_throttle_i ( '0/*FIXME*/ ),
.hwpf_throttle_o ( /*FIXME*/ ),
.hwpf_status_o ( /*FIXME*/ ),

.noc_req_o ( noc_req_o ),
.noc_resp_i ( noc_resp_i )
);
assign inval_ready = 1'b1;
end else begin
std_cache_subsystem #(
// note: this only works with one cacheable region
// not as important since this cache subsystem is about to be
Expand Down
2 changes: 1 addition & 1 deletion core/include/ariane_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ package ariane_pkg;
// to longer paths into the commit stage
// if DCACHE_TYPE = cva6_config_pkg::WB
// allocate more space for the commit buffer to be on the save side, this needs to be a power of two
localparam int unsigned DEPTH_COMMIT = (DCACHE_TYPE == int'(cva6_config_pkg::WT)) ? 4 : 8;
localparam int unsigned DEPTH_COMMIT = (DCACHE_TYPE == int'(config_pkg::WT)) ? 4 : 8;

localparam bit FPGA_EN = cva6_config_pkg::CVA6ConfigFPGAEn; // Is FPGA optimization of CV32A6

Expand Down
7 changes: 7 additions & 0 deletions core/include/config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ package config_pkg;
NOC_TYPE_L15_LITTLE_ENDIAN
} noc_type_e;

/// Cache type parameter
typedef enum logic [1:0] {
WB = 0,
WT = 1,
HPDCACHE = 2
} cache_type_t ;

localparam NrMaxRules = 16;

typedef struct packed {
Expand Down
7 changes: 1 addition & 6 deletions core/include/cv32a60x_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

package cva6_config_pkg;

typedef enum logic {
WB = 0,
WT = 1
} cache_type_t ;

localparam CVA6ConfigXlen = 32;

localparam CVA6ConfigFpuEn = 0;
Expand Down Expand Up @@ -71,7 +66,7 @@ package cva6_config_pkg;

localparam CVA6ConfigPerfCounterEn = 0;

localparam CVA6ConfigDcacheType = WT;
localparam config_pkg::cache_type_t CVA6ConfigDcacheType = config_pkg::WT;

localparam CVA6ConfigMmuPresent = 1;

Expand Down
7 changes: 1 addition & 6 deletions core/include/cv32a6_embedded_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@

package cva6_config_pkg;

typedef enum logic {
WB = 0,
WT = 1
} cache_type_t ;

localparam CVA6ConfigXlen = 32;

localparam CVA6ConfigFpuEn = 0;
Expand Down Expand Up @@ -70,7 +65,7 @@ package cva6_config_pkg;

localparam CVA6ConfigPerfCounterEn = 0;

localparam CVA6ConfigDcacheType = WT;
localparam config_pkg::cache_type_t CVA6ConfigDcacheType = config_pkg::WT;

localparam CVA6ConfigMmuPresent = 0;

Expand Down
7 changes: 1 addition & 6 deletions core/include/cv32a6_ima_sv32_fpga_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

package cva6_config_pkg;

typedef enum logic {
WB = 0,
WT = 1
} cache_type_t ;

localparam CVA6ConfigXlen = 32;

localparam CVA6ConfigFpuEn = 0;
Expand Down Expand Up @@ -71,7 +66,7 @@ package cva6_config_pkg;

localparam CVA6ConfigPerfCounterEn = 0;

localparam CVA6ConfigDcacheType = WT;
localparam config_pkg::cache_type_t CVA6ConfigDcacheType = config_pkg::WT;

localparam CVA6ConfigMmuPresent = 1;

Expand Down
7 changes: 1 addition & 6 deletions core/include/cv32a6_imac_sv0_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

package cva6_config_pkg;

typedef enum logic {
WB = 0,
WT = 1
} cache_type_t;

localparam CVA6ConfigXlen = 32;

localparam CVA6ConfigFpuEn = 0;
Expand Down Expand Up @@ -71,7 +66,7 @@ package cva6_config_pkg;

localparam CVA6ConfigPerfCounterEn = 1;

localparam CVA6ConfigDcacheType = WT;
localparam config_pkg::cache_type_t CVA6ConfigDcacheType = config_pkg::WT;

localparam CVA6ConfigMmuPresent = 1;

Expand Down
7 changes: 1 addition & 6 deletions core/include/cv32a6_imac_sv32_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

package cva6_config_pkg;

typedef enum logic {
WB = 0,
WT = 1
} cache_type_t ;

localparam CVA6ConfigXlen = 32;

localparam CVA6ConfigFpuEn = 0;
Expand Down Expand Up @@ -71,7 +66,7 @@ package cva6_config_pkg;

localparam CVA6ConfigPerfCounterEn = 1;

localparam CVA6ConfigDcacheType = WT;
localparam config_pkg::cache_type_t CVA6ConfigDcacheType = config_pkg::WT;

localparam CVA6ConfigMmuPresent = 1;

Expand Down
7 changes: 1 addition & 6 deletions core/include/cv32a6_imafc_sv32_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

package cva6_config_pkg;

typedef enum logic {
WB = 0,
WT = 1
} cache_type_t ;

localparam CVA6ConfigXlen = 32;

localparam CVA6ConfigFpuEn = 1;
Expand Down Expand Up @@ -71,7 +66,7 @@ package cva6_config_pkg;

localparam CVA6ConfigPerfCounterEn = 1;

localparam CVA6ConfigDcacheType = WB;
localparam config_pkg::cache_type_t CVA6ConfigDcacheType = config_pkg::WB;

localparam CVA6ConfigMmuPresent = 1;

Expand Down
7 changes: 1 addition & 6 deletions core/include/cv64a6_imadfcv_sv39_polara_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

package cva6_config_pkg;

typedef enum logic {
WB = 0,
WT = 1
} cache_type_t ;

localparam CVA6ConfigXlen = 64;

localparam CVA6ConfigFpuEn = 1;
Expand Down Expand Up @@ -70,7 +65,7 @@ package cva6_config_pkg;

localparam CVA6ConfigPerfCounterEn = 1;

localparam cache_type_t CVA6ConfigDcacheType = WT;
localparam config_pkg::cache_type_t CVA6ConfigDcacheType = config_pkg::WT;

localparam CVA6ConfigMmuPresent = 1;

Expand Down
7 changes: 1 addition & 6 deletions core/include/cv64a6_imafdc_sv39_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

package cva6_config_pkg;

typedef enum logic {
WB = 0,
WT = 1
} cache_type_t ;

localparam CVA6ConfigXlen = 64;

localparam CVA6ConfigFpuEn = 1;
Expand Down Expand Up @@ -71,7 +66,7 @@ package cva6_config_pkg;

localparam CVA6ConfigPerfCounterEn = 1;

localparam CVA6ConfigDcacheType = WT;
localparam config_pkg::cache_type_t CVA6ConfigDcacheType = config_pkg::WT;

localparam CVA6ConfigMmuPresent = 1;

Expand Down
Loading

0 comments on commit 013bc22

Please sign in to comment.