-
Notifications
You must be signed in to change notification settings - Fork 76
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
Physical Memory Protection unit #119
Conversation
// [15:8] : PMP entry (x*4 + 1) configuration | ||
// [7:0] : PMP entry (x*4 + 0) configuration | ||
|
||
localparam PMPCFG = 12'h3a0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicitly define a storage type for every parameter and localparam, (PMPCFG). [Style: constants] [explicit-parameter-storage-type]
localparam PMPCFG = 12'h3a0; | ||
|
||
assign wr_pmpcfg_r = dec_csr_wen_r_mod & (dec_csr_wraddr_r[11:4] == PMPCFG[11:4]); | ||
assign wr_pmpcfg_group = dec_csr_wraddr_r[3:0]; // selects group of 4 pmpcfg entries (group 1 -> entries 4-7; up to 16 groups) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 129 [Style: line-length] [line-length]
|
||
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpcfg_ff | ||
rvdffe #(8) pmpcfg_ff (.*, .clk(free_l2clk), | ||
.en(wr_pmpcfg_r & (wr_pmpcfg_group == entry_idx[5:2]) & (~pmp_pmpcfg[entry_idx].lock)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 113 [Style: line-length] [line-length]
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpcfg_ff | ||
rvdffe #(8) pmpcfg_ff (.*, .clk(free_l2clk), | ||
.en(wr_pmpcfg_r & (wr_pmpcfg_group == entry_idx[5:2]) & (~pmp_pmpcfg[entry_idx].lock)), | ||
.din(dec_csr_wrdata_r[(entry_idx[1:0]*8)+7:(entry_idx[1:0]*8)+0] & 8'b10011111), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 106 [Style: line-length] [line-length]
// NOTE: VeeR-EL2 uses 32-bit physical addressing, register bits 31:30 mapping | ||
// to bits 33:32 of the physical address are always set to 0. (WARL) | ||
|
||
localparam PMPADDR0 = 12'h3b0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicitly define a storage type for every parameter and localparam, (PMPADDR0). [Style: constants] [explicit-parameter-storage-type]
design/lsu/el2_lsu_addrcheck.sv
Outdated
if (pt.PMP_ENTRIES > 0) begin | ||
assign mpu_access_fault_d = (lsu_pmp_error_start | lsu_pmp_error_end); // X. Address is in blocked region | ||
end else begin | ||
assign mpu_access_fault_d = (~start_addr_in_dccm_region_d & ~non_dccm_access_ok); // 3. Address is not in a populated non-dccm region |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 173 [Style: line-length] [line-length]
design/lsu/el2_lsu_addrcheck.sv
Outdated
end else begin | ||
assign unmapped_access_fault_d = ((start_addr_in_dccm_region_d & ~start_addr_in_dccm_d) | // 0. Addr in dccm region but not in dccm offset | ||
(end_addr_in_dccm_region_d & ~end_addr_in_dccm_d) | // 0. Addr in dccm region but not in dccm offset | ||
(start_addr_in_pic_region_d & ~start_addr_in_pic_d) | // 0. Addr in picm region but not in picm offset | ||
(end_addr_in_pic_region_d & ~end_addr_in_pic_d)); // 0. Addr in picm region but not in picm offset | ||
assign mpu_access_fault_d = (~start_addr_in_pic_region_d & ~start_addr_in_dccm_region_d & ~non_dccm_access_ok); // 3. Address is not in a populated non-dccm region | ||
if (pt.PMP_ENTRIES > 0) begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All generate block statements must have a label [Style: generate-statements] [generate-label]
design/lsu/el2_lsu_addrcheck.sv
Outdated
end else begin | ||
assign unmapped_access_fault_d = ((start_addr_in_dccm_region_d & ~start_addr_in_dccm_d) | // 0. Addr in dccm region but not in dccm offset | ||
(end_addr_in_dccm_region_d & ~end_addr_in_dccm_d) | // 0. Addr in dccm region but not in dccm offset | ||
(start_addr_in_pic_region_d & ~start_addr_in_pic_d) | // 0. Addr in picm region but not in picm offset | ||
(end_addr_in_pic_region_d & ~end_addr_in_pic_d)); // 0. Addr in picm region but not in picm offset | ||
assign mpu_access_fault_d = (~start_addr_in_pic_region_d & ~start_addr_in_dccm_region_d & ~non_dccm_access_ok); // 3. Address is not in a populated non-dccm region | ||
if (pt.PMP_ENTRIES > 0) begin | ||
assign mpu_access_fault_d = (lsu_pmp_error_start | lsu_pmp_error_end); // X. Address is in blocked region |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 161 [Style: line-length] [line-length]
design/lsu/el2_lsu_addrcheck.sv
Outdated
assign mpu_access_fault_d = (~start_addr_in_pic_region_d & ~start_addr_in_dccm_region_d & ~non_dccm_access_ok); // 3. Address is not in a populated non-dccm region | ||
if (pt.PMP_ENTRIES > 0) begin | ||
assign mpu_access_fault_d = (lsu_pmp_error_start | lsu_pmp_error_end); // X. Address is in blocked region | ||
end else begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All generate block statements must have a label [Style: generate-statements] [generate-label]
design/lsu/el2_lsu_addrcheck.sv
Outdated
if (pt.PMP_ENTRIES > 0) begin | ||
assign mpu_access_fault_d = (lsu_pmp_error_start | lsu_pmp_error_end); // X. Address is in blocked region | ||
end else begin | ||
assign mpu_access_fault_d = (~start_addr_in_pic_region_d & ~start_addr_in_dccm_region_d & ~non_dccm_access_ok); // 3. Address is not in a populated non-dccm region |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 178 [Style: line-length] [line-length]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
verible-verilog-format
design/dec/el2_dec_tlu_ctl.sv|2567|
design/dec/el2_dec_tlu_ctl.sv|2570|
design/dec/el2_dec_tlu_ctl.sv|2573|
design/dec/el2_dec_tlu_ctl.sv|2577|
design/dec/el2_dec_tlu_ctl.sv|2580|
design/dec/el2_dec_tlu_ctl.sv|2583|
design/dec/el2_dec_tlu_ctl.sv|2586|
design/dec/el2_dec_tlu_ctl.sv|2589|
design/dec/el2_dec_tlu_ctl.sv|2592|
design/dec/el2_dec_tlu_ctl.sv|2595|
design/dec/el2_dec_tlu_ctl.sv|2598|
design/dec/el2_dec_tlu_ctl.sv|2601|
design/dec/el2_dec_tlu_ctl.sv|2604|
design/dec/el2_dec_tlu_ctl.sv|2607|
design/dec/el2_dec_tlu_ctl.sv|2611|
design/dec/el2_dec_tlu_ctl.sv|2620|
design/dec/el2_dec_tlu_ctl.sv|2623|
design/dec/el2_dec_tlu_ctl.sv|2626|
design/dec/el2_dec_tlu_ctl.sv|2629|
design/dec/el2_dec_tlu_ctl.sv|2632|
design/dec/el2_dec_tlu_ctl.sv|2635|
design/dec/el2_dec_tlu_ctl.sv|2638|
design/dec/el2_dec_tlu_ctl.sv|2646|
design/dec/el2_dec_tlu_ctl.sv|2659|
design/dec/el2_dec_tlu_ctl.sv|2672|
design/el2_pmp.sv|18|
design/el2_pmp.sv|20|
design/el2_pmp.sv|65|
design/el2_pmp.sv|72|
design/el2_pmp.sv|80|
design/el2_pmp.sv|105|
design/el2_pmp.sv|108|
design/el2_pmp.sv|137|
design/el2_pmp.sv|152|
design/el2_pmp.sv|159|
design/el2_pmp.sv|171|
design/el2_pmp.sv|182|
design/el2_pmp.sv|186|
design/ifu/el2_ifu.sv|196|
design/ifu/el2_ifu.sv|211|
design/ifu/el2_ifu.sv|216|
design/ifu/el2_ifu_mem_ctl.sv|1656|
design/ifu/el2_ifu_mem_ctl.sv|1670|
design/ifu/el2_ifu_mem_ctl.sv|1672|
design/lsu/el2_lsu_addrcheck.sv|50|
design/lsu/el2_lsu_addrcheck.sv|53|
design/lsu/el2_lsu_addrcheck.sv|56|
design/lsu/el2_lsu_addrcheck.sv|133|
design/dec/el2_dec.sv
Outdated
@@ -286,6 +286,10 @@ import el2_pkg::*; | |||
|
|||
output el2_trace_pkt_t trace_rv_trace_pkt, // trace packet |
There was a problem hiding this comment.
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 🐶
output el2_trace_pkt_t trace_rv_trace_pkt, // trace packet | |
input logic [15:0] ifu_i0_cinst, // 16b compressed instruction |
design/dec/el2_dec.sv
Outdated
// PMP signals | ||
output el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES], | ||
output logic [31:0] pmp_pmpaddr [pt.PMP_ENTRIES], |
There was a problem hiding this comment.
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 🐶
// PMP signals | |
output el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES], | |
output logic [31:0] pmp_pmpaddr [pt.PMP_ENTRIES], | |
output el2_trace_pkt_t trace_rv_trace_pkt, // trace packet |
|
||
|
||
module el2_dec_pmp_ctl | ||
import el2_pkg::*; |
There was a problem hiding this comment.
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 🐶
import el2_pkg::*; | |
import el2_pkg::*; |
design/dec/el2_dec_pmp_ctl.sv
Outdated
input logic free_l2clk, | ||
input logic csr_wr_clk, | ||
input logic rst_l, | ||
input logic dec_csr_wen_r_mod, // csr write enable at wb | ||
input logic [11:0] dec_csr_wraddr_r, // write address for csr | ||
input logic [31:0] dec_csr_wrdata_r, // csr write data at wb | ||
input logic [11:0] dec_csr_rdaddr_d, // read address for csr | ||
|
||
input logic csr_pmpcfg, | ||
input logic csr_pmpaddr0, | ||
input logic csr_pmpaddr16, | ||
input logic csr_pmpaddr32, | ||
input logic csr_pmpaddr48, | ||
|
||
input logic dec_pause_state, // Paused | ||
input logic dec_tlu_pmu_fw_halted, // pmu/fw halted | ||
input logic internal_dbg_halt_timers, // debug halted | ||
|
||
output logic [31:0] dec_pmp_rddata_d, // pmp CSR read data | ||
output logic dec_pmp_read_d, // pmp CSR address match | ||
|
||
output el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES], | ||
output logic [31:0] pmp_pmpaddr [pt.PMP_ENTRIES], | ||
|
||
input logic scan_mode | ||
); | ||
|
||
logic wr_pmpcfg_r; | ||
logic [3:0] wr_pmpcfg_group; | ||
|
||
logic wr_pmpaddr0_sel; | ||
logic wr_pmpaddr16_sel; | ||
logic wr_pmpaddr32_sel; | ||
logic wr_pmpaddr48_sel; | ||
logic wr_pmpaddr_r; | ||
logic [1:0] wr_pmpaddr_quarter; | ||
logic [5:0] wr_pmpaddr_address; | ||
|
||
logic [3:0] pmp_quarter_rdaddr; | ||
logic [31:0] pmp_pmpcfg_rddata; | ||
|
||
// ---------------------------------------------------------------------- | ||
// PMPCFGx (RW) | ||
// [31:24] : PMP entry (x*4 + 3) configuration | ||
// [23:16] : PMP entry (x*4 + 2) configuration | ||
// [15:8] : PMP entry (x*4 + 1) configuration | ||
// [7:0] : PMP entry (x*4 + 0) configuration | ||
|
||
localparam PMPCFG = 12'h3a0; | ||
|
||
assign wr_pmpcfg_r = dec_csr_wen_r_mod & (dec_csr_wraddr_r[11:4] == PMPCFG[11:4]); | ||
assign wr_pmpcfg_group = dec_csr_wraddr_r[3:0]; // selects group of 4 pmpcfg entries (group 1 -> entries 4-7; up to 16 groups) | ||
|
||
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpcfg_ff | ||
rvdffe #(8) pmpcfg_ff (.*, .clk(free_l2clk), | ||
.en(wr_pmpcfg_r & (wr_pmpcfg_group == entry_idx[5:2]) & (~pmp_pmpcfg[entry_idx].lock)), | ||
.din(dec_csr_wrdata_r[(entry_idx[1:0]*8)+7:(entry_idx[1:0]*8)+0] & 8'b10011111), | ||
.dout(pmp_pmpcfg[entry_idx])); | ||
end | ||
|
||
// ---------------------------------------------------------------------- | ||
// PMPADDRx (RW) | ||
// [31:0] : PMP entry (x) address selector (word addressing) | ||
// | ||
// NOTE: VeeR-EL2 uses 32-bit physical addressing, register bits 31:30 mapping | ||
// to bits 33:32 of the physical address are always set to 0. (WARL) | ||
|
||
localparam PMPADDR0 = 12'h3b0; | ||
localparam PMPADDR16 = 12'h3c0; | ||
localparam PMPADDR32 = 12'h3d0; | ||
localparam PMPADDR48 = 12'h3e0; | ||
|
||
assign wr_pmpaddr0_sel = dec_csr_wraddr_r[11:4] == PMPADDR0[11:4]; | ||
assign wr_pmpaddr16_sel = dec_csr_wraddr_r[11:4] == PMPADDR16[11:4]; | ||
assign wr_pmpaddr32_sel = dec_csr_wraddr_r[11:4] == PMPADDR32[11:4]; | ||
assign wr_pmpaddr48_sel = dec_csr_wraddr_r[11:4] == PMPADDR48[11:4]; | ||
assign wr_pmpaddr_r = dec_csr_wen_r_mod & (wr_pmpaddr0_sel | wr_pmpaddr16_sel | wr_pmpaddr32_sel | wr_pmpaddr48_sel); | ||
|
||
assign wr_pmpaddr_quarter[0] = wr_pmpaddr16_sel | wr_pmpaddr48_sel; | ||
assign wr_pmpaddr_quarter[1] = wr_pmpaddr32_sel | wr_pmpaddr48_sel; | ||
assign wr_pmpaddr_address = {wr_pmpaddr_quarter, dec_csr_wraddr_r[3:0]}; // entry address | ||
|
||
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpaddr_ff | ||
assign pmp_pmpaddr[entry_idx][31:30] = 2'b00; | ||
rvdffe #(30) pmpaddr_ff (.*, .clk(free_l2clk), | ||
.en(wr_pmpaddr_r & (wr_pmpaddr_address == entry_idx) & (~pmp_pmpcfg[entry_idx].lock)), | ||
.din(dec_csr_wrdata_r[29:0]), | ||
.dout(pmp_pmpaddr[entry_idx][29:0])); | ||
end | ||
|
||
// CSR read mux | ||
|
||
assign pmp_quarter_rdaddr = dec_csr_rdaddr_d[3:0]; | ||
assign pmp_pmpcfg_rddata = { pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h3}], | ||
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h2}], | ||
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h1}], | ||
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h0}] | ||
}; | ||
assign dec_pmp_read_d = csr_pmpcfg | csr_pmpaddr0 | csr_pmpaddr16 | csr_pmpaddr32 | csr_pmpaddr48; | ||
assign dec_pmp_rddata_d[31:0] = ( ({32{csr_pmpcfg}} & pmp_pmpcfg_rddata) | |
There was a problem hiding this comment.
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 🐶
`include "el2_param.vh" | |
) | |
( | |
input logic clk, | |
input logic free_l2clk, | |
input logic csr_wr_clk, | |
input logic rst_l, | |
input logic dec_csr_wen_r_mod, // csr write enable at wb | |
input logic [11:0] dec_csr_wraddr_r, // write address for csr | |
input logic [31:0] dec_csr_wrdata_r, // csr write data at wb | |
input logic [11:0] dec_csr_rdaddr_d, // read address for csr | |
input logic csr_pmpcfg, | |
input logic csr_pmpaddr0, | |
input logic csr_pmpaddr16, | |
input logic csr_pmpaddr32, | |
input logic csr_pmpaddr48, | |
input logic dec_pause_state, // Paused | |
input logic dec_tlu_pmu_fw_halted, // pmu/fw halted | |
input logic internal_dbg_halt_timers, // debug halted | |
output logic [31:0] dec_pmp_rddata_d, // pmp CSR read data | |
output logic dec_pmp_read_d, // pmp CSR address match | |
output el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES], | |
output logic [31:0] pmp_pmpaddr [pt.PMP_ENTRIES], | |
input logic scan_mode | |
); | |
logic wr_pmpcfg_r; | |
logic [3:0] wr_pmpcfg_group; | |
logic wr_pmpaddr0_sel; | |
logic wr_pmpaddr16_sel; | |
logic wr_pmpaddr32_sel; | |
logic wr_pmpaddr48_sel; | |
logic wr_pmpaddr_r; | |
logic [1:0] wr_pmpaddr_quarter; | |
logic [5:0] wr_pmpaddr_address; | |
logic [3:0] pmp_quarter_rdaddr; | |
logic [31:0] pmp_pmpcfg_rddata; | |
// ---------------------------------------------------------------------- | |
// PMPCFGx (RW) | |
// [31:24] : PMP entry (x*4 + 3) configuration | |
// [23:16] : PMP entry (x*4 + 2) configuration | |
// [15:8] : PMP entry (x*4 + 1) configuration | |
// [7:0] : PMP entry (x*4 + 0) configuration | |
localparam PMPCFG = 12'h3a0; | |
assign wr_pmpcfg_r = dec_csr_wen_r_mod & (dec_csr_wraddr_r[11:4] == PMPCFG[11:4]); | |
assign wr_pmpcfg_group = dec_csr_wraddr_r[3:0]; // selects group of 4 pmpcfg entries (group 1 -> entries 4-7; up to 16 groups) | |
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpcfg_ff | |
rvdffe #(8) pmpcfg_ff (.*, .clk(free_l2clk), | |
.en(wr_pmpcfg_r & (wr_pmpcfg_group == entry_idx[5:2]) & (~pmp_pmpcfg[entry_idx].lock)), | |
.din(dec_csr_wrdata_r[(entry_idx[1:0]*8)+7:(entry_idx[1:0]*8)+0] & 8'b10011111), | |
.dout(pmp_pmpcfg[entry_idx])); | |
end | |
// ---------------------------------------------------------------------- | |
// PMPADDRx (RW) | |
// [31:0] : PMP entry (x) address selector (word addressing) | |
// | |
// NOTE: VeeR-EL2 uses 32-bit physical addressing, register bits 31:30 mapping | |
// to bits 33:32 of the physical address are always set to 0. (WARL) | |
localparam PMPADDR0 = 12'h3b0; | |
localparam PMPADDR16 = 12'h3c0; | |
localparam PMPADDR32 = 12'h3d0; | |
localparam PMPADDR48 = 12'h3e0; | |
assign wr_pmpaddr0_sel = dec_csr_wraddr_r[11:4] == PMPADDR0[11:4]; | |
assign wr_pmpaddr16_sel = dec_csr_wraddr_r[11:4] == PMPADDR16[11:4]; | |
assign wr_pmpaddr32_sel = dec_csr_wraddr_r[11:4] == PMPADDR32[11:4]; | |
assign wr_pmpaddr48_sel = dec_csr_wraddr_r[11:4] == PMPADDR48[11:4]; | |
assign wr_pmpaddr_r = dec_csr_wen_r_mod & (wr_pmpaddr0_sel | wr_pmpaddr16_sel | wr_pmpaddr32_sel | wr_pmpaddr48_sel); | |
assign wr_pmpaddr_quarter[0] = wr_pmpaddr16_sel | wr_pmpaddr48_sel; | |
assign wr_pmpaddr_quarter[1] = wr_pmpaddr32_sel | wr_pmpaddr48_sel; | |
assign wr_pmpaddr_address = {wr_pmpaddr_quarter, dec_csr_wraddr_r[3:0]}; // entry address | |
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpaddr_ff | |
assign pmp_pmpaddr[entry_idx][31:30] = 2'b00; | |
rvdffe #(30) pmpaddr_ff (.*, .clk(free_l2clk), | |
.en(wr_pmpaddr_r & (wr_pmpaddr_address == entry_idx) & (~pmp_pmpcfg[entry_idx].lock)), | |
.din(dec_csr_wrdata_r[29:0]), | |
.dout(pmp_pmpaddr[entry_idx][29:0])); | |
end | |
// CSR read mux | |
assign pmp_quarter_rdaddr = dec_csr_rdaddr_d[3:0]; | |
assign pmp_pmpcfg_rddata = { pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h3}], | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h2}], | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h1}], | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h0}] | |
}; | |
assign dec_pmp_read_d = csr_pmpcfg | csr_pmpaddr0 | csr_pmpaddr16 | csr_pmpaddr32 | csr_pmpaddr48; | |
assign dec_pmp_rddata_d[31:0] = ( ({32{csr_pmpcfg}} & pmp_pmpcfg_rddata) | | |
`include "el2_param.vh" | |
) ( | |
input logic clk, | |
input logic free_l2clk, | |
input logic csr_wr_clk, | |
input logic rst_l, | |
input logic dec_csr_wen_r_mod, // csr write enable at wb | |
input logic [11:0] dec_csr_wraddr_r, // write address for csr | |
input logic [31:0] dec_csr_wrdata_r, // csr write data at wb | |
input logic [11:0] dec_csr_rdaddr_d, // read address for csr | |
input logic csr_pmpcfg, | |
input logic csr_pmpaddr0, | |
input logic csr_pmpaddr16, | |
input logic csr_pmpaddr32, | |
input logic csr_pmpaddr48, | |
input logic dec_pause_state, // Paused | |
input logic dec_tlu_pmu_fw_halted, // pmu/fw halted | |
input logic internal_dbg_halt_timers, // debug halted | |
output logic [31:0] dec_pmp_rddata_d, // pmp CSR read data | |
output logic dec_pmp_read_d, // pmp CSR address match | |
output el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES], | |
output logic [31:0] pmp_pmpaddr[pt.PMP_ENTRIES], | |
input logic scan_mode | |
); | |
logic wr_pmpcfg_r; | |
logic [3:0] wr_pmpcfg_group; | |
logic wr_pmpaddr0_sel; | |
logic wr_pmpaddr16_sel; | |
logic wr_pmpaddr32_sel; | |
logic wr_pmpaddr48_sel; | |
logic wr_pmpaddr_r; | |
logic [1:0] wr_pmpaddr_quarter; | |
logic [5:0] wr_pmpaddr_address; | |
logic [3:0] pmp_quarter_rdaddr; | |
logic [31:0] pmp_pmpcfg_rddata; | |
// ---------------------------------------------------------------------- | |
// PMPCFGx (RW) | |
// [31:24] : PMP entry (x*4 + 3) configuration | |
// [23:16] : PMP entry (x*4 + 2) configuration | |
// [15:8] : PMP entry (x*4 + 1) configuration | |
// [7:0] : PMP entry (x*4 + 0) configuration | |
localparam PMPCFG = 12'h3a0; | |
assign wr_pmpcfg_r = dec_csr_wen_r_mod & (dec_csr_wraddr_r[11:4] == PMPCFG[11:4]); | |
assign wr_pmpcfg_group = dec_csr_wraddr_r[3:0]; // selects group of 4 pmpcfg entries (group 1 -> entries 4-7; up to 16 groups) | |
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpcfg_ff | |
rvdffe #(8) pmpcfg_ff ( | |
.*, | |
.clk (free_l2clk), | |
.en (wr_pmpcfg_r & (wr_pmpcfg_group == entry_idx[5:2]) & (~pmp_pmpcfg[entry_idx].lock)), | |
.din (dec_csr_wrdata_r[(entry_idx[1:0]*8)+7:(entry_idx[1:0]*8)+0] & 8'b10011111), | |
.dout(pmp_pmpcfg[entry_idx]) | |
); | |
end | |
// ---------------------------------------------------------------------- | |
// PMPADDRx (RW) | |
// [31:0] : PMP entry (x) address selector (word addressing) | |
// | |
// NOTE: VeeR-EL2 uses 32-bit physical addressing, register bits 31:30 mapping | |
// to bits 33:32 of the physical address are always set to 0. (WARL) | |
localparam PMPADDR0 = 12'h3b0; | |
localparam PMPADDR16 = 12'h3c0; | |
localparam PMPADDR32 = 12'h3d0; | |
localparam PMPADDR48 = 12'h3e0; | |
assign wr_pmpaddr0_sel = dec_csr_wraddr_r[11:4] == PMPADDR0[11:4]; | |
assign wr_pmpaddr16_sel = dec_csr_wraddr_r[11:4] == PMPADDR16[11:4]; | |
assign wr_pmpaddr32_sel = dec_csr_wraddr_r[11:4] == PMPADDR32[11:4]; | |
assign wr_pmpaddr48_sel = dec_csr_wraddr_r[11:4] == PMPADDR48[11:4]; | |
assign wr_pmpaddr_r = dec_csr_wen_r_mod & (wr_pmpaddr0_sel | wr_pmpaddr16_sel | wr_pmpaddr32_sel | wr_pmpaddr48_sel); | |
assign wr_pmpaddr_quarter[0] = wr_pmpaddr16_sel | wr_pmpaddr48_sel; | |
assign wr_pmpaddr_quarter[1] = wr_pmpaddr32_sel | wr_pmpaddr48_sel; | |
assign wr_pmpaddr_address = {wr_pmpaddr_quarter, dec_csr_wraddr_r[3:0]}; // entry address | |
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpaddr_ff | |
assign pmp_pmpaddr[entry_idx][31:30] = 2'b00; | |
rvdffe #(30) pmpaddr_ff ( | |
.*, | |
.clk (free_l2clk), | |
.en (wr_pmpaddr_r & (wr_pmpaddr_address == entry_idx) & (~pmp_pmpcfg[entry_idx].lock)), | |
.din (dec_csr_wrdata_r[29:0]), | |
.dout(pmp_pmpaddr[entry_idx][29:0]) | |
); | |
end | |
// CSR read mux | |
assign pmp_quarter_rdaddr = dec_csr_rdaddr_d[3:0]; | |
assign pmp_pmpcfg_rddata = { | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h3}], | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h2}], | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h1}], | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h0}] | |
}; | |
assign dec_pmp_read_d = csr_pmpcfg | csr_pmpaddr0 | csr_pmpaddr16 | csr_pmpaddr32 | csr_pmpaddr48; | |
assign dec_pmp_rddata_d[31:0] = ( ({32{csr_pmpcfg}} & pmp_pmpcfg_rddata) | |
({32{csr_pmpaddr48}} & pmp_pmpaddr[{2'h3, pmp_quarter_rdaddr}]) | ||
); | ||
|
||
endmodule // dec_pmp_ctl |
There was a problem hiding this comment.
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 🐶
endmodule // dec_pmp_ctl | |
endmodule // dec_pmp_ctl |
|
||
assign csr_mhpme5 = (dec_csr_rdaddr_d[5]&!dec_csr_rdaddr_d[4] | ||
&!dec_csr_rdaddr_d[3]&dec_csr_rdaddr_d[2]&!dec_csr_rdaddr_d[1] | ||
assign csr_mhpme5 = (!dec_csr_rdaddr_d[7]&dec_csr_rdaddr_d[5] |
There was a problem hiding this comment.
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 🐶
assign csr_mhpme5 = (!dec_csr_rdaddr_d[7]&dec_csr_rdaddr_d[5] | |
assign csr_mhpme5 = (!dec_csr_rdaddr_d[7]&dec_csr_rdaddr_d[5] |
&dec_csr_rdaddr_d[0]); | ||
|
||
assign csr_mhpme6 = (dec_csr_rdaddr_d[5]&!dec_csr_rdaddr_d[4] | ||
&!dec_csr_rdaddr_d[3]&dec_csr_rdaddr_d[2]&dec_csr_rdaddr_d[1] | ||
assign csr_mhpme6 = (!dec_csr_rdaddr_d[7]&dec_csr_rdaddr_d[5] |
There was a problem hiding this comment.
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 🐶
assign csr_mhpme6 = (!dec_csr_rdaddr_d[7]&dec_csr_rdaddr_d[5] | |
assign csr_mhpme6 = (!dec_csr_rdaddr_d[7]&dec_csr_rdaddr_d[5] |
assign csr_mhpme6 = (dec_csr_rdaddr_d[5]&!dec_csr_rdaddr_d[4] | ||
&!dec_csr_rdaddr_d[3]&dec_csr_rdaddr_d[2]&dec_csr_rdaddr_d[1] | ||
assign csr_mhpme6 = (!dec_csr_rdaddr_d[7]&dec_csr_rdaddr_d[5] | ||
&!dec_csr_rdaddr_d[4]&!dec_csr_rdaddr_d[3]&dec_csr_rdaddr_d[1] | ||
&!dec_csr_rdaddr_d[0]); | ||
|
||
assign csr_mcountinhibit = (!dec_csr_rdaddr_d[7]&dec_csr_rdaddr_d[5] |
There was a problem hiding this comment.
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 🐶
assign csr_mcountinhibit = (!dec_csr_rdaddr_d[7]&dec_csr_rdaddr_d[5] | |
assign csr_mcountinhibit = (!dec_csr_rdaddr_d[7]&dec_csr_rdaddr_d[5] |
&!dec_csr_rdaddr_d[0]); | ||
|
||
assign csr_mcountinhibit = (!dec_csr_rdaddr_d[7]&dec_csr_rdaddr_d[5] | ||
&!dec_csr_rdaddr_d[4]&!dec_csr_rdaddr_d[3]&!dec_csr_rdaddr_d[2] | ||
&!dec_csr_rdaddr_d[0]); | ||
|
||
assign csr_mitctl0 = (dec_csr_rdaddr_d[6]&!dec_csr_rdaddr_d[5] | ||
&dec_csr_rdaddr_d[4]&!dec_csr_rdaddr_d[1]&!dec_csr_rdaddr_d[0]); | ||
assign csr_mitctl0 = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[6] |
There was a problem hiding this comment.
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 🐶
assign csr_mitctl0 = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[6] | |
assign csr_mitctl0 = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[6] |
|
||
assign csr_mitctl1 = (dec_csr_rdaddr_d[6]&!dec_csr_rdaddr_d[3] | ||
assign csr_mitctl1 = (dec_csr_rdaddr_d[10]&!dec_csr_rdaddr_d[3] |
There was a problem hiding this comment.
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 🐶
assign csr_mitctl1 = (dec_csr_rdaddr_d[10]&!dec_csr_rdaddr_d[3] | |
assign csr_mitctl1 = (dec_csr_rdaddr_d[10]&!dec_csr_rdaddr_d[3] |
Links to coverage and verification reports for this PR (#119) are available at https://chipsalliance.github.io/Cores-VeeR-EL2/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
verible-verilog-format
design/el2_pmp.sv|72|
design/el2_pmp.sv|80|
design/el2_pmp.sv|105|
design/el2_pmp.sv|108|
design/el2_pmp.sv|137|
design/el2_pmp.sv|152|
design/el2_pmp.sv|159|
design/el2_pmp.sv|171|
design/el2_pmp.sv|182|
design/el2_pmp.sv|186|
design/ifu/el2_ifu.sv|196|
design/ifu/el2_ifu.sv|211|
design/ifu/el2_ifu.sv|216|
design/ifu/el2_ifu_mem_ctl.sv|1656|
design/ifu/el2_ifu_mem_ctl.sv|1671|
design/ifu/el2_ifu_mem_ctl.sv|1674|
design/lsu/el2_lsu_addrcheck.sv|50|
design/lsu/el2_lsu_addrcheck.sv|53|
design/lsu/el2_lsu_addrcheck.sv|56|
design/lsu/el2_lsu_addrcheck.sv|133|
`include "el2_param.vh" | ||
) | ||
( | ||
input logic clk, | ||
input logic free_l2clk, | ||
input logic csr_wr_clk, | ||
input logic rst_l, | ||
input logic dec_csr_wen_r_mod, // csr write enable at wb | ||
input logic [11:0] dec_csr_wraddr_r, // write address for csr | ||
input logic [31:0] dec_csr_wrdata_r, // csr write data at wb | ||
input logic [11:0] dec_csr_rdaddr_d, // read address for csr | ||
|
||
input logic csr_pmpcfg, | ||
input logic csr_pmpaddr0, | ||
input logic csr_pmpaddr16, | ||
input logic csr_pmpaddr32, | ||
input logic csr_pmpaddr48, | ||
|
||
input logic dec_pause_state, // Paused | ||
input logic dec_tlu_pmu_fw_halted, // pmu/fw halted | ||
input logic internal_dbg_halt_timers, // debug halted | ||
|
||
output logic [31:0] dec_pmp_rddata_d, // pmp CSR read data | ||
output logic dec_pmp_read_d, // pmp CSR address match | ||
|
||
output el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES], | ||
output logic [31:0] pmp_pmpaddr [pt.PMP_ENTRIES], | ||
|
||
input logic scan_mode | ||
); | ||
|
||
logic wr_pmpcfg_r; | ||
logic [3:0] wr_pmpcfg_group; | ||
|
||
logic wr_pmpaddr0_sel; | ||
logic wr_pmpaddr16_sel; | ||
logic wr_pmpaddr32_sel; | ||
logic wr_pmpaddr48_sel; | ||
logic wr_pmpaddr_r; | ||
logic [1:0] wr_pmpaddr_quarter; | ||
logic [5:0] wr_pmpaddr_address; | ||
|
||
logic [3:0] pmp_quarter_rdaddr; | ||
logic [31:0] pmp_pmpcfg_rddata; | ||
|
||
// ---------------------------------------------------------------------- | ||
// PMPCFGx (RW) | ||
// [31:24] : PMP entry (x*4 + 3) configuration | ||
// [23:16] : PMP entry (x*4 + 2) configuration | ||
// [15:8] : PMP entry (x*4 + 1) configuration | ||
// [7:0] : PMP entry (x*4 + 0) configuration | ||
|
||
localparam PMPCFG = 12'h3a0; | ||
|
||
assign wr_pmpcfg_r = dec_csr_wen_r_mod & (dec_csr_wraddr_r[11:4] == PMPCFG[11:4]); | ||
assign wr_pmpcfg_group = dec_csr_wraddr_r[3:0]; // selects group of 4 pmpcfg entries (group 1 -> entries 4-7; up to 16 groups) | ||
|
||
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpcfg_ff | ||
rvdffe #(8) pmpcfg_ff (.*, .clk(free_l2clk), | ||
.en(wr_pmpcfg_r & (wr_pmpcfg_group == entry_idx[5:2]) & (~pmp_pmpcfg[entry_idx].lock)), | ||
.din(dec_csr_wrdata_r[(entry_idx[1:0]*8)+7:(entry_idx[1:0]*8)+0] & 8'b10011111), | ||
.dout(pmp_pmpcfg[entry_idx])); | ||
end | ||
|
||
// ---------------------------------------------------------------------- | ||
// PMPADDRx (RW) | ||
// [31:0] : PMP entry (x) address selector (word addressing) | ||
// | ||
// NOTE: VeeR-EL2 uses 32-bit physical addressing, register bits 31:30 mapping | ||
// to bits 33:32 of the physical address are always set to 0. (WARL) | ||
|
||
localparam PMPADDR0 = 12'h3b0; | ||
localparam PMPADDR16 = 12'h3c0; | ||
localparam PMPADDR32 = 12'h3d0; | ||
localparam PMPADDR48 = 12'h3e0; | ||
|
||
assign wr_pmpaddr0_sel = dec_csr_wraddr_r[11:4] == PMPADDR0[11:4]; | ||
assign wr_pmpaddr16_sel = dec_csr_wraddr_r[11:4] == PMPADDR16[11:4]; | ||
assign wr_pmpaddr32_sel = dec_csr_wraddr_r[11:4] == PMPADDR32[11:4]; | ||
assign wr_pmpaddr48_sel = dec_csr_wraddr_r[11:4] == PMPADDR48[11:4]; | ||
assign wr_pmpaddr_r = dec_csr_wen_r_mod & (wr_pmpaddr0_sel | wr_pmpaddr16_sel | wr_pmpaddr32_sel | wr_pmpaddr48_sel); | ||
|
||
assign wr_pmpaddr_quarter[0] = wr_pmpaddr16_sel | wr_pmpaddr48_sel; | ||
assign wr_pmpaddr_quarter[1] = wr_pmpaddr32_sel | wr_pmpaddr48_sel; | ||
assign wr_pmpaddr_address = {wr_pmpaddr_quarter, dec_csr_wraddr_r[3:0]}; // entry address | ||
|
||
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpaddr_ff | ||
logic pmpaddr_lock; | ||
logic pmpaddr_lock_next; | ||
assign pmpaddr_lock_next = ((entry_idx+1 < pt.PMP_ENTRIES) |
There was a problem hiding this comment.
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 🐶
`include "el2_param.vh" | |
) | |
( | |
input logic clk, | |
input logic free_l2clk, | |
input logic csr_wr_clk, | |
input logic rst_l, | |
input logic dec_csr_wen_r_mod, // csr write enable at wb | |
input logic [11:0] dec_csr_wraddr_r, // write address for csr | |
input logic [31:0] dec_csr_wrdata_r, // csr write data at wb | |
input logic [11:0] dec_csr_rdaddr_d, // read address for csr | |
input logic csr_pmpcfg, | |
input logic csr_pmpaddr0, | |
input logic csr_pmpaddr16, | |
input logic csr_pmpaddr32, | |
input logic csr_pmpaddr48, | |
input logic dec_pause_state, // Paused | |
input logic dec_tlu_pmu_fw_halted, // pmu/fw halted | |
input logic internal_dbg_halt_timers, // debug halted | |
output logic [31:0] dec_pmp_rddata_d, // pmp CSR read data | |
output logic dec_pmp_read_d, // pmp CSR address match | |
output el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES], | |
output logic [31:0] pmp_pmpaddr [pt.PMP_ENTRIES], | |
input logic scan_mode | |
); | |
logic wr_pmpcfg_r; | |
logic [3:0] wr_pmpcfg_group; | |
logic wr_pmpaddr0_sel; | |
logic wr_pmpaddr16_sel; | |
logic wr_pmpaddr32_sel; | |
logic wr_pmpaddr48_sel; | |
logic wr_pmpaddr_r; | |
logic [1:0] wr_pmpaddr_quarter; | |
logic [5:0] wr_pmpaddr_address; | |
logic [3:0] pmp_quarter_rdaddr; | |
logic [31:0] pmp_pmpcfg_rddata; | |
// ---------------------------------------------------------------------- | |
// PMPCFGx (RW) | |
// [31:24] : PMP entry (x*4 + 3) configuration | |
// [23:16] : PMP entry (x*4 + 2) configuration | |
// [15:8] : PMP entry (x*4 + 1) configuration | |
// [7:0] : PMP entry (x*4 + 0) configuration | |
localparam PMPCFG = 12'h3a0; | |
assign wr_pmpcfg_r = dec_csr_wen_r_mod & (dec_csr_wraddr_r[11:4] == PMPCFG[11:4]); | |
assign wr_pmpcfg_group = dec_csr_wraddr_r[3:0]; // selects group of 4 pmpcfg entries (group 1 -> entries 4-7; up to 16 groups) | |
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpcfg_ff | |
rvdffe #(8) pmpcfg_ff (.*, .clk(free_l2clk), | |
.en(wr_pmpcfg_r & (wr_pmpcfg_group == entry_idx[5:2]) & (~pmp_pmpcfg[entry_idx].lock)), | |
.din(dec_csr_wrdata_r[(entry_idx[1:0]*8)+7:(entry_idx[1:0]*8)+0] & 8'b10011111), | |
.dout(pmp_pmpcfg[entry_idx])); | |
end | |
// ---------------------------------------------------------------------- | |
// PMPADDRx (RW) | |
// [31:0] : PMP entry (x) address selector (word addressing) | |
// | |
// NOTE: VeeR-EL2 uses 32-bit physical addressing, register bits 31:30 mapping | |
// to bits 33:32 of the physical address are always set to 0. (WARL) | |
localparam PMPADDR0 = 12'h3b0; | |
localparam PMPADDR16 = 12'h3c0; | |
localparam PMPADDR32 = 12'h3d0; | |
localparam PMPADDR48 = 12'h3e0; | |
assign wr_pmpaddr0_sel = dec_csr_wraddr_r[11:4] == PMPADDR0[11:4]; | |
assign wr_pmpaddr16_sel = dec_csr_wraddr_r[11:4] == PMPADDR16[11:4]; | |
assign wr_pmpaddr32_sel = dec_csr_wraddr_r[11:4] == PMPADDR32[11:4]; | |
assign wr_pmpaddr48_sel = dec_csr_wraddr_r[11:4] == PMPADDR48[11:4]; | |
assign wr_pmpaddr_r = dec_csr_wen_r_mod & (wr_pmpaddr0_sel | wr_pmpaddr16_sel | wr_pmpaddr32_sel | wr_pmpaddr48_sel); | |
assign wr_pmpaddr_quarter[0] = wr_pmpaddr16_sel | wr_pmpaddr48_sel; | |
assign wr_pmpaddr_quarter[1] = wr_pmpaddr32_sel | wr_pmpaddr48_sel; | |
assign wr_pmpaddr_address = {wr_pmpaddr_quarter, dec_csr_wraddr_r[3:0]}; // entry address | |
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpaddr_ff | |
logic pmpaddr_lock; | |
logic pmpaddr_lock_next; | |
assign pmpaddr_lock_next = ((entry_idx+1 < pt.PMP_ENTRIES) | |
`include "el2_param.vh" | |
) ( | |
input logic clk, | |
input logic free_l2clk, | |
input logic csr_wr_clk, | |
input logic rst_l, | |
input logic dec_csr_wen_r_mod, // csr write enable at wb | |
input logic [11:0] dec_csr_wraddr_r, // write address for csr | |
input logic [31:0] dec_csr_wrdata_r, // csr write data at wb | |
input logic [11:0] dec_csr_rdaddr_d, // read address for csr | |
input logic csr_pmpcfg, | |
input logic csr_pmpaddr0, | |
input logic csr_pmpaddr16, | |
input logic csr_pmpaddr32, | |
input logic csr_pmpaddr48, | |
input logic dec_pause_state, // Paused | |
input logic dec_tlu_pmu_fw_halted, // pmu/fw halted | |
input logic internal_dbg_halt_timers, // debug halted | |
output logic [31:0] dec_pmp_rddata_d, // pmp CSR read data | |
output logic dec_pmp_read_d, // pmp CSR address match | |
output el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES], | |
output logic [31:0] pmp_pmpaddr[pt.PMP_ENTRIES], | |
input logic scan_mode | |
); | |
logic wr_pmpcfg_r; | |
logic [3:0] wr_pmpcfg_group; | |
logic wr_pmpaddr0_sel; | |
logic wr_pmpaddr16_sel; | |
logic wr_pmpaddr32_sel; | |
logic wr_pmpaddr48_sel; | |
logic wr_pmpaddr_r; | |
logic [1:0] wr_pmpaddr_quarter; | |
logic [5:0] wr_pmpaddr_address; | |
logic [3:0] pmp_quarter_rdaddr; | |
logic [31:0] pmp_pmpcfg_rddata; | |
// ---------------------------------------------------------------------- | |
// PMPCFGx (RW) | |
// [31:24] : PMP entry (x*4 + 3) configuration | |
// [23:16] : PMP entry (x*4 + 2) configuration | |
// [15:8] : PMP entry (x*4 + 1) configuration | |
// [7:0] : PMP entry (x*4 + 0) configuration | |
localparam PMPCFG = 12'h3a0; | |
assign wr_pmpcfg_r = dec_csr_wen_r_mod & (dec_csr_wraddr_r[11:4] == PMPCFG[11:4]); | |
assign wr_pmpcfg_group = dec_csr_wraddr_r[3:0]; // selects group of 4 pmpcfg entries (group 1 -> entries 4-7; up to 16 groups) | |
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpcfg_ff | |
rvdffe #(8) pmpcfg_ff ( | |
.*, | |
.clk (free_l2clk), | |
.en (wr_pmpcfg_r & (wr_pmpcfg_group == entry_idx[5:2]) & (~pmp_pmpcfg[entry_idx].lock)), | |
.din (dec_csr_wrdata_r[(entry_idx[1:0]*8)+7:(entry_idx[1:0]*8)+0] & 8'b10011111), | |
.dout(pmp_pmpcfg[entry_idx]) | |
); | |
end | |
// ---------------------------------------------------------------------- | |
// PMPADDRx (RW) | |
// [31:0] : PMP entry (x) address selector (word addressing) | |
// | |
// NOTE: VeeR-EL2 uses 32-bit physical addressing, register bits 31:30 mapping | |
// to bits 33:32 of the physical address are always set to 0. (WARL) | |
localparam PMPADDR0 = 12'h3b0; | |
localparam PMPADDR16 = 12'h3c0; | |
localparam PMPADDR32 = 12'h3d0; | |
localparam PMPADDR48 = 12'h3e0; | |
assign wr_pmpaddr0_sel = dec_csr_wraddr_r[11:4] == PMPADDR0[11:4]; | |
assign wr_pmpaddr16_sel = dec_csr_wraddr_r[11:4] == PMPADDR16[11:4]; | |
assign wr_pmpaddr32_sel = dec_csr_wraddr_r[11:4] == PMPADDR32[11:4]; | |
assign wr_pmpaddr48_sel = dec_csr_wraddr_r[11:4] == PMPADDR48[11:4]; | |
assign wr_pmpaddr_r = dec_csr_wen_r_mod & (wr_pmpaddr0_sel | wr_pmpaddr16_sel | wr_pmpaddr32_sel | wr_pmpaddr48_sel); | |
assign wr_pmpaddr_quarter[0] = wr_pmpaddr16_sel | wr_pmpaddr48_sel; | |
assign wr_pmpaddr_quarter[1] = wr_pmpaddr32_sel | wr_pmpaddr48_sel; | |
assign wr_pmpaddr_address = {wr_pmpaddr_quarter, dec_csr_wraddr_r[3:0]}; // entry address | |
for (genvar entry_idx = 0; entry_idx < pt.PMP_ENTRIES; entry_idx++) begin : gen_pmpaddr_ff | |
logic pmpaddr_lock; | |
logic pmpaddr_lock_next; | |
assign pmpaddr_lock_next = ((entry_idx+1 < pt.PMP_ENTRIES) |
assign pmpaddr_lock = pmp_pmpcfg[entry_idx].lock | pmpaddr_lock_next; | ||
assign pmp_pmpaddr[entry_idx][31:30] = 2'b00; | ||
rvdffe #(30) pmpaddr_ff (.*, .clk(free_l2clk), | ||
.en(wr_pmpaddr_r & (wr_pmpaddr_address == entry_idx) | ||
& (~pmpaddr_lock)), | ||
.din(dec_csr_wrdata_r[29:0]), | ||
.dout(pmp_pmpaddr[entry_idx][29:0])); | ||
end | ||
|
||
// CSR read mux | ||
|
||
assign pmp_quarter_rdaddr = dec_csr_rdaddr_d[3:0]; | ||
assign pmp_pmpcfg_rddata = { pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h3}], | ||
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h2}], | ||
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h1}], | ||
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h0}] | ||
}; | ||
assign dec_pmp_read_d = csr_pmpcfg | csr_pmpaddr0 | csr_pmpaddr16 | csr_pmpaddr32 | csr_pmpaddr48; | ||
assign dec_pmp_rddata_d[31:0] = ( ({32{csr_pmpcfg}} & pmp_pmpcfg_rddata) | |
There was a problem hiding this comment.
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 🐶
assign pmpaddr_lock = pmp_pmpcfg[entry_idx].lock | pmpaddr_lock_next; | |
assign pmp_pmpaddr[entry_idx][31:30] = 2'b00; | |
rvdffe #(30) pmpaddr_ff (.*, .clk(free_l2clk), | |
.en(wr_pmpaddr_r & (wr_pmpaddr_address == entry_idx) | |
& (~pmpaddr_lock)), | |
.din(dec_csr_wrdata_r[29:0]), | |
.dout(pmp_pmpaddr[entry_idx][29:0])); | |
end | |
// CSR read mux | |
assign pmp_quarter_rdaddr = dec_csr_rdaddr_d[3:0]; | |
assign pmp_pmpcfg_rddata = { pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h3}], | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h2}], | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h1}], | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h0}] | |
}; | |
assign dec_pmp_read_d = csr_pmpcfg | csr_pmpaddr0 | csr_pmpaddr16 | csr_pmpaddr32 | csr_pmpaddr48; | |
assign dec_pmp_rddata_d[31:0] = ( ({32{csr_pmpcfg}} & pmp_pmpcfg_rddata) | | |
assign pmpaddr_lock = pmp_pmpcfg[entry_idx].lock | pmpaddr_lock_next; | |
assign pmp_pmpaddr[entry_idx][31:30] = 2'b00; | |
rvdffe #(30) pmpaddr_ff ( | |
.*, | |
.clk (free_l2clk), | |
.en (wr_pmpaddr_r & (wr_pmpaddr_address == entry_idx) & (~pmpaddr_lock)), | |
.din (dec_csr_wrdata_r[29:0]), | |
.dout(pmp_pmpaddr[entry_idx][29:0]) | |
); | |
end | |
// CSR read mux | |
assign pmp_quarter_rdaddr = dec_csr_rdaddr_d[3:0]; | |
assign pmp_pmpcfg_rddata = { | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h3}], | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h2}], | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h1}], | |
pmp_pmpcfg[{pmp_quarter_rdaddr, 2'h0}] | |
}; | |
assign dec_pmp_read_d = csr_pmpcfg | csr_pmpaddr0 | csr_pmpaddr16 | csr_pmpaddr32 | csr_pmpaddr48; | |
assign dec_pmp_rddata_d[31:0] = ( ({32{csr_pmpcfg}} & pmp_pmpcfg_rddata) | |
&dec_csr_rdaddr_d[2]&dec_csr_rdaddr_d[1]&dec_csr_rdaddr_d[0]); | ||
|
||
assign csr_mitb0 = (dec_csr_rdaddr_d[6]&!dec_csr_rdaddr_d[5]&dec_csr_rdaddr_d[4] | ||
&!dec_csr_rdaddr_d[2]&dec_csr_rdaddr_d[0]); | ||
assign csr_mitb0 = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[6]&!dec_csr_rdaddr_d[3] |
There was a problem hiding this comment.
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 🐶
assign csr_mitb0 = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[6]&!dec_csr_rdaddr_d[3] | |
assign csr_mitb0 = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[6]&!dec_csr_rdaddr_d[3] |
|
||
assign csr_mitb1 = (dec_csr_rdaddr_d[6]&dec_csr_rdaddr_d[4]&dec_csr_rdaddr_d[2] | ||
assign csr_mitb1 = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[4]&dec_csr_rdaddr_d[2] |
There was a problem hiding this comment.
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 🐶
assign csr_mitb1 = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[4]&dec_csr_rdaddr_d[2] | |
assign csr_mitb1 = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[4]&dec_csr_rdaddr_d[2] |
&dec_csr_rdaddr_d[1]&!dec_csr_rdaddr_d[0]); | ||
|
||
assign csr_mitcnt0 = (dec_csr_rdaddr_d[6]&!dec_csr_rdaddr_d[5] | ||
&dec_csr_rdaddr_d[4]&!dec_csr_rdaddr_d[2]&!dec_csr_rdaddr_d[0]); | ||
assign csr_mitcnt0 = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[6] |
There was a problem hiding this comment.
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 🐶
assign csr_mitcnt0 = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[6] | |
assign csr_mitcnt0 = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[6] |
&!dec_csr_rdaddr_d[2]&dec_csr_rdaddr_d[0]) | (dec_csr_rdaddr_d[11] | ||
&!dec_csr_rdaddr_d[4]&!dec_csr_rdaddr_d[3]&dec_csr_rdaddr_d[2] | ||
&!dec_csr_rdaddr_d[1]) | (dec_csr_rdaddr_d[11]&!dec_csr_rdaddr_d[4] | ||
&!dec_csr_rdaddr_d[3]&dec_csr_rdaddr_d[1]&!dec_csr_rdaddr_d[0]); | ||
|
||
assign postsync = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[4]&dec_csr_rdaddr_d[3] |
There was a problem hiding this comment.
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 🐶
assign postsync = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[4]&dec_csr_rdaddr_d[3] | |
assign postsync = (dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[4]&dec_csr_rdaddr_d[3] |
&!dec_csr_rdaddr_d[4]&!dec_csr_rdaddr_d[3]&!dec_csr_rdaddr_d[1]) | ( | ||
dec_csr_rdaddr_d[10]&!dec_csr_rdaddr_d[4]&!dec_csr_rdaddr_d[3] | ||
&!dec_csr_rdaddr_d[2]&dec_csr_rdaddr_d[1]) | (!dec_csr_rdaddr_d[7] | ||
&dec_csr_rdaddr_d[6]&!dec_csr_rdaddr_d[1]&dec_csr_rdaddr_d[0]); | ||
|
||
assign legal = (!dec_csr_rdaddr_d[11]&dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[9] |
There was a problem hiding this comment.
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 🐶
assign legal = (!dec_csr_rdaddr_d[11]&dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[9] | |
assign legal = (!dec_csr_rdaddr_d[11]&dec_csr_rdaddr_d[10]&dec_csr_rdaddr_d[9] |
design/el2_pmp.sv
Outdated
// limitations under the License. | ||
|
||
module el2_pmp | ||
import el2_pkg::*; |
There was a problem hiding this comment.
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 🐶
import el2_pkg::*; | |
import el2_pkg::*; |
design/el2_pmp.sv
Outdated
parameter PMP_CHANNELS = 3, | ||
// Granularity of NAPOT access, | ||
// 0 = No restriction, 1 = 8 byte, 2 = 16 byte, 3 = 32 byte, etc. | ||
parameter PMP_GRANULARITY = 0, // TODO: Move to veer.config | ||
`include "el2_param.vh" | ||
) | ||
( | ||
input logic clk, // Top level clock | ||
input logic rst_l, // Reset | ||
input logic scan_mode, // Scan mode | ||
|
||
input el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES], | ||
input logic [31:0] pmp_pmpaddr [pt.PMP_ENTRIES], | ||
|
||
input logic [31:0] pmp_chan_addr [PMP_CHANNELS], | ||
input el2_pmp_type_pkt_t pmp_chan_type [PMP_CHANNELS], | ||
output logic pmp_chan_err [PMP_CHANNELS] | ||
); | ||
|
||
logic [33:0] csr_pmp_addr_i [pt.PMP_ENTRIES]; | ||
logic [33:0] pmp_req_addr_i [PMP_CHANNELS]; | ||
|
||
logic [33:0] region_start_addr [pt.PMP_ENTRIES]; | ||
logic [33:PMP_GRANULARITY+2] region_addr_mask [pt.PMP_ENTRIES]; | ||
logic [PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_match_gt; | ||
logic [PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_match_lt; | ||
logic [PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_match_eq; | ||
logic [PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_match_all; | ||
logic [PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_basic_perm_check; | ||
logic [PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_perm_check; |
There was a problem hiding this comment.
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 🐶
parameter PMP_CHANNELS = 3, | |
// Granularity of NAPOT access, | |
// 0 = No restriction, 1 = 8 byte, 2 = 16 byte, 3 = 32 byte, etc. | |
parameter PMP_GRANULARITY = 0, // TODO: Move to veer.config | |
`include "el2_param.vh" | |
) | |
( | |
input logic clk, // Top level clock | |
input logic rst_l, // Reset | |
input logic scan_mode, // Scan mode | |
input el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES], | |
input logic [31:0] pmp_pmpaddr [pt.PMP_ENTRIES], | |
input logic [31:0] pmp_chan_addr [PMP_CHANNELS], | |
input el2_pmp_type_pkt_t pmp_chan_type [PMP_CHANNELS], | |
output logic pmp_chan_err [PMP_CHANNELS] | |
); | |
logic [33:0] csr_pmp_addr_i [pt.PMP_ENTRIES]; | |
logic [33:0] pmp_req_addr_i [PMP_CHANNELS]; | |
logic [33:0] region_start_addr [pt.PMP_ENTRIES]; | |
logic [33:PMP_GRANULARITY+2] region_addr_mask [pt.PMP_ENTRIES]; | |
logic [PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_match_gt; | |
logic [PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_match_lt; | |
logic [PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_match_eq; | |
logic [PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_match_all; | |
logic [PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_basic_perm_check; | |
logic [PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_perm_check; | |
parameter PMP_CHANNELS = 3, | |
// Granularity of NAPOT access, | |
// 0 = No restriction, 1 = 8 byte, 2 = 16 byte, 3 = 32 byte, etc. | |
parameter PMP_GRANULARITY = 0, // TODO: Move to veer.config | |
`include "el2_param.vh" | |
) ( | |
input logic clk, // Top level clock | |
input logic rst_l, // Reset | |
input logic scan_mode, // Scan mode | |
input el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES], | |
input logic [31:0] pmp_pmpaddr[pt.PMP_ENTRIES], | |
input logic [31:0] pmp_chan_addr[PMP_CHANNELS], | |
input el2_pmp_type_pkt_t pmp_chan_type[PMP_CHANNELS], | |
output logic pmp_chan_err [PMP_CHANNELS] | |
); | |
logic [ 33:0] csr_pmp_addr_i [pt.PMP_ENTRIES]; | |
logic [ 33:0] pmp_req_addr_i [ PMP_CHANNELS]; | |
logic [ 33:0] region_start_addr [pt.PMP_ENTRIES]; | |
logic [33:PMP_GRANULARITY+2] region_addr_mask [pt.PMP_ENTRIES]; | |
logic [ PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_match_gt; | |
logic [ PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_match_lt; | |
logic [ PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_match_eq; | |
logic [ PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_match_all; | |
logic [ PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_basic_perm_check; | |
logic [ PMP_CHANNELS-1:0][pt.PMP_ENTRIES-1:0] region_perm_check; |
design/el2_pmp.sv
Outdated
logic permission_check); | ||
return orig_perm_check(csr_pmp_cfg.lock, | ||
permission_check); |
There was a problem hiding this comment.
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 🐶
logic permission_check); | |
return orig_perm_check(csr_pmp_cfg.lock, | |
permission_check); | |
logic permission_check); | |
return orig_perm_check(csr_pmp_cfg.lock, permission_check); |
el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES]; | ||
logic [31:0] pmp_pmpaddr [pt.PMP_ENTRIES]; | ||
logic [31:0] pmp_chan_addr [3]; | ||
el2_pmp_type_pkt_t pmp_chan_type [3]; | ||
logic pmp_chan_err [3]; |
There was a problem hiding this comment.
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 🐶
el2_pmp_cfg_pkt_t pmp_pmpcfg [pt.PMP_ENTRIES]; | |
logic [31:0] pmp_pmpaddr [pt.PMP_ENTRIES]; | |
logic [31:0] pmp_chan_addr [3]; | |
el2_pmp_type_pkt_t pmp_chan_type [3]; | |
logic pmp_chan_err [3]; | |
el2_pmp_cfg_pkt_t pmp_pmpcfg[pt.PMP_ENTRIES]; | |
logic [31:0] pmp_pmpaddr[pt.PMP_ENTRIES]; | |
logic [31:0] pmp_chan_addr[3]; | |
el2_pmp_type_pkt_t pmp_chan_type[3]; | |
logic pmp_chan_err[3]; |
logic pmp_chan_err [3]; | ||
|
||
logic [31:1] ifu_pmp_addr; | ||
logic ifu_pmp_error; |
There was a problem hiding this comment.
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 🐶
logic ifu_pmp_error; | |
logic ifu_pmp_error; |
logic [31:1] ifu_pmp_addr; | ||
logic ifu_pmp_error; | ||
logic [31:0] lsu_pmp_addr_start; | ||
logic lsu_pmp_error_start; |
There was a problem hiding this comment.
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 🐶
logic lsu_pmp_error_start; | |
logic lsu_pmp_error_start; |
logic lsu_pmp_error_end; | ||
logic lsu_pmp_we; | ||
logic lsu_pmp_re; |
There was a problem hiding this comment.
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 🐶
logic lsu_pmp_error_end; | |
logic lsu_pmp_we; | |
logic lsu_pmp_re; | |
logic lsu_pmp_error_end; | |
logic lsu_pmp_we; | |
logic lsu_pmp_re; |
logic lsu_pmp_error_end; | ||
logic lsu_pmp_we; | ||
logic lsu_pmp_re; | ||
|
||
// -----------------------DEBUG START ------------------------------- |
There was a problem hiding this comment.
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 🐶
// -----------------------DEBUG START ------------------------------- | |
// -----------------------DEBUG START ------------------------------- |
// this signal is used for gpr update | ||
assign lsu_result_corr_r[31:0] = ({32{ lsu_pkt_r.unsign & lsu_pkt_r.by }} & {24'b0,lsu_ld_datafn_corr_r[7:0]}) | |
There was a problem hiding this comment.
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 🐶
// this signal is used for gpr update | |
assign lsu_result_corr_r[31:0] = ({32{ lsu_pkt_r.unsign & lsu_pkt_r.by }} & {24'b0,lsu_ld_datafn_corr_r[7:0]}) | | |
// this signal is used for gpr update | |
assign lsu_result_corr_r[31:0] = ({32{ lsu_pkt_r.unsign & lsu_pkt_r.by }} & {24'b0,lsu_ld_datafn_corr_r[7:0]}) | |
end else begin: L2U1_Plus1_0 // block: L2U1_Plus1_1 | ||
logic [31:0] lsu_ld_datafn_m, lsu_ld_datafn_corr_r; |
There was a problem hiding this comment.
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 🐶
end else begin: L2U1_Plus1_0 // block: L2U1_Plus1_1 | |
logic [31:0] lsu_ld_datafn_m, lsu_ld_datafn_corr_r; | |
end else begin : L2U1_Plus1_0 // block: L2U1_Plus1_1 | |
logic [31:0] lsu_ld_datafn_m, lsu_ld_datafn_corr_r; |
// this result must look at prior stores and merge them in | ||
assign lsu_result_m[31:0] = ({32{ lsu_pkt_m.unsign & lsu_pkt_m.by }} & {24'b0,lsu_ld_datafn_m[7:0]}) | |
There was a problem hiding this comment.
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 🐶
// this result must look at prior stores and merge them in | |
assign lsu_result_m[31:0] = ({32{ lsu_pkt_m.unsign & lsu_pkt_m.by }} & {24'b0,lsu_ld_datafn_m[7:0]}) | | |
// this result must look at prior stores and merge them in | |
assign lsu_result_m[31:0] = ({32{ lsu_pkt_m.unsign & lsu_pkt_m.by }} & {24'b0,lsu_ld_datafn_m[7:0]}) | |
// this signal is used for gpr update | ||
assign lsu_result_corr_r[31:0] = ({32{ lsu_pkt_r.unsign & lsu_pkt_r.by }} & {24'b0,lsu_ld_datafn_corr_r[7:0]}) | |
There was a problem hiding this comment.
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 🐶
// this signal is used for gpr update | |
assign lsu_result_corr_r[31:0] = ({32{ lsu_pkt_r.unsign & lsu_pkt_r.by }} & {24'b0,lsu_ld_datafn_corr_r[7:0]}) | | |
// this signal is used for gpr update | |
assign lsu_result_corr_r[31:0] = ({32{ lsu_pkt_r.unsign & lsu_pkt_r.by }} & {24'b0,lsu_ld_datafn_corr_r[7:0]}) | |
({32{ lsu_pkt_r.unsign & lsu_pkt_r.half}} & {16'b0,lsu_ld_datafn_corr_r[15:0]}) | | ||
({32{~lsu_pkt_r.unsign & lsu_pkt_r.by }} & {{24{ lsu_ld_datafn_corr_r[7]}}, lsu_ld_datafn_corr_r[7:0]}) | | ||
({32{~lsu_pkt_r.unsign & lsu_pkt_r.half}} & {{16{ lsu_ld_datafn_corr_r[15]}},lsu_ld_datafn_corr_r[15:0]}) | | ||
({32{lsu_pkt_r.word}} & lsu_ld_datafn_corr_r[31:0]); | ||
end |
There was a problem hiding this comment.
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 🐶
end | |
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
verible-verilog-lint
design/dec/el2_dec.sv|447 col 101| Line length exceeds max: 100; is: 126 [Style: line-length] [line-length]
design/dec/el2_dec.sv|448 col 101| Line length exceeds max: 100; is: 104 [Style: line-length] [line-length]
design/dec/el2_dec.sv|449 col 101| Line length exceeds max: 100; is: 111 [Style: line-length] [line-length]
@@ -124,9 +127,10 @@ import el2_pkg::*; | |||
assign csr_idx[4:0] = {start_addr_d[31:28], 1'b1}; | |||
assign is_sideeffects_d = dec_tlu_mrac_ff[csr_idx] & ~(start_addr_in_dccm_region_d | start_addr_in_pic_region_d | addr_in_iccm) & lsu_pkt_d.valid & (lsu_pkt_d.store | lsu_pkt_d.load); //every region has the 2 LSB indicating ( 1: sideeffects/no_side effects, and 0: cacheable ). Ignored in internal regions | |||
assign is_aligned_d = (lsu_pkt_d.word & (start_addr_d[1:0] == 2'b0)) | | |||
(lsu_pkt_d.half & (start_addr_d[0] == 1'b0)) | | |||
lsu_pkt_d.by; | |||
(lsu_pkt_d.half & (start_addr_d[0] == 1'b0)) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 106 [Style: line-length] [line-length]
@@ -159,13 +164,21 @@ import el2_pkg::*; | |||
(end_addr_in_dccm_region_d & ~(end_addr_in_dccm_d | end_addr_in_pic_d)) | // 0. Addr in dccm/pic region but not in dccm/pic offset | |||
(start_addr_in_dccm_d & end_addr_in_pic_d) | // 0. DCCM -> PIC cross when DCCM/PIC in same region | |||
(start_addr_in_pic_d & end_addr_in_dccm_d)); // 0. DCCM -> PIC cross when DCCM/PIC in same region | |||
assign mpu_access_fault_d = (~start_addr_in_dccm_region_d & ~non_dccm_access_ok); // 3. Address is not in a populated non-dccm region | |||
if (pt.PMP_ENTRIES > 0) begin | |||
assign mpu_access_fault_d = (lsu_pmp_error_start | lsu_pmp_error_end); // X. Address is in blocked region |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 153 [Style: line-length] [line-length]
if (pt.PMP_ENTRIES > 0) begin | ||
assign mpu_access_fault_d = (lsu_pmp_error_start | lsu_pmp_error_end); // X. Address is in blocked region | ||
end else begin | ||
assign mpu_access_fault_d = (~start_addr_in_dccm_region_d & ~non_dccm_access_ok); // 3. Address is not in a populated non-dccm region |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 170 [Style: line-length] [line-length]
end else begin | ||
assign unmapped_access_fault_d = ((start_addr_in_dccm_region_d & ~start_addr_in_dccm_d) | // 0. Addr in dccm region but not in dccm offset | ||
(end_addr_in_dccm_region_d & ~end_addr_in_dccm_d) | // 0. Addr in dccm region but not in dccm offset | ||
(start_addr_in_pic_region_d & ~start_addr_in_pic_d) | // 0. Addr in picm region but not in picm offset | ||
(end_addr_in_pic_region_d & ~end_addr_in_pic_d)); // 0. Addr in picm region but not in picm offset | ||
assign mpu_access_fault_d = (~start_addr_in_pic_region_d & ~start_addr_in_dccm_region_d & ~non_dccm_access_ok); // 3. Address is not in a populated non-dccm region | ||
if (pt.PMP_ENTRIES > 0) begin | ||
assign mpu_access_fault_d = (lsu_pmp_error_start | lsu_pmp_error_end); // X. Address is in blocked region |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 158 [Style: line-length] [line-length]
if (pt.PMP_ENTRIES > 0) begin | ||
assign mpu_access_fault_d = (lsu_pmp_error_start | lsu_pmp_error_end); // X. Address is in blocked region | ||
end else begin | ||
assign mpu_access_fault_d = (~start_addr_in_pic_region_d & ~start_addr_in_dccm_region_d & ~non_dccm_access_ok); // 3. Address is not in a populated non-dccm region |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 175 [Style: line-length] [line-length]
input logic clk, // Clock only while core active. Through one clock header. For flops with second clock header built in. Connected to ACTIVE_L2CLK. | ||
input logic active_clk, // Clock only while core active. Through two clock headers. For flops without second clock header built in. | ||
input logic free_clk, // Clock always. Through two clock headers. For flops without second clock header built in. | ||
input logic free_l2clk, // Clock always. Through one clock header. For flops with second header built in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 148 [Style: line-length] [line-length]
input logic free_clk, // Clock always. Through two clock headers. For flops without second clock header built in. | ||
input logic free_l2clk, // Clock always. Through one clock header. For flops with second header built in. | ||
|
||
input logic lsu_fastint_stall_any, // needed by lsu for 2nd pass of dma with ecc correction, stall next cycle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 120 [Style: line-length] [line-length]
output logic o_cpu_halt_status, // Halt status of core (pmu/fw) | ||
output logic o_cpu_halt_ack, // Halt request ack | ||
output logic o_cpu_run_ack, // Run request ack | ||
output logic o_debug_mode_status, // Core to the PMU that core is in debug mode. When core is in debug mode, the PMU should refrain from sendng a halt or run request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 177 [Style: line-length] [line-length]
|
||
input logic [70:0] ifu_ic_debug_rd_data, // diagnostic icache read data | ||
input logic ifu_ic_debug_rd_data_valid, // diagnostic icache read data valid | ||
output el2_cache_debug_pkt_t dec_tlu_ic_diag_pkt, // packet of DICAWICS, DICAD0/1, DICAGO info for icache diagnostics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 121 [Style: line-length] [line-length]
output logic dec_tlu_flush_lower_r, // tlu flush due to late mp, exception, rfpc, or int | ||
output logic dec_tlu_flush_lower_wb, | ||
output logic [31:1] dec_tlu_flush_path_r, // tlu flush target | ||
output logic dec_tlu_i0_kill_writeb_r, // I0 is flushed, don't writeback any results to arch state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length exceeds max: 100; is: 112 [Style: line-length] [line-length]
Links to coverage and verification reports for this PR (#119) are available at https://chipsalliance.github.io/Cores-VeeR-EL2/ |
|
||
if (pt.PMP_ENTRIES == 0) begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All generate block statements must have a label [Style: generate-statements] [generate-label]
@@ -159,13 +164,21 @@ | |||
(end_addr_in_dccm_region_d & ~(end_addr_in_dccm_d | end_addr_in_pic_d)) | // 0. Addr in dccm/pic region but not in dccm/pic offset | |||
(start_addr_in_dccm_d & end_addr_in_pic_d) | // 0. DCCM -> PIC cross when DCCM/PIC in same region | |||
(start_addr_in_pic_d & end_addr_in_dccm_d)); // 0. DCCM -> PIC cross when DCCM/PIC in same region | |||
assign mpu_access_fault_d = (~start_addr_in_dccm_region_d & ~non_dccm_access_ok); // 3. Address is not in a populated non-dccm region | |||
if (pt.PMP_ENTRIES > 0) begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All generate block statements must have a label [Style: generate-statements] [generate-label]
assign mpu_access_fault_d = (~start_addr_in_dccm_region_d & ~non_dccm_access_ok); // 3. Address is not in a populated non-dccm region | ||
if (pt.PMP_ENTRIES > 0) begin | ||
assign mpu_access_fault_d = (lsu_pmp_error_start | lsu_pmp_error_end); // X. Address is in blocked region | ||
end else begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All generate block statements must have a label [Style: generate-statements] [generate-label]
end else begin | ||
assign unmapped_access_fault_d = ((start_addr_in_dccm_region_d & ~start_addr_in_dccm_d) | // 0. Addr in dccm region but not in dccm offset | ||
(end_addr_in_dccm_region_d & ~end_addr_in_dccm_d) | // 0. Addr in dccm region but not in dccm offset | ||
(start_addr_in_pic_region_d & ~start_addr_in_pic_d) | // 0. Addr in picm region but not in picm offset | ||
(end_addr_in_pic_region_d & ~end_addr_in_pic_d)); // 0. Addr in picm region but not in picm offset | ||
assign mpu_access_fault_d = (~start_addr_in_pic_region_d & ~start_addr_in_dccm_region_d & ~non_dccm_access_ok); // 3. Address is not in a populated non-dccm region | ||
if (pt.PMP_ENTRIES > 0) begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All generate block statements must have a label [Style: generate-statements] [generate-label]
assign mpu_access_fault_d = (~start_addr_in_pic_region_d & ~start_addr_in_dccm_region_d & ~non_dccm_access_ok); // 3. Address is not in a populated non-dccm region | ||
if (pt.PMP_ENTRIES > 0) begin | ||
assign mpu_access_fault_d = (lsu_pmp_error_start | lsu_pmp_error_end); // X. Address is in blocked region | ||
end else begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All generate block statements must have a label [Style: generate-statements] [generate-label]
4b7ee0a
to
bb6f49a
Compare
Links to coverage and verification reports for this PR (#119) are available at https://chipsalliance.github.io/Cores-VeeR-EL2/ |
1 similar comment
Links to coverage and verification reports for this PR (#119) are available at https://chipsalliance.github.io/Cores-VeeR-EL2/ |
…g equations Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#48351]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#48351]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#48351]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#48351]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#48979]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#48979]
…error handling Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#48979]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#48979]
…s type enum Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#48979]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#48979]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#48979]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#48979]
…set to TOR Signed-off-by: Rafal Kolucki <[email protected]>
Signed-off-by: Rafal Kolucki <[email protected]>
Signed-off-by: Rafal Kolucki <[email protected]>
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#49347]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#49347]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#49347]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#49347]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#49347]
Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#49347]
…from inlining Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#49347]
…mparing MCAUSE value Signed-off-by: Rafal Kolucki <[email protected]> Internal-tag: [#49661]
Signed-off-by: Rafal Kolucki <[email protected]>
Signed-off-by: Robert Szczepanski <[email protected]>
Signed-off-by: Robert Szczepanski <[email protected]> Internal-tag: [#49202]
Signed-off-by: Robert Szczepanski <[email protected]> Internal-tag: [#49202]
Signed-off-by: Robert Szczepanski <[email protected]>
58e9e8d
to
afbf4d0
Compare
I've rebased this branch to remove conflicts after recent |
Links to coverage and verification reports for this PR (#119) are available at https://chipsalliance.github.io/Cores-VeeR-EL2/ |
LGTM |
This PR adds Physical Memory Protection unit, compatible with RISC-V Privileged Architectures Machine-Level ISA specification. A minimal PMP software test is also added, which is used for veryfing if exceptions are properly raised on access violations. PyUVM-based tests are added as well.