mirror of
https://github.com/openhwgroup/cva6.git
synced 2025-04-22 05:07:21 -04:00
Move ariane_cfg_t definition from ariane_pkg to in cva6_config_pkg (#1056)
This commit is contained in:
parent
a63226d8be
commit
5157e2de9d
10 changed files with 87 additions and 39 deletions
|
@ -63,6 +63,12 @@ def setup_parser_config_generator():
|
|||
help="Load latency")
|
||||
parser.add_argument("--NrStorePipeRegs", type=int, default=None,
|
||||
help="Store latency")
|
||||
parser.add_argument("--RASDepth", type=int, default=None,
|
||||
help="Depth of Return Address Stack")
|
||||
parser.add_argument("--BTBEntries", type=int, default=None,
|
||||
help="Number of Branch Target Buffer entries")
|
||||
parser.add_argument("--BHTEntries", type=int, default=None,
|
||||
help="Number of Branch History Table entries")
|
||||
return parser
|
||||
|
||||
ISA = ""
|
||||
|
@ -91,6 +97,9 @@ MapArgsToParameter={
|
|||
"FPGAEn" : "CVA6ConfigFPGAEn",
|
||||
"NrLoadPipeRegs" : "CVA6ConfigNrLoadPipeRegs",
|
||||
"NrStorePipeRegs" : "CVA6ConfigNrStorePipeRegs",
|
||||
"RASDepth": "CVA6ConfigRASDepth",
|
||||
"BTBEntries": "CVA6ConfigBTBEntries",
|
||||
"BHTEntries": "CVA6ConfigBHTEntries",
|
||||
}
|
||||
MapParametersToArgs = {i:k for k, i in MapArgsToParameter.items()} #reverse map
|
||||
|
||||
|
|
|
@ -386,46 +386,58 @@ module frontend import ariane_pkg::*; #(
|
|||
end
|
||||
end
|
||||
|
||||
ras #(
|
||||
.DEPTH ( ArianeCfg.RASDepth )
|
||||
) i_ras (
|
||||
.clk_i,
|
||||
.rst_ni,
|
||||
.flush_i( flush_bp_i ),
|
||||
.push_i ( ras_push ),
|
||||
.pop_i ( ras_pop ),
|
||||
.data_i ( ras_update ),
|
||||
.data_o ( ras_predict )
|
||||
);
|
||||
|
||||
if (ArianeCfg.RASDepth == 0) begin
|
||||
assign ras_predict = '0;
|
||||
end else begin
|
||||
ras #(
|
||||
.DEPTH ( ArianeCfg.RASDepth )
|
||||
) i_ras (
|
||||
.clk_i,
|
||||
.rst_ni,
|
||||
.flush_i( flush_bp_i ),
|
||||
.push_i ( ras_push ),
|
||||
.pop_i ( ras_pop ),
|
||||
.data_i ( ras_update ),
|
||||
.data_o ( ras_predict )
|
||||
);
|
||||
end
|
||||
|
||||
//For FPGA, BTB is implemented in read synchronous BRAM
|
||||
//while for ASIC, BTB is implemented in D flip-flop
|
||||
//and can be read at the same cycle.
|
||||
assign vpc_btb = (ariane_pkg::FPGA_EN) ? icache_dreq_i.vaddr : icache_vaddr_q;
|
||||
|
||||
btb #(
|
||||
.NR_ENTRIES ( ArianeCfg.BTBEntries )
|
||||
) i_btb (
|
||||
.clk_i,
|
||||
.rst_ni,
|
||||
.flush_i ( flush_bp_i ),
|
||||
.debug_mode_i,
|
||||
.vpc_i ( vpc_btb ),
|
||||
.btb_update_i ( btb_update ),
|
||||
.btb_prediction_o ( btb_prediction )
|
||||
);
|
||||
if (ArianeCfg.BTBEntries == 0) begin
|
||||
assign btb_prediction = '0;
|
||||
end else begin
|
||||
btb #(
|
||||
.NR_ENTRIES ( ArianeCfg.BTBEntries )
|
||||
) i_btb (
|
||||
.clk_i,
|
||||
.rst_ni,
|
||||
.flush_i ( flush_bp_i ),
|
||||
.debug_mode_i,
|
||||
.vpc_i ( vpc_btb ),
|
||||
.btb_update_i ( btb_update ),
|
||||
.btb_prediction_o ( btb_prediction )
|
||||
);
|
||||
end
|
||||
|
||||
bht #(
|
||||
.NR_ENTRIES ( ArianeCfg.BHTEntries )
|
||||
) i_bht (
|
||||
.clk_i,
|
||||
.rst_ni,
|
||||
.flush_i ( flush_bp_i ),
|
||||
.debug_mode_i,
|
||||
.vpc_i ( icache_vaddr_q ),
|
||||
.bht_update_i ( bht_update ),
|
||||
.bht_prediction_o ( bht_prediction )
|
||||
);
|
||||
if (ArianeCfg.BHTEntries == 0) begin
|
||||
assign bht_prediction = '0;
|
||||
end else begin
|
||||
bht #(
|
||||
.NR_ENTRIES ( ArianeCfg.BHTEntries )
|
||||
) i_bht (
|
||||
.clk_i,
|
||||
.rst_ni,
|
||||
.flush_i ( flush_bp_i ),
|
||||
.debug_mode_i,
|
||||
.vpc_i ( icache_vaddr_q ),
|
||||
.bht_update_i ( bht_update ),
|
||||
.bht_prediction_o ( bht_prediction )
|
||||
);
|
||||
end
|
||||
|
||||
// we need to inspect up to INSTR_PER_FETCH instructions for branches
|
||||
// and jumps
|
||||
|
|
|
@ -32,7 +32,6 @@ package ariane_pkg;
|
|||
// within Ariane add a field here and assign a default value to the config. Please make
|
||||
// sure to add a propper parameter check to the `check_cfg` function.
|
||||
localparam NrMaxRules = 16;
|
||||
|
||||
typedef struct packed {
|
||||
int RASDepth;
|
||||
int BTBEntries;
|
||||
|
@ -56,9 +55,9 @@ package ariane_pkg;
|
|||
} ariane_cfg_t;
|
||||
|
||||
localparam ariane_cfg_t ArianeDefaultConfig = '{
|
||||
RASDepth: 2,
|
||||
BTBEntries: 32,
|
||||
BHTEntries: 128,
|
||||
RASDepth: cva6_config_pkg::CVA6ConfigRASDepth,
|
||||
BTBEntries: cva6_config_pkg::CVA6ConfigBTBEntries,
|
||||
BHTEntries: cva6_config_pkg::CVA6ConfigBHTEntries,
|
||||
// idempotent region
|
||||
NrNonIdempotentRules: 2,
|
||||
NonIdempotentAddrBase: {64'b0, 64'b0},
|
||||
|
@ -687,7 +686,7 @@ package ariane_pkg;
|
|||
// MMU instanciation
|
||||
// ---------------
|
||||
localparam bit MMU_PRESENT = 1'b1; // MMU is present
|
||||
|
||||
|
||||
localparam int unsigned INSTR_TLB_ENTRIES = cva6_config_pkg::CVA6ConfigInstrTlbEntries;
|
||||
localparam int unsigned DATA_TLB_ENTRIES = cva6_config_pkg::CVA6ConfigDataTlbEntries;
|
||||
|
||||
|
|
|
@ -43,4 +43,8 @@ package cva6_config_pkg;
|
|||
localparam CVA6ConfigInstrTlbEntries = 16;
|
||||
localparam CVA6ConfigDataTlbEntries = 16;
|
||||
|
||||
localparam CVA6ConfigRASDepth = 0;
|
||||
localparam CVA6ConfigBTBEntries = 0;
|
||||
localparam CVA6ConfigBHTEntries = 0;
|
||||
|
||||
endpackage
|
||||
|
|
|
@ -43,4 +43,8 @@ package cva6_config_pkg;
|
|||
localparam CVA6ConfigInstrTlbEntries = 2;
|
||||
localparam CVA6ConfigDataTlbEntries = 2;
|
||||
|
||||
localparam CVA6ConfigRASDepth = 2;
|
||||
localparam CVA6ConfigBTBEntries = 32;
|
||||
localparam CVA6ConfigBHTEntries = 128;
|
||||
|
||||
endpackage
|
||||
|
|
|
@ -43,4 +43,8 @@ package cva6_config_pkg;
|
|||
localparam CVA6ConfigInstrTlbEntries = 16;
|
||||
localparam CVA6ConfigDataTlbEntries = 16;
|
||||
|
||||
localparam CVA6ConfigRASDepth = 2;
|
||||
localparam CVA6ConfigBTBEntries = 32;
|
||||
localparam CVA6ConfigBHTEntries = 128;
|
||||
|
||||
endpackage
|
||||
|
|
|
@ -43,4 +43,8 @@ package cva6_config_pkg;
|
|||
localparam CVA6ConfigInstrTlbEntries = 16;
|
||||
localparam CVA6ConfigDataTlbEntries = 16;
|
||||
|
||||
localparam CVA6ConfigRASDepth = 2;
|
||||
localparam CVA6ConfigBTBEntries = 32;
|
||||
localparam CVA6ConfigBHTEntries = 128;
|
||||
|
||||
endpackage
|
||||
|
|
|
@ -43,4 +43,8 @@ package cva6_config_pkg;
|
|||
localparam CVA6ConfigInstrTlbEntries = 16;
|
||||
localparam CVA6ConfigDataTlbEntries = 16;
|
||||
|
||||
localparam CVA6ConfigRASDepth = 2;
|
||||
localparam CVA6ConfigBTBEntries = 32;
|
||||
localparam CVA6ConfigBHTEntries = 128;
|
||||
|
||||
endpackage
|
||||
|
|
|
@ -43,4 +43,8 @@ package cva6_config_pkg;
|
|||
localparam CVA6ConfigInstrTlbEntries = 16;
|
||||
localparam CVA6ConfigDataTlbEntries = 16;
|
||||
|
||||
localparam CVA6ConfigRASDepth = 2;
|
||||
localparam CVA6ConfigBTBEntries = 32;
|
||||
localparam CVA6ConfigBHTEntries = 128;
|
||||
|
||||
endpackage
|
||||
|
|
|
@ -43,4 +43,8 @@ package cva6_config_pkg;
|
|||
localparam CVA6ConfigInstrTlbEntries = 16;
|
||||
localparam CVA6ConfigDataTlbEntries = 16;
|
||||
|
||||
localparam CVA6ConfigRASDepth = 2;
|
||||
localparam CVA6ConfigBTBEntries = 32;
|
||||
localparam CVA6ConfigBHTEntries = 128;
|
||||
|
||||
endpackage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue