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

[Scratchpads] Needed packages for scratchpads and ahb peripheral bus #2458

Open
wants to merge 34 commits into
base: feature/scratchpads
Choose a base branch
from

Conversation

CoralieAllioux
Copy link
Contributor

This PR aims at integrate features developed by Bosch :

localparam DSCR_ARBIT_NUM_IN = 3;
localparam ISCR_ARBIT_NUM_IN = 4;

typedef enum logic [$clog2(ISCR_ARBIT_NUM_IN)-1:0] {
Copy link
Contributor

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
typedef enum logic [$clog2(ISCR_ARBIT_NUM_IN)-1:0] {
typedef enum logic [$clog2(
ISCR_ARBIT_NUM_IN
)-1:0] {

ISCR_ARBIT_FRONTEND
} iscr_arbit_e;

typedef enum logic [$clog2(DSCR_ARBIT_NUM_IN)-1:0] {
Copy link
Contributor

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
typedef enum logic [$clog2(DSCR_ARBIT_NUM_IN)-1:0] {
typedef enum logic [$clog2(
DSCR_ARBIT_NUM_IN
)-1:0] {

Copy link
Contributor

✔️ successful run, report available here.

Comment on lines +9 to +12
module address_decoder import address_decoder_pkg::*;#(
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter type exception_t = logic,
parameter ADDR_WIDTH = 32
Copy link
Contributor

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
module address_decoder import address_decoder_pkg::*;#(
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter type exception_t = logic,
parameter ADDR_WIDTH = 32
module address_decoder
import address_decoder_pkg::*;
#(
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter type exception_t = logic,
parameter ADDR_WIDTH = 32

Comment on lines +14 to +15
input logic clk_i,
input logic rst_ni,
Copy link
Contributor

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
input logic clk_i,
input logic rst_ni,
input logic clk_i,
input logic rst_ni,

Comment on lines +17 to +18
input logic addr_valid_i, // Input address is valid
input logic [ADDR_WIDTH-1:0] addr_i, // Address to be decoded
Copy link
Contributor

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
input logic addr_valid_i, // Input address is valid
input logic [ADDR_WIDTH-1:0] addr_i, // Address to be decoded
input logic addr_valid_i, // Input address is valid
input logic [ADDR_WIDTH-1:0] addr_i, // Address to be decoded

Comment on lines +20 to +27
input logic dscr_en_i, // From CSR
input logic iscr_en_i, // From CSR
input logic ahb_periph_en_i, // From CSR

input logic [CVA6Cfg.XLEN-1:0] exception_code_i,

output exception_t ex_o,
output addr_dec_mode_e select_mem_o
Copy link
Contributor

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
input logic dscr_en_i, // From CSR
input logic iscr_en_i, // From CSR
input logic ahb_periph_en_i, // From CSR
input logic [CVA6Cfg.XLEN-1:0] exception_code_i,
output exception_t ex_o,
output addr_dec_mode_e select_mem_o
input logic dscr_en_i, // From CSR
input logic iscr_en_i, // From CSR
input logic ahb_periph_en_i, // From CSR
input logic [CVA6Cfg.XLEN-1:0] exception_code_i,
output exception_t ex_o,
output addr_dec_mode_e select_mem_o

Comment on lines +35 to +37
assign match_dscr_region = config_pkg::is_inside_data_scratchpad(CVA6Cfg, {{64-ADDR_WIDTH{1'b0}}, addr_i});
assign match_iscr_region = config_pkg::is_inside_instruction_scratchpad(CVA6Cfg, {{64-ADDR_WIDTH{1'b0}}, addr_i});
assign match_any_ahbperiph_region = config_pkg::is_inside_ahbperiph_regions(CVA6Cfg, {{64-ADDR_WIDTH{1'b0}}, addr_i});
Copy link
Contributor

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 match_dscr_region = config_pkg::is_inside_data_scratchpad(CVA6Cfg, {{64-ADDR_WIDTH{1'b0}}, addr_i});
assign match_iscr_region = config_pkg::is_inside_instruction_scratchpad(CVA6Cfg, {{64-ADDR_WIDTH{1'b0}}, addr_i});
assign match_any_ahbperiph_region = config_pkg::is_inside_ahbperiph_regions(CVA6Cfg, {{64-ADDR_WIDTH{1'b0}}, addr_i});
assign match_dscr_region = config_pkg::is_inside_data_scratchpad(
CVA6Cfg, {{64 - ADDR_WIDTH{1'b0}}, addr_i}
);
assign match_iscr_region = config_pkg::is_inside_instruction_scratchpad(
CVA6Cfg, {{64 - ADDR_WIDTH{1'b0}}, addr_i}
);
assign match_any_ahbperiph_region = config_pkg::is_inside_ahbperiph_regions(
CVA6Cfg, {{64 - ADDR_WIDTH{1'b0}}, addr_i}
);

Comment on lines +75 to +76

endmodule
Copy link
Contributor

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
endmodule
endmodule

Copy link
Contributor

❌ failed run, report available here.

Copy link
Contributor

❌ failed run, report available here.

Copy link
Contributor

❌ failed run, report available here.

Copy link
Contributor

❌ failed run, report available here.

2 similar comments
Copy link
Contributor

❌ failed run, report available here.

Copy link
Contributor

❌ failed run, report available here.

input ahb_req_t ahb_s_req_i,

// Request from AHB acknowledged
input logic req_ack_i,
Copy link
Contributor

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
input logic req_ack_i,
input logic req_ack_i,

Comment on lines +95 to +96
end
// Go to SEQ if this becomes a BURST
Copy link
Contributor

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
end
// Go to SEQ if this becomes a BURST
end // Go to SEQ if this becomes a BURST

Comment on lines +110 to +111
end
else if (ahb_s_req_i.htrans == AHB_TRANS_BUSY) state_d = S_BUSY;
Copy link
Contributor

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
end
else if (ahb_s_req_i.htrans == AHB_TRANS_BUSY) state_d = S_BUSY;
end else if (ahb_s_req_i.htrans == AHB_TRANS_BUSY) state_d = S_BUSY;

Comment on lines +124 to +125
end
else if (ahb_s_req_i.hburst == AHB_BURST_INCR) begin
Copy link
Contributor

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
end
else if (ahb_s_req_i.hburst == AHB_BURST_INCR) begin
end else if (ahb_s_req_i.hburst == AHB_BURST_INCR) begin

Comment on lines +128 to +130
if (ahb_s_req_i.hwrite) state_d = S_NONSEQ_WRITE;
else state_d = S_NONSEQ_READ;
end
Copy link
Contributor

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 (ahb_s_req_i.hwrite) state_d = S_NONSEQ_WRITE;
else state_d = S_NONSEQ_READ;
end
if (ahb_s_req_i.hwrite) state_d = S_NONSEQ_WRITE;
else state_d = S_NONSEQ_READ;
end


always_comb begin : p_ahb_outputs
hready_d = 1'b1;
hresp_d = 1'b0; // Exception not yet supported, no errors are sent to AHB BUS
Copy link
Contributor

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
hresp_d = 1'b0; // Exception not yet supported, no errors are sent to AHB BUS
hresp_d = 1'b0; // Exception not yet supported, no errors are sent to AHB BUS

Comment on lines +173 to +178
vaddr_d = vaddr_q;
wdata_d = wdata_q;
data_req_d = 1'b0;
data_we_d = 1'b0;
data_be_d = '0; // TODO: Determine if should be set depending of size or not?
size_d = size_q;
Copy link
Contributor

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
vaddr_d = vaddr_q;
wdata_d = wdata_q;
data_req_d = 1'b0;
data_we_d = 1'b0;
data_be_d = '0; // TODO: Determine if should be set depending of size or not?
size_d = size_q;
vaddr_d = vaddr_q;
wdata_d = wdata_q;
data_req_d = 1'b0;
data_we_d = 1'b0;
data_be_d = '0; // TODO: Determine if should be set depending of size or not?
size_d = size_q;

Comment on lines +223 to +224
assign req_port_o.data_id = '0; // Not supported: next req is sent when previous one is done
assign req_port_o.kill_req = '0; // Not supported: AHB master cannot kill a req
Copy link
Contributor

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 req_port_o.data_id = '0; // Not supported: next req is sent when previous one is done
assign req_port_o.kill_req = '0; // Not supported: AHB master cannot kill a req
assign req_port_o.data_id = '0; // Not supported: next req is sent when previous one is done
assign req_port_o.kill_req = '0; // Not supported: AHB master cannot kill a req

Comment on lines +46 to +49
logic [DSCR_ARBIT_NUM_IN-1:0] arb_req;
logic arb_gnt;
dscr_arbit_e arb_idx;
logic arb_idx_valid;
Copy link
Contributor

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 [DSCR_ARBIT_NUM_IN-1:0] arb_req;
logic arb_gnt;
dscr_arbit_e arb_idx;
logic arb_idx_valid;
logic [DSCR_ARBIT_NUM_IN-1:0] arb_req;
logic arb_gnt;
dscr_arbit_e arb_idx;
logic arb_idx_valid;

Comment on lines +156 to +160
sram_ctrl_addr = ld_req_port_i.vaddr;
sram_ctrl_we = ld_req_port_i.data_we;
sram_ctrl_be = ld_req_port_i.data_be;
sram_ctrl_wdata = ld_req_port_i.data_wdata;
sram_req_id = ld_req_port_i.data_id;
Copy link
Contributor

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
sram_ctrl_addr = ld_req_port_i.vaddr;
sram_ctrl_we = ld_req_port_i.data_we;
sram_ctrl_be = ld_req_port_i.data_be;
sram_ctrl_wdata = ld_req_port_i.data_wdata;
sram_req_id = ld_req_port_i.data_id;
sram_ctrl_addr = ld_req_port_i.vaddr;
sram_ctrl_we = ld_req_port_i.data_we;
sram_ctrl_be = ld_req_port_i.data_be;
sram_ctrl_wdata = ld_req_port_i.data_wdata;
sram_req_id = ld_req_port_i.data_id;

Comment on lines +162 to +163
ld_req_port_o.data_rdata = sram_resp_rdata;
ld_req_port_o.data_gnt = sram_resp_gnt;
Copy link
Contributor

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
ld_req_port_o.data_rdata = sram_resp_rdata;
ld_req_port_o.data_gnt = sram_resp_gnt;
ld_req_port_o.data_rdata = sram_resp_rdata;
ld_req_port_o.data_gnt = sram_resp_gnt;

Comment on lines +165 to +166
ld_req_port_o.data_rid = sram_resp_rid;
ld_req_port_o.data_ruser = '0;
Copy link
Contributor

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
ld_req_port_o.data_rid = sram_resp_rid;
ld_req_port_o.data_ruser = '0;
ld_req_port_o.data_rid = sram_resp_rid;
ld_req_port_o.data_ruser = '0;

ld_req_port_o.data_rid = sram_resp_rid;
ld_req_port_o.data_ruser = '0;

ahb_req_port_i = '0;
Copy link
Contributor

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
ahb_req_port_i = '0;
ahb_req_port_i = '0;


ahb_req_port_i = '0;
end else if (arb_idx == DSCR_ARBIT_STORE && arb_idx_valid) begin
sram_ctrl_req = st_req_port_i.data_req && !st_req_sent && !st_req_port_i.kill_req;
Copy link
Contributor

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
sram_ctrl_req = st_req_port_i.data_req && !st_req_sent && !st_req_port_i.kill_req;
sram_ctrl_req = st_req_port_i.data_req && !st_req_sent && !st_req_port_i.kill_req;

ld_req_port_o = '0;
ahb_req_port_i = '0;
end else if (arb_idx == DSCR_ARBIT_AHB && arb_idx_valid) begin
sram_ctrl_req = ahb_req_port_o.data_req;
Copy link
Contributor

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
sram_ctrl_req = ahb_req_port_o.data_req;
sram_ctrl_req = ahb_req_port_o.data_req;

Comment on lines +52 to +55
logic [ ISCR_ARBIT_NUM_IN-1:0] arb_req;
logic arb_gnt;
iscr_arbit_e arb_idx;
logic arb_idx_valid;
Copy link
Contributor

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 [ ISCR_ARBIT_NUM_IN-1:0] arb_req;
logic arb_gnt;
iscr_arbit_e arb_idx;
logic arb_idx_valid;
logic [ISCR_ARBIT_NUM_IN-1:0] arb_req;
logic arb_gnt;
iscr_arbit_e arb_idx;
logic arb_idx_valid;

Comment on lines +174 to +175
ld_req_port_o = '0;
ahb_req_port_i = '0;
Copy link
Contributor

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
ld_req_port_o = '0;
ahb_req_port_i = '0;
ld_req_port_o = '0;
ahb_req_port_i = '0;

end else if (st_select_mem == address_decoder_pkg::DECODER_MODE_AHB_PERIPH) begin
commit_ready_o = ahbperiph_ready_i;
rvfi_mem_paddr_o = speculative_queue_n[speculative_read_pointer_q].address;
end else if (st_select_mem == address_decoder_pkg::DECODER_MODE_CACHE) begin // DCACHE
Copy link
Contributor

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
end else if (st_select_mem == address_decoder_pkg::DECODER_MODE_CACHE) begin // DCACHE
end else if (st_select_mem == address_decoder_pkg::DECODER_MODE_CACHE) begin // DCACHE

Copy link
Contributor

❌ failed run, report available here.

Copy link
Contributor

❌ failed run, report available here.

@@ -133,7 +134,27 @@ module load_store_unit
output logic itlb_miss_o,
Copy link
Contributor

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 itlb_miss_o,
output logic itlb_miss_o,

@@ -133,7 +134,27 @@
output logic itlb_miss_o,
// Data TLB miss - PERF_COUNTERS
output logic dtlb_miss_o,
Copy link
Contributor

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 dtlb_miss_o,
output logic dtlb_miss_o,

input logic ahbperiph_ld_ex_i,
output scratchpad_req_i_t ahbperiph_st_req_port_o,
input logic ahbperiph_st_ready_i,
input logic ahbperiph_st_ex_i,
// Data cache request output - CACHES
input dcache_req_o_t [2:0] dcache_req_ports_i,
Copy link
Contributor

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
input dcache_req_o_t [2:0] dcache_req_ports_i,
input dcache_req_o_t [ 2:0] dcache_req_ports_i,

Copy link
Contributor

❌ failed run, report available here.

1 similar comment
Copy link
Contributor

❌ failed run, report available here.

Comment on lines +26 to +29
parameter type rvfi_probes_instr_t =
`RVFI_PROBES_INSTR_T(CVA6Cfg),
parameter type rvfi_probes_csr_t =
`RVFI_PROBES_CSR_T(CVA6Cfg),
Copy link
Contributor

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
parameter type rvfi_probes_instr_t =
`RVFI_PROBES_INSTR_T(CVA6Cfg),
parameter type rvfi_probes_csr_t =
`RVFI_PROBES_CSR_T(CVA6Cfg),
parameter type rvfi_probes_instr_t = `RVFI_PROBES_INSTR_T(CVA6Cfg),
parameter type rvfi_probes_csr_t = `RVFI_PROBES_CSR_T(CVA6Cfg),

@@ -291,12 +321,18 @@ module cva6
input logic time_irq_i,
// Debug (async) request - SUBSYSTEM
input logic debug_req_i,
// Probes to build RVFI, can be left open when not used - RVFI
// Probes to build RVFI, can be left open when not used - RVFI
Copy link
Contributor

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
// Probes to build RVFI, can be left open when not used - RVFI
// Probes to build RVFI, can be left open when not used - RVFI

Comment on lines +1688 to +1689
iscr_ahb_s_req_i = '0;
dscr_ahb_s_req_i = '0;
Copy link
Contributor

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
iscr_ahb_s_req_i = '0;
dscr_ahb_s_req_i = '0;
iscr_ahb_s_req_i = '0;
dscr_ahb_s_req_i = '0;

Comment on lines +1770 to +1779
.clk_i (clk_i),
.rst_ni (rst_ni),
.ahb_p_resp_i (ahb_p_resp_i),
.ahb_p_req_o (ahb_p_req_o),
.ld_req_port_i (ahbperiph_req_port_ld_periph),
.ld_req_port_o (ahbperiph_req_port_periph_ld),
.ld_ex_o (ahbperiph_ex_periph_ld),
.st_req_port_i (ahbperiph_req_port_st_periph),
.st_ready_o (ahbperiph_ready_periph_st),
.st_ex_o (ahbperiph_ex_periph_st)
Copy link
Contributor

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
.clk_i (clk_i),
.rst_ni (rst_ni),
.ahb_p_resp_i (ahb_p_resp_i),
.ahb_p_req_o (ahb_p_req_o),
.ld_req_port_i (ahbperiph_req_port_ld_periph),
.ld_req_port_o (ahbperiph_req_port_periph_ld),
.ld_ex_o (ahbperiph_ex_periph_ld),
.st_req_port_i (ahbperiph_req_port_st_periph),
.st_ready_o (ahbperiph_ready_periph_st),
.st_ex_o (ahbperiph_ex_periph_st)
.clk_i (clk_i),
.rst_ni (rst_ni),
.ahb_p_resp_i (ahb_p_resp_i),
.ahb_p_req_o (ahb_p_req_o),
.ld_req_port_i(ahbperiph_req_port_ld_periph),
.ld_req_port_o(ahbperiph_req_port_periph_ld),
.ld_ex_o (ahbperiph_ex_periph_ld),
.st_req_port_i(ahbperiph_req_port_st_periph),
.st_ready_o (ahbperiph_ready_periph_st),
.st_ex_o (ahbperiph_ex_periph_st)

Copy link
Contributor

❌ failed run, report available here.

2 similar comments
Copy link
Contributor

❌ failed run, report available here.

Copy link
Contributor

❌ failed run, report available here.

@JeanRochCoulon JeanRochCoulon marked this pull request as ready for review September 18, 2024 14:18
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.

1 participant