diff --git a/core/csr_regfile.sv b/core/csr_regfile.sv index e5cf84dcf3..2deddd70a0 100644 --- a/core/csr_regfile.sv +++ b/core/csr_regfile.sv @@ -2692,7 +2692,9 @@ module csr_regfile pmpcfg_next[i] = pmpcfg_q[i]; end if (!CVA6Cfg.PMPEntryReadOnly[i]) begin - pmpaddr_next[i] = pmpaddr_d[i]; + if (pmpcfg_q[i].addr_mode == riscv::OFF | pmpcfg_q[i].addr_mode == riscv::TOR) + pmpaddr_next[i] = {pmpaddr_d[i][31:CVA6Cfg.PMPG], {CVA6Cfg.PMPG{1'b0}}}; + else pmpaddr_next[i] = pmpaddr_d[i]; end else begin pmpaddr_next[i] = pmpaddr_q[i]; end diff --git a/core/include/build_config_pkg.sv b/core/include/build_config_pkg.sv index 5c42e5f305..c7a1b591ce 100644 --- a/core/include/build_config_pkg.sv +++ b/core/include/build_config_pkg.sv @@ -108,6 +108,7 @@ package build_config_pkg; cfg.PMPCfgRstVal = CVA6Cfg.PMPCfgRstVal; cfg.PMPAddrRstVal = CVA6Cfg.PMPAddrRstVal; cfg.PMPEntryReadOnly = CVA6Cfg.PMPEntryReadOnly; + cfg.PMPG = CVA6Cfg.PMPG; cfg.NOCType = CVA6Cfg.NOCType; cfg.NrNonIdempotentRules = CVA6Cfg.NrNonIdempotentRules; cfg.NonIdempotentAddrBase = CVA6Cfg.NonIdempotentAddrBase; diff --git a/core/include/config_pkg.sv b/core/include/config_pkg.sv index cd9c2bad96..aeca02c979 100644 --- a/core/include/config_pkg.sv +++ b/core/include/config_pkg.sv @@ -112,6 +112,8 @@ package config_pkg; logic [63:0][63:0] PMPAddrRstVal; // PMP CSR read-only bits bit [63:0] PMPEntryReadOnly; + // PMP Granularity + int unsigned PMPG; // PMA non idempotent rules number int unsigned NrNonIdempotentRules; // PMA NonIdempotent region base address @@ -291,6 +293,7 @@ package config_pkg; logic [63:0][63:0] PMPCfgRstVal; logic [63:0][63:0] PMPAddrRstVal; bit [63:0] PMPEntryReadOnly; + int unsigned PMPG; noc_type_e NOCType; int unsigned NrNonIdempotentRules; logic [NrMaxRules-1:0][63:0] NonIdempotentAddrBase; diff --git a/core/include/cv32a60x_config_pkg.sv b/core/include/cv32a60x_config_pkg.sv index f3f0a3982c..1c725d8ae5 100644 --- a/core/include/cv32a60x_config_pkg.sv +++ b/core/include/cv32a60x_config_pkg.sv @@ -67,6 +67,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(1), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(0), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv32a65x_config_pkg.sv b/core/include/cv32a65x_config_pkg.sv index 788ae83e9b..2e26aeb5d5 100644 --- a/core/include/cv32a65x_config_pkg.sv +++ b/core/include/cv32a65x_config_pkg.sv @@ -67,6 +67,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(1), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(0), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv32a6_embedded_config_pkg_deprecated.sv b/core/include/cv32a6_embedded_config_pkg_deprecated.sv index 9168be9ed6..192fcebb0f 100644 --- a/core/include/cv32a6_embedded_config_pkg_deprecated.sv +++ b/core/include/cv32a6_embedded_config_pkg_deprecated.sv @@ -118,6 +118,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(2), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv32a6_ima_sv32_fpga_config_pkg.sv b/core/include/cv32a6_ima_sv32_fpga_config_pkg.sv index b65b0a0add..f0fbd2d038 100644 --- a/core/include/cv32a6_ima_sv32_fpga_config_pkg.sv +++ b/core/include/cv32a6_ima_sv32_fpga_config_pkg.sv @@ -119,6 +119,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(2), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv32a6_imac_sv0_config_pkg.sv b/core/include/cv32a6_imac_sv0_config_pkg.sv index 9d5edd3653..f0853a820a 100644 --- a/core/include/cv32a6_imac_sv0_config_pkg.sv +++ b/core/include/cv32a6_imac_sv0_config_pkg.sv @@ -119,6 +119,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(2), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv32a6_imac_sv32_config_pkg.sv b/core/include/cv32a6_imac_sv32_config_pkg.sv index f10df730ef..72388de965 100644 --- a/core/include/cv32a6_imac_sv32_config_pkg.sv +++ b/core/include/cv32a6_imac_sv32_config_pkg.sv @@ -118,6 +118,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(1), NonIdempotentAddrBase: 1024'({64'b0}), diff --git a/core/include/cv32a6_imafc_sv32_config_pkg.sv b/core/include/cv32a6_imafc_sv32_config_pkg.sv index c29dd93f60..fcd9518008 100644 --- a/core/include/cv32a6_imafc_sv32_config_pkg.sv +++ b/core/include/cv32a6_imafc_sv32_config_pkg.sv @@ -119,6 +119,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(2), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv64a6_imadfcv_sv39_polara_config_pkg.sv b/core/include/cv64a6_imadfcv_sv39_polara_config_pkg.sv index 26d5819862..633cb4ff26 100644 --- a/core/include/cv64a6_imadfcv_sv39_polara_config_pkg.sv +++ b/core/include/cv64a6_imadfcv_sv39_polara_config_pkg.sv @@ -119,6 +119,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_L15_BIG_ENDIAN, NrNonIdempotentRules: unsigned'(2), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv64a6_imafdc_sv39_config_pkg.sv b/core/include/cv64a6_imafdc_sv39_config_pkg.sv index c7a6cc5f85..847423fa04 100644 --- a/core/include/cv64a6_imafdc_sv39_config_pkg.sv +++ b/core/include/cv64a6_imafdc_sv39_config_pkg.sv @@ -119,6 +119,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(2), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv64a6_imafdc_sv39_hpdcache_config_pkg.sv b/core/include/cv64a6_imafdc_sv39_hpdcache_config_pkg.sv index 8be842fa27..aab260dee1 100644 --- a/core/include/cv64a6_imafdc_sv39_hpdcache_config_pkg.sv +++ b/core/include/cv64a6_imafdc_sv39_hpdcache_config_pkg.sv @@ -126,6 +126,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(2), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv64a6_imafdc_sv39_openpiton_config_pkg.sv b/core/include/cv64a6_imafdc_sv39_openpiton_config_pkg.sv index e36dffbdb2..69fdb62a42 100644 --- a/core/include/cv64a6_imafdc_sv39_openpiton_config_pkg.sv +++ b/core/include/cv64a6_imafdc_sv39_openpiton_config_pkg.sv @@ -119,6 +119,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_L15_BIG_ENDIAN, NrNonIdempotentRules: unsigned'(2), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv64a6_imafdc_sv39_wb_config_pkg.sv b/core/include/cv64a6_imafdc_sv39_wb_config_pkg.sv index 6f46e4127c..ec68b59dd2 100644 --- a/core/include/cv64a6_imafdc_sv39_wb_config_pkg.sv +++ b/core/include/cv64a6_imafdc_sv39_wb_config_pkg.sv @@ -119,6 +119,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(2), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv64a6_imafdch_sv39_config_pkg.sv b/core/include/cv64a6_imafdch_sv39_config_pkg.sv index 5cce0a9ec1..3e9ec45bac 100644 --- a/core/include/cv64a6_imafdch_sv39_config_pkg.sv +++ b/core/include/cv64a6_imafdch_sv39_config_pkg.sv @@ -119,6 +119,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(2), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv64a6_imafdch_sv39_wb_config_pkg.sv b/core/include/cv64a6_imafdch_sv39_wb_config_pkg.sv index 2705c7583b..4df49fe0a2 100644 --- a/core/include/cv64a6_imafdch_sv39_wb_config_pkg.sv +++ b/core/include/cv64a6_imafdch_sv39_wb_config_pkg.sv @@ -119,6 +119,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(2), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv64a6_imafdcv_sv39_config_pkg.sv b/core/include/cv64a6_imafdcv_sv39_config_pkg.sv index c7a36e6d9b..86661969c5 100644 --- a/core/include/cv64a6_imafdcv_sv39_config_pkg.sv +++ b/core/include/cv64a6_imafdcv_sv39_config_pkg.sv @@ -119,6 +119,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(2), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}), diff --git a/core/include/cv64a6_mmu_config_pkg.sv b/core/include/cv64a6_mmu_config_pkg.sv index 3d902c4240..c598c0b2c5 100644 --- a/core/include/cv64a6_mmu_config_pkg.sv +++ b/core/include/cv64a6_mmu_config_pkg.sv @@ -74,6 +74,7 @@ package cva6_config_pkg; PMPCfgRstVal: {64{64'h0}}, PMPAddrRstVal: {64{64'h0}}, PMPEntryReadOnly: 64'd0, + PMPG: int'(0), NOCType: config_pkg::NOC_TYPE_AXI4_ATOP, NrNonIdempotentRules: unsigned'(2), NonIdempotentAddrBase: 1024'({64'b0, 64'b0}),