mirror of
https://github.com/openhwgroup/cva6.git
synced 2025-04-20 12:17:19 -04:00
Fix problems with ID width mismatches
This commit is contained in:
parent
644bcd7eeb
commit
31a761e905
10 changed files with 42 additions and 58 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -22,4 +22,4 @@ build/
|
|||
*.vcd
|
||||
*.log
|
||||
*.out
|
||||
work-ver/*
|
||||
work-*/*
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
|
||||
package ariane_axi;
|
||||
// 4 is recommended by AXI standard, so lets stick to it
|
||||
// 4 is recommended by AXI standard, so lets stick to it, do not change
|
||||
localparam IdWidth = 4;
|
||||
localparam UserWidth = 1;
|
||||
localparam AddrWidth = 64;
|
||||
|
|
|
@ -20,9 +20,7 @@ import instruction_tracer_pkg::*;
|
|||
//pragma translate_on
|
||||
|
||||
module ariane #(
|
||||
parameter logic [63:0] CACHE_START_ADDR = 64'h8000_0000, // address on which to decide whether the request is cache-able or not
|
||||
parameter int unsigned AXI_ID_WIDTH = 10, // minimum 1
|
||||
parameter int unsigned AXI_USER_WIDTH = 1 // minimum 1
|
||||
parameter logic [63:0] CACHE_START_ADDR = 64'h8000_0000 // address on which to decide whether the request is cache-able or not
|
||||
)(
|
||||
input logic clk_i,
|
||||
input logic rst_ni,
|
||||
|
|
|
@ -19,9 +19,7 @@ import ariane_pkg::*;
|
|||
import std_cache_pkg::*;
|
||||
|
||||
module miss_handler #(
|
||||
parameter int unsigned NR_PORTS = 3,
|
||||
parameter int unsigned AXI_ID_WIDTH = 10,
|
||||
parameter int unsigned AXI_USER_WIDTH = 1
|
||||
parameter int unsigned NR_PORTS = 3
|
||||
)(
|
||||
input logic clk_i,
|
||||
input logic rst_ni,
|
||||
|
@ -518,8 +516,8 @@ module miss_handler #(
|
|||
logic valid_bypass_fsm;
|
||||
logic [63:0] data_bypass_fsm;
|
||||
logic [$clog2(NR_PORTS)-1:0] id_fsm_bypass;
|
||||
logic [AXI_ID_WIDTH-1:0] id_bypass_fsm;
|
||||
logic [AXI_ID_WIDTH-1:0] gnt_id_bypass_fsm;
|
||||
logic [3:0] id_bypass_fsm;
|
||||
logic [3:0] gnt_id_bypass_fsm;
|
||||
|
||||
arbiter #(
|
||||
.NR_PORTS ( NR_PORTS ),
|
||||
|
@ -552,8 +550,8 @@ module miss_handler #(
|
|||
);
|
||||
|
||||
axi_adapter #(
|
||||
.DATA_WIDTH ( 64 ),
|
||||
.AXI_ID_WIDTH ( AXI_ID_WIDTH )
|
||||
.DATA_WIDTH ( 64 ),
|
||||
.AXI_ID_WIDTH ( 4 )
|
||||
) i_bypass_axi_adapter (
|
||||
.clk_i,
|
||||
.rst_ni,
|
||||
|
@ -580,8 +578,8 @@ module miss_handler #(
|
|||
// Cache Line AXI Refill
|
||||
// ----------------------
|
||||
axi_adapter #(
|
||||
.DATA_WIDTH ( DCACHE_LINE_WIDTH ),
|
||||
.AXI_ID_WIDTH ( AXI_ID_WIDTH )
|
||||
.DATA_WIDTH ( DCACHE_LINE_WIDTH ),
|
||||
.AXI_ID_WIDTH ( 4 )
|
||||
) i_miss_axi_adapter (
|
||||
.clk_i,
|
||||
.rst_ni,
|
||||
|
@ -642,13 +640,6 @@ module miss_handler #(
|
|||
miss_req_size [i] = miss_req.size;
|
||||
end
|
||||
end
|
||||
|
||||
//pragma translate_off
|
||||
initial begin
|
||||
assert (AXI_ID_WIDTH >= $clog2(NR_PORTS)) else $fatal (1, "AXI ID Width needs to be larger than number of requestors");
|
||||
end
|
||||
//pragma translate_on
|
||||
|
||||
endmodule
|
||||
|
||||
// --------------
|
||||
|
|
|
@ -18,7 +18,6 @@ import ariane_pkg::*;
|
|||
import std_cache_pkg::*;
|
||||
|
||||
module std_cache_subsystem #(
|
||||
parameter int unsigned AXI_ID_WIDTH = 10,
|
||||
parameter logic [63:0] CACHE_START_ADDR = 64'h4000_0000
|
||||
)(
|
||||
input logic clk_i,
|
||||
|
@ -78,7 +77,6 @@ module std_cache_subsystem #(
|
|||
// Port 1: Load Unit
|
||||
// Port 2: Store Unit
|
||||
std_nbdcache #(
|
||||
.AXI_ID_WIDTH ( AXI_ID_WIDTH ),
|
||||
.CACHE_START_ADDR ( CACHE_START_ADDR )
|
||||
) i_nbdcache (
|
||||
.clk_i,
|
||||
|
@ -191,9 +189,9 @@ module std_cache_subsystem #(
|
|||
);
|
||||
|
||||
always_comb begin
|
||||
aw_enable_d = aw_enable_d;
|
||||
ar_enable_d = ar_enable_d;
|
||||
w_enable_d = w_enable_d;
|
||||
aw_enable_d = aw_enable_q;
|
||||
ar_enable_d = ar_enable_q;
|
||||
w_enable_d = w_enable_q;
|
||||
|
||||
// freeze the arbiter
|
||||
if (aw_arbiter_valid) aw_enable_d = 1'b0;
|
||||
|
@ -218,22 +216,22 @@ module std_cache_subsystem #(
|
|||
end
|
||||
|
||||
// Route responses based on ID
|
||||
// 0000 -> I$
|
||||
// 11[00|10|01] -> Bypass
|
||||
// 1111 -> D$
|
||||
// 0000 -> I$
|
||||
// 10[00|10|01|11] -> Bypass
|
||||
// 1111 -> D$
|
||||
// R Channel
|
||||
assign axi_resp_icache.r = axi_resp_i.r;
|
||||
assign axi_resp_bypass.r = axi_resp_i.r;
|
||||
assign axi_resp_data.r = axi_resp_i.r;
|
||||
|
||||
logic [2:0] r_select;
|
||||
logic [1:0] r_select;
|
||||
|
||||
always_comb begin
|
||||
r_select = 0;
|
||||
unique case (axi_resp_i.r.id)
|
||||
4'b0000: r_select = 2; // icache
|
||||
4'b1111: r_select = 0; // dcache
|
||||
4'b1100, 4'b1101, 4'b1110: r_select = 1; // bypass
|
||||
4'b1000, 4'b1001, 4'b1010, 4'b1011: r_select = 1; // bypass
|
||||
default: r_select = 0;
|
||||
endcase
|
||||
end
|
||||
|
@ -249,7 +247,7 @@ module std_cache_subsystem #(
|
|||
);
|
||||
|
||||
// B Channel
|
||||
logic [2:0] b_select;
|
||||
logic [1:0] b_select;
|
||||
|
||||
assign axi_resp_icache.b = axi_resp_i.b;
|
||||
assign axi_resp_bypass.b = axi_resp_i.b;
|
||||
|
@ -260,7 +258,7 @@ module std_cache_subsystem #(
|
|||
unique case (axi_resp_i.b.id)
|
||||
4'b0000: b_select = 2; // icache
|
||||
4'b1111: b_select = 0; // dcache
|
||||
4'b1100, 4'b1101, 4'b1110: b_select = 1; // bypass
|
||||
4'b1000, 4'b1001, 4'b1010, 4'b1011: b_select = 1; // bypass
|
||||
default: b_select = 0;
|
||||
endcase
|
||||
end
|
||||
|
|
|
@ -16,7 +16,6 @@ import ariane_pkg::*;
|
|||
import std_cache_pkg::*;
|
||||
|
||||
module std_nbdcache #(
|
||||
parameter int unsigned AXI_ID_WIDTH = 10,
|
||||
parameter logic [63:0] CACHE_START_ADDR = 64'h8000_0000
|
||||
)(
|
||||
input logic clk_i, // Clock
|
||||
|
@ -128,7 +127,6 @@ module std_nbdcache #(
|
|||
// Miss Handling Unit
|
||||
// ------------------
|
||||
miss_handler #(
|
||||
.AXI_ID_WIDTH ( AXI_ID_WIDTH ),
|
||||
.NR_PORTS ( 3 )
|
||||
) i_miss_handler (
|
||||
.flush_i ( flush_i ),
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 36d047b8a0f0c5cc05cdc8ccd15c0149074d2d31
|
||||
Subproject commit 3b18d9ce9889fb140cd39c8d7c86b3a6cc68872e
|
|
@ -1 +1 @@
|
|||
Subproject commit 3e925e169bd02ebf26e3d4ab65cd1832319cf580
|
||||
Subproject commit a3ba269c0fc6cfcee6f81e5d9af018a08e479d2b
|
|
@ -13,15 +13,15 @@
|
|||
// Date: 15.08.2018
|
||||
// Description: SRAM wrapper for FPGA (requires the fpga-support submodule)
|
||||
//
|
||||
// Note: the wrapped module contains two different implementations for
|
||||
// ALTERA and XILINX tools, since these follow different coding styles for
|
||||
// inferrable RAMS with byte enable. define `FPGA_TARGET_XILINX or
|
||||
// Note: the wrapped module contains two different implementations for
|
||||
// ALTERA and XILINX tools, since these follow different coding styles for
|
||||
// inferrable RAMS with byte enable. define `FPGA_TARGET_XILINX or
|
||||
// `FPGA_TARGET_ALTERA in your build environment (default is ALTERA)
|
||||
|
||||
|
||||
module sram #(
|
||||
parameter DATA_WIDTH = 64,
|
||||
parameter NUM_WORDS = 1024,
|
||||
parameter OUT_REGS = 0 // enables output registers in FPGA macro (read lat = 2)
|
||||
parameter OUT_REGS = 0 // enables output registers in FPGA macro (read lat = 2)
|
||||
)(
|
||||
input logic clk_i,
|
||||
input logic rst_ni,
|
||||
|
@ -52,23 +52,24 @@ end
|
|||
|
||||
genvar k;
|
||||
generate
|
||||
for (k = 0; k<(DATA_WIDTH+63)/64; k++) begin
|
||||
for (k = 0; k<(DATA_WIDTH+63)/64; k++) begin
|
||||
// unused byte-enable segments (8bits) are culled by the tool
|
||||
SyncSpRamBeNx64 #(
|
||||
.ADDR_WIDTH($clog2(NUM_WORDS)),
|
||||
.DATA_DEPTH(NUM_WORDS),
|
||||
.OUT_REGS (0)
|
||||
.DATA_DEPTH(NUM_WORDS),
|
||||
.OUT_REGS (0),
|
||||
.SIM_INIT (2)
|
||||
) i_ram (
|
||||
.Clk_CI ( clk_i ),
|
||||
.Rst_RBI ( rst_ni ),
|
||||
.CSel_SI ( req_i ),
|
||||
.WrEn_SI ( we_i ),
|
||||
.BEn_SI ( be_aligned[k*8 +: 8] ),
|
||||
.WrData_DI ( wdata_aligned[k*64 +: 64] ),
|
||||
.Addr_DI ( addr_i ),
|
||||
.WrData_DI ( wdata_aligned[k*64 +: 64] ),
|
||||
.Addr_DI ( addr_i ),
|
||||
.RdData_DO ( rdata_aligned[k*64 +: 64] )
|
||||
);
|
||||
end
|
||||
);
|
||||
end
|
||||
endgenerate
|
||||
|
||||
endmodule : sram
|
||||
|
|
|
@ -15,15 +15,15 @@
|
|||
|
||||
module ariane_testharness #(
|
||||
parameter logic [63:0] CACHE_START_ADDR = 64'h8000_0000, // address on which to decide whether the request is cache-able or not
|
||||
parameter int unsigned AXI_ID_WIDTH = 10,
|
||||
parameter int unsigned AXI_ID_WIDTH = 4,
|
||||
parameter int unsigned AXI_USER_WIDTH = 1,
|
||||
parameter int unsigned AXI_ADDRESS_WIDTH = 64,
|
||||
parameter int unsigned AXI_DATA_WIDTH = 64,
|
||||
parameter int unsigned NUM_WORDS = 2**24 // memory size
|
||||
)(
|
||||
input logic clk_i,
|
||||
input logic rst_ni,
|
||||
output logic [31:0] exit_o
|
||||
input logic clk_i,
|
||||
input logic rst_ni,
|
||||
output logic [31:0] exit_o
|
||||
);
|
||||
|
||||
// disable test-enable
|
||||
|
@ -70,8 +70,8 @@ module ariane_testharness #(
|
|||
assign test_en = 1'b0;
|
||||
assign ndmreset_n = ~ndmreset ;
|
||||
|
||||
localparam NB_SLAVE = 4;
|
||||
localparam NB_MASTER = 2;
|
||||
localparam NB_SLAVE = 2;
|
||||
localparam NB_MASTER = 4;
|
||||
|
||||
localparam AXI_ID_WIDTH_SLAVES = AXI_ID_WIDTH + $clog2(NB_SLAVE);
|
||||
|
||||
|
@ -322,9 +322,7 @@ module ariane_testharness #(
|
|||
ariane_axi::resp_t axi_ariane_resp;
|
||||
|
||||
ariane #(
|
||||
.CACHE_START_ADDR ( CACHE_START_ADDR ),
|
||||
.AXI_ID_WIDTH ( AXI_ID_WIDTH ),
|
||||
.AXI_USER_WIDTH ( AXI_USER_WIDTH )
|
||||
.CACHE_START_ADDR ( CACHE_START_ADDR )
|
||||
) i_ariane (
|
||||
.clk_i ( clk_i ),
|
||||
.rst_ni ( ndmreset_n ),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue