Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User mode support #187

Merged
merged 99 commits into from
Jul 5, 2024
Merged

User mode support #187

merged 99 commits into from
Jul 5, 2024

Conversation

mkurc-ant
Copy link
Collaborator

This PR adds User mode support to VeeR EL2 core. This implies also:

  • enabling U bit in misa
  • adding new fields to mstatus CSR
  • adding CSR access control
  • adding new exception code for ECALL.U instruction.
  • preventing privilege instructions from running in user mode
  • adding user mode accessible shadow CSRs for performance counters
  • adding mcounteren CSR that controls access to counter shadow CSRs
  • updating PMP behavior to account for user mode

Along with user mode support there's also extended PMP (Smepmp) support added.

Both user mode and Smepmp are disabled by default. They need to be enabled via veer.config script. To enable user mode append:

-set=user_mode=1

to its invocation. And to enable Smepmp append:

-set=smepmp=1

With the PR there are new tests added that exercise new features.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 924 to 926
assign dec_csr_rdaddr_d[11:0] = {12{dec_csr_any_unq_d}} & i0[31:20];
assign dec_csr_wraddr_r[11:0] = {12{r_d.csrwen & r_d.i0valid}} & r_d.csrwaddr[11:0];
assign dec_csr_rdaddr_r[11:0] = {12{~r_d.csrwen & r_d.i0valid}} & r_d.csraddr[11:0];
assign dec_csr_wraddr_r[11:0] = {12{ r_d.csrwen & r_d.i0valid}} & r_d.csraddr[11:0];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
assign dec_csr_rdaddr_d[11:0] = {12{dec_csr_any_unq_d}} & i0[31:20];
assign dec_csr_wraddr_r[11:0] = {12{r_d.csrwen & r_d.i0valid}} & r_d.csrwaddr[11:0];
assign dec_csr_rdaddr_r[11:0] = {12{~r_d.csrwen & r_d.i0valid}} & r_d.csraddr[11:0];
assign dec_csr_wraddr_r[11:0] = {12{ r_d.csrwen & r_d.i0valid}} & r_d.csraddr[11:0];
assign dec_csr_rdaddr_d[11:0] = {12{dec_csr_any_unq_d}} & i0[31:20];
assign dec_csr_rdaddr_r[11:0] = {12{~r_d.csrwen & r_d.i0valid}} & r_d.csraddr[11:0];
assign dec_csr_wraddr_r[11:0] = {12{r_d.csrwen & r_d.i0valid}} & r_d.csraddr[11:0];

Comment on lines 933 to +934
// If we are writing MIE or MSTATUS, hold off the external interrupt for a cycle on the write.
assign dec_csr_stall_int_ff = ((r_d.csrwaddr[11:0] == 12'h300) | (r_d.csrwaddr[11:0] == 12'h304)) & r_d.csrwen & r_d.i0valid & ~dec_tlu_i0_kill_writeb_wb;
assign dec_csr_stall_int_ff = ((r_d.csraddr[11:0] == 12'h300) | (r_d.csraddr[11:0] == 12'h304)) & r_d.csrwen & r_d.i0valid & ~dec_tlu_i0_kill_writeb_wb;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
// If we are writing MIE or MSTATUS, hold off the external interrupt for a cycle on the write.
assign dec_csr_stall_int_ff = ((r_d.csrwaddr[11:0] == 12'h300) | (r_d.csrwaddr[11:0] == 12'h304)) & r_d.csrwen & r_d.i0valid & ~dec_tlu_i0_kill_writeb_wb;
assign dec_csr_stall_int_ff = ((r_d.csraddr[11:0] == 12'h300) | (r_d.csraddr[11:0] == 12'h304)) & r_d.csrwen & r_d.i0valid & ~dec_tlu_i0_kill_writeb_wb;
// If we are writing MIE or MSTATUS, hold off the external interrupt for a cycle on the write.
assign dec_csr_stall_int_ff = ((r_d.csraddr[11:0] == 12'h300) | (r_d.csraddr[11:0] == 12'h304)) & r_d.csrwen & r_d.i0valid & ~dec_tlu_i0_kill_writeb_wb;

Comment on lines 1312 to 1314
assign d_d.csrwen = dec_csr_wen_unq_d & i0_legal_decode_d;
assign d_d.csrwonly = i0_csr_write_only_d & dec_i0_decode_d;
assign d_d.csrwaddr[11:0] = (d_d.csrwen) ? i0[31:20] : '0; // csr write address for rd==0 case
assign d_d.csraddr[11:0] = i0[31:20]; // csr read/write address

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
assign d_d.csrwen = dec_csr_wen_unq_d & i0_legal_decode_d;
assign d_d.csrwonly = i0_csr_write_only_d & dec_i0_decode_d;
assign d_d.csrwaddr[11:0] = (d_d.csrwen) ? i0[31:20] : '0; // csr write address for rd==0 case
assign d_d.csraddr[11:0] = i0[31:20]; // csr read/write address
assign d_d.csrwen = dec_csr_wen_unq_d & i0_legal_decode_d;
assign d_d.csrwonly = i0_csr_write_only_d & dec_i0_decode_d;
assign d_d.csraddr[11:0] = i0[31:20]; // csr read/write address

@@ -1309,7 +1311,7 @@ end : cam_array

assign d_d.csrwen = dec_csr_wen_unq_d & i0_legal_decode_d;
assign d_d.csrwonly = i0_csr_write_only_d & dec_i0_decode_d;
assign d_d.csrwaddr[11:0] = (d_d.csrwen) ? i0[31:20] : '0; // csr write address for rd==0 case
assign d_d.csraddr[11:0] = i0[31:20]; // csr read/write address


rvdff #(3) i0cgff (.*, .clk(active_clk), .din(i0_pipe_en[3:1]), .dout(i0_pipe_en[2:0]));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
rvdff #(3) i0cgff (.*, .clk(active_clk), .din(i0_pipe_en[3:1]), .dout(i0_pipe_en[2:0]));
rvdff #(3) i0cgff (
.*,
.clk (active_clk),
.din (i0_pipe_en[3:1]),
.dout(i0_pipe_en[2:0])
);

@@ -23,7 +23,6 @@
//
//********************************************************************************


module el2_dec_pmp_ctl
import el2_pkg::*;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
import el2_pkg::*;
import el2_pkg::*;

(pmp_req_type == READ) |
(pmp_req_type == WRITE);
// Execute only on M/U
2'b10: result = (pmp_req_type == EXEC);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
2'b10: result = (pmp_req_type == EXEC);
2'b10: result = (pmp_req_type == EXEC);

Comment on lines +113 to +115
2'b11: result =
(pmp_req_type == EXEC) |
((pmp_req_type == READ) & ~priv_mode);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
2'b11: result =
(pmp_req_type == EXEC) |
((pmp_req_type == READ) & ~priv_mode);
2'b11: result = (pmp_req_type == EXEC) | ((pmp_req_type == READ) & ~priv_mode);

Comment on lines +133 to +134
function automatic logic orig_perm_check(logic pmp_cfg_lock,
logic priv_mode,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
function automatic logic orig_perm_check(logic pmp_cfg_lock,
logic priv_mode,
function automatic logic orig_perm_check(logic pmp_cfg_lock, logic priv_mode,

Comment on lines +143 to 148
function automatic logic access_fault_check(el2_mseccfg_pkt_t csr_pmp_mseccfg,
el2_pmp_type_pkt_t req_type,
logic [pt.PMP_ENTRIES-1:0] match_all,
logic any_region_enabled,
logic priv_mode,
logic [pt.PMP_ENTRIES-1:0] final_perm_check);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
function automatic logic access_fault_check(el2_mseccfg_pkt_t csr_pmp_mseccfg,
el2_pmp_type_pkt_t req_type,
logic [pt.PMP_ENTRIES-1:0] match_all,
logic any_region_enabled,
logic priv_mode,
logic [pt.PMP_ENTRIES-1:0] final_perm_check);
function automatic logic access_fault_check(
el2_mseccfg_pkt_t csr_pmp_mseccfg, el2_pmp_type_pkt_t req_type,
logic [pt.PMP_ENTRIES-1:0] match_all, logic any_region_enabled, logic priv_mode,
logic [pt.PMP_ENTRIES-1:0] final_perm_check);

logic [pt.PMP_ENTRIES-1:0] final_perm_check);


`ifdef RV_USER_MODE
`ifdef RV_SMEPMP

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
`ifdef RV_SMEPMP
`ifdef RV_SMEPMP

@@ -557,6 +540,12 @@ import el2_pkg::*;


localparam MSTATUS_MIE = 0;
localparam MSTATUS_MPIE = 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [verible-verilog-lint] reported by reviewdog 🐶
Explicitly define a storage type for every parameter and localparam, (MSTATUS_MPIE). [Style: constants] [explicit-parameter-storage-type]

@@ -1229,6 +1352,7 @@ end
// [31:0] : Lower Cycle count

localparam MCYCLEL = 12'hb00;
localparam CYCLEL = 12'hc00;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [verible-verilog-lint] reported by reviewdog 🐶
Explicitly define a storage type for every parameter and localparam, (CYCLEL). [Style: constants] [explicit-parameter-storage-type]

@@ -1251,6 +1375,7 @@ end
// Chained with mcyclel. Note: mcyclel overflow due to a mcycleh write gets ignored.

localparam MCYCLEH = 12'hb80;
localparam CYCLEH = 12'hc80;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [verible-verilog-lint] reported by reviewdog 🐶
Explicitly define a storage type for every parameter and localparam, (CYCLEH). [Style: constants] [explicit-parameter-storage-type]

@@ -1269,6 +1394,7 @@ end
// one instruction will be the value read by the following instruction (i.e., the increment of instret
// caused by the first instruction retiring happens before the write of the new value)."
localparam MINSTRETL = 12'hb02;
localparam INSTRETL = 12'hc02;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [verible-verilog-lint] reported by reviewdog 🐶
Explicitly define a storage type for every parameter and localparam, (INSTRETL). [Style: constants] [explicit-parameter-storage-type]

@@ -1295,6 +1421,7 @@ end
// Chained with minstretl. Note: minstretl overflow due to a minstreth write gets ignored.

localparam MINSTRETH = 12'hb82;
localparam INSTRETH = 12'hc82;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [verible-verilog-lint] reported by reviewdog 🐶
Explicitly define a storage type for every parameter and localparam, (INSTRETH). [Style: constants] [explicit-parameter-storage-type]

// ----------------------------------------------------------------------

logic [pt.PMP_ENTRIES-1:0] entry_lock_eff; // Effective entry lock
for (genvar r = 0; r < pt.PMP_ENTRIES; r++) begin : pmpcfg_lock

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [verible-verilog-lint] reported by reviewdog 🐶
All generate block labels must start with g_ or gen_ [Style: generate-constructs] [generate-label-prefix]

Comment on lines 106 to 107
// PMPCFG fields are WARL. Mask out bits 6:5 during write.
// When Smepmp is disabled R=0 and W=1 combination is illegal mask out W

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [verible-verilog-lint] reported by reviewdog 🐶
Remove trailing spaces. [Style: trailing-spaces] [no-trailing-spaces]

Suggested change
// PMPCFG fields are WARL. Mask out bits 6:5 during write.
// When Smepmp is disabled R=0 and W=1 combination is illegal mask out W
// PMPCFG fields are WARL. Mask out bits 6:5 during write. // PMPCFG fields are WARL. Mask out bits 6:5 during write.
// When Smepmp is disabled R=0 and W=1 combination is illegal mask out W

`ifdef RV_USER_MODE

logic priv_mode; // Operating privilege mode, 0 - machine, 1 - user
logic priv_mode_eff; // Effective privilege mode, 0 - machine, 1 - user (driven in el2_dec_tlu_ctl.sv)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [verible-verilog-lint] reported by reviewdog 🐶
Line length exceeds max: 100; is: 109 [Style: line-length] [line-length]

// modes. Also deny unmatched for M-mode when MSECCFG.MML is set and request type is EXEC.
logic access_fail = csr_pmp_mseccfg.MMWP | priv_mode |
(csr_pmp_mseccfg.MML && (req_type == EXEC));
`else

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
`else
`else

`else
// When in user mode and at least one PMP region is enabled deny access by default.
logic access_fail = any_region_enabled & priv_mode;
`endif

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
`endif
`endif

1'b0,
1'b0,
`endif
region_perm_check[c]);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
region_perm_check[c]);
region_perm_check[c]
);

@@ -884,6 +884,16 @@ import el2_pkg::*;

assign core_rst_l = rst_l & (dbg_core_rst_l | scan_mode);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
assign core_rst_l = rst_l & (dbg_core_rst_l | scan_mode);
assign core_rst_l = rst_l & (dbg_core_rst_l | scan_mode);

Comment on lines 889 to 891
logic priv_mode; // Operating privilege mode, 0 - machine, 1 - user
logic priv_mode_eff; // Effective privilege mode, 0 - machine, 1 - user (driven in el2_dec_tlu_ctl.sv)
logic priv_mode_ns; // Next privilege mode

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
logic priv_mode; // Operating privilege mode, 0 - machine, 1 - user
logic priv_mode_eff; // Effective privilege mode, 0 - machine, 1 - user (driven in el2_dec_tlu_ctl.sv)
logic priv_mode_ns; // Next privilege mode
logic priv_mode; // Operating privilege mode, 0 - machine, 1 - user
logic priv_mode_eff; // Effective privilege mode, 0 - machine, 1 - user (driven in el2_dec_tlu_ctl.sv)
logic priv_mode_ns; // Next privilege mode

logic priv_mode_eff; // Effective privilege mode, 0 - machine, 1 - user (driven in el2_dec_tlu_ctl.sv)
logic priv_mode_ns; // Next privilege mode

el2_mseccfg_pkt_t mseccfg; // mseccfg CSR for PMP

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
el2_mseccfg_pkt_t mseccfg; // mseccfg CSR for PMP
el2_mseccfg_pkt_t mseccfg; // mseccfg CSR for PMP

logic MMWP;
logic MML;
} el2_mseccfg_pkt_t;

//`endif

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
//`endif
//`endif

logic MMWP;
logic MML;
} el2_mseccfg_pkt_t;

//`endif

endpackage // el2_pkg

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
endpackage // el2_pkg
endpackage // el2_pkg

Copy link

Links to coverage and verification reports for this PR (#187) are available at https://chipsalliance.github.io/Cores-VeeR-EL2/

@mkurc-ant mkurc-ant force-pushed the user-mode-support-ant branch from 414f696 to 4c8dacb Compare June 25, 2024 13:11
@@ -557,6 +540,12 @@ import el2_pkg::*;


localparam MSTATUS_MIE = 0;
localparam int MSTATUS_MPIE = 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [verible-verilog-lint] reported by reviewdog 🐶
Non-type localparam names must be styled with CamelCase [Style: constants] [parameter-name-style]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've added the int type following the fixes from Verible.
However, the case used here is consistent with other localparams in the codebase and we don't aim to reformat them in the scope on this PR.

@@ -920,16 +921,17 @@ end : cam_array
assign dec_csr_any_unq_d = any_csr_d & i0_valid_d;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
assign dec_csr_any_unq_d = any_csr_d & i0_valid_d;
assign dec_csr_any_unq_d = any_csr_d & i0_valid_d;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation level suggestions do not match the indentation of the rest of the file. Let's not apply them for now as formatting of the whole file is out of scope of this PR.

Comment on lines +924 to +926
assign dec_csr_rdaddr_d[11:0] = {12{dec_csr_any_unq_d}} & i0[31:20];
assign dec_csr_rdaddr_r[11:0] = {12{~r_d.csrwen & r_d.i0valid}} & r_d.csraddr[11:0];
assign dec_csr_wraddr_r[11:0] = {12{r_d.csrwen & r_d.i0valid}} & r_d.csraddr[11:0];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
assign dec_csr_rdaddr_d[11:0] = {12{dec_csr_any_unq_d}} & i0[31:20];
assign dec_csr_rdaddr_r[11:0] = {12{~r_d.csrwen & r_d.i0valid}} & r_d.csraddr[11:0];
assign dec_csr_wraddr_r[11:0] = {12{r_d.csrwen & r_d.i0valid}} & r_d.csraddr[11:0];
assign dec_csr_rdaddr_d[11:0] = {12{dec_csr_any_unq_d}} & i0[31:20];
assign dec_csr_rdaddr_r[11:0] = {12{~r_d.csrwen & r_d.i0valid}} & r_d.csraddr[11:0];
assign dec_csr_wraddr_r[11:0] = {12{r_d.csrwen & r_d.i0valid}} & r_d.csraddr[11:0];

Comment on lines +1312 to +1314
assign d_d.csrwen = dec_csr_wen_unq_d & i0_legal_decode_d;
assign d_d.csrwonly = i0_csr_write_only_d & dec_i0_decode_d;
assign d_d.csraddr[11:0] = i0[31:20]; // csr read/write address

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
assign d_d.csrwen = dec_csr_wen_unq_d & i0_legal_decode_d;
assign d_d.csrwonly = i0_csr_write_only_d & dec_i0_decode_d;
assign d_d.csraddr[11:0] = i0[31:20]; // csr read/write address
assign d_d.csrwen = dec_csr_wen_unq_d & i0_legal_decode_d;
assign d_d.csrwonly = i0_csr_write_only_d & dec_i0_decode_d;
assign d_d.csraddr[11:0] = i0[31:20]; // csr read/write address

Comment on lines +55 to +56
output logic [31:0] dec_pmp_rddata_d, // pmp CSR read data
output logic dec_pmp_read_d, // pmp CSR address match

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
output logic [31:0] dec_pmp_rddata_d, // pmp CSR read data
output logic dec_pmp_read_d, // pmp CSR address match
output logic [31:0] dec_pmp_rddata_d, // pmp CSR read data
output logic dec_pmp_read_d, // pmp CSR address match

Comment on lines 58 to 59
output el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES],
output logic [31:0] pmp_pmpaddr [pt.PMP_ENTRIES],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
output el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES],
output logic [31:0] pmp_pmpaddr [pt.PMP_ENTRIES],
output el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES],
output logic [31:0] pmp_pmpaddr[pt.PMP_ENTRIES],

Comment on lines +80 to +81
logic [pt.PMP_ENTRIES-1:0] entry_lock_eff; // Effective entry lock
for (genvar r = 0; r < pt.PMP_ENTRIES; r++) begin : g_pmpcfg_lock

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
logic [pt.PMP_ENTRIES-1:0] entry_lock_eff; // Effective entry lock
for (genvar r = 0; r < pt.PMP_ENTRIES; r++) begin : g_pmpcfg_lock
logic [pt.PMP_ENTRIES-1:0] entry_lock_eff; // Effective entry lock
for (genvar r = 0; r < pt.PMP_ENTRIES; r++) begin : g_pmpcfg_lock

Comment on lines +83 to +84
// Smepmp allow modifying locked entries when mseccfg.RLB is set
assign entry_lock_eff[r] = pmp_pmpcfg[r].lock & ~mseccfg.RLB;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
// Smepmp allow modifying locked entries when mseccfg.RLB is set
assign entry_lock_eff[r] = pmp_pmpcfg[r].lock & ~mseccfg.RLB;
// Smepmp allow modifying locked entries when mseccfg.RLB is set
assign entry_lock_eff[r] = pmp_pmpcfg[r].lock & ~mseccfg.RLB;

// Smepmp allow modifying locked entries when mseccfg.RLB is set
assign entry_lock_eff[r] = pmp_pmpcfg[r].lock & ~mseccfg.RLB;
`else
assign entry_lock_eff[r] = pmp_pmpcfg[r].lock;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
assign entry_lock_eff[r] = pmp_pmpcfg[r].lock;
assign entry_lock_eff[r] = pmp_pmpcfg[r].lock;

Comment on lines +106 to +109
// PMPCFG fields are WARL. Mask out bits 6:5 during write.
// When Smepmp is disabled R=0 and W=1 combination is illegal mask out W
// when R is cleared.
assign raw_wdata = dec_csr_wrdata_r[(entry_idx[1:0]*8)+7:(entry_idx[1:0]*8)+0];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
// PMPCFG fields are WARL. Mask out bits 6:5 during write.
// When Smepmp is disabled R=0 and W=1 combination is illegal mask out W
// when R is cleared.
assign raw_wdata = dec_csr_wrdata_r[(entry_idx[1:0]*8)+7:(entry_idx[1:0]*8)+0];
// PMPCFG fields are WARL. Mask out bits 6:5 during write.
// When Smepmp is disabled R=0 and W=1 combination is illegal mask out W
// when R is cleared.
assign raw_wdata = dec_csr_wrdata_r[(entry_idx[1:0]*8)+7:(entry_idx[1:0]*8)+0];

Comment on lines +889 to +894
// Operating privilege mode, 0 - machine, 1 - user
logic priv_mode;
// Effective privilege mode, 0 - machine, 1 - user (driven in el2_dec_tlu_ctl.sv)
logic priv_mode_eff;
// Next privilege mode
logic priv_mode_ns;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
// Operating privilege mode, 0 - machine, 1 - user
logic priv_mode;
// Effective privilege mode, 0 - machine, 1 - user (driven in el2_dec_tlu_ctl.sv)
logic priv_mode_eff;
// Next privilege mode
logic priv_mode_ns;
// Operating privilege mode, 0 - machine, 1 - user
logic priv_mode;
// Effective privilege mode, 0 - machine, 1 - user (driven in el2_dec_tlu_ctl.sv)
logic priv_mode_eff;
// Next privilege mode
logic priv_mode_ns;

Copy link

Links to coverage and verification reports for this PR (#187) are available at https://chipsalliance.github.io/Cores-VeeR-EL2/

mkurc-ant added 22 commits July 3, 2024 13:20
Internal-tag: [#57661]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#57661]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#57674]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#57674]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#57674]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#57674]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#57674]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#57674]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#57788]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#57788]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#57788]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#57788]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#57788]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#57785]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#58029]
Signed-off-by: Maciej Kurc <[email protected]>
…y sizes

Internal-tag: [#58029]
Signed-off-by: Maciej Kurc <[email protected]>
… fail)

Internal-tag: [#58029]
Signed-off-by: Maciej Kurc <[email protected]>
… checking

Internal-tag: [#58029]
Signed-off-by: Maciej Kurc <[email protected]>
…pening

Internal-tag: [#58273]
Signed-off-by: Maciej Kurc <[email protected]>
…ardware interrupts

Internal-tag: [#58169]
Signed-off-by: Maciej Kurc <[email protected]>
mkurc-ant and others added 25 commits July 3, 2024 14:32
Internal-tag: [#58150]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#58150]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#58150]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#58150]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#58150]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#58150]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#59770]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#59770]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#59770]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#59770]
Signed-off-by: Maciej Kurc <[email protected]>
…ons.

Internal-tag: [#59770]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#59770]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#59770]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#59770]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#59770]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#59770]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#59770]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#59770]
Signed-off-by: Maciej Kurc <[email protected]>
Internal-tag: [#59770]
Signed-off-by: Maciej Kurc <[email protected]>
…f priv_mode

Internal-tag: [#59827]
Signed-off-by: Maciej Kurc <[email protected]>
…s rights)

Internal-tag: [#59827]
Signed-off-by: Maciej Kurc <[email protected]>
@wsipak wsipak force-pushed the user-mode-support-ant branch from 4c8dacb to e65644b Compare July 3, 2024 13:27
Copy link

github-actions bot commented Jul 3, 2024

Links to coverage and verification reports for this PR (#187) are available at https://chipsalliance.github.io/Cores-VeeR-EL2/

@kgugala
Copy link
Member

kgugala commented Jul 5, 2024

LGTM

@kgugala kgugala merged commit ada3961 into main Jul 5, 2024
243 checks passed
@kgugala kgugala deleted the user-mode-support-ant branch July 5, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants