Skip to content

Commit

Permalink
Add variant into CVA6 parameter (#1320)
Browse files Browse the repository at this point in the history
* Variane as CVA6 parameter

Signed-off-by: Jean-Roch Coulon <[email protected]>

* fix FPGA build

Signed-off-by: Jean-Roch Coulon <[email protected]>

* Fix tipo in cva6.sv

* fix lint warnings

Signed-off-by: Jean-Roch Coulon <[email protected]>

* Fix is_*_fpr functions

* remove blank lines

* set IsRVFI out of CVA6Cfg

* define config_pkg

* Fix ariane_pkg comments

* Fix Lint from André's feedbacks

* Fix parameter transmission

* Fix replace CVA6Cfg by CVA6ExtendCfg in cva6.sv

* fix add CVA6Cfg in instr_queue, instr_scan and pmp parameters

---------

Signed-off-by: Jean-Roch Coulon <[email protected]>
Co-authored-by: ALLART Come <[email protected]>
  • Loading branch information
JeanRochCoulon and cathales authored Aug 22, 2023
1 parent 18766f1 commit 1db42ee
Show file tree
Hide file tree
Showing 84 changed files with 918 additions and 497 deletions.
1 change: 1 addition & 0 deletions core/Flist.cva6
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ ${CVA6_REPO_DIR}/vendor/openhwgroup/cvfpu/src/fpu_div_sqrt_mvp/hdl/norm_div_sqrt
${CVA6_REPO_DIR}/vendor/openhwgroup/cvfpu/src/fpu_div_sqrt_mvp/hdl/nrbd_nrsc_mvp.sv
${CVA6_REPO_DIR}/vendor/openhwgroup/cvfpu/src/fpu_div_sqrt_mvp/hdl/preprocess_mvp.sv

${CVA6_REPO_DIR}/core/include/config_pkg.sv
${CVA6_REPO_DIR}/core/include/${TARGET_CFG}_config_pkg.sv
${CVA6_REPO_DIR}/core/include/riscv_pkg.sv
${CVA6_REPO_DIR}/core/include/ariane_dm_pkg.sv
Expand Down
1 change: 1 addition & 0 deletions core/Flist.cva6_gate
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# Original Author: Jean-Roch COULON - Thales
#

${CVA6_REPO_DIR}/core/include/config_pkg.sv
${CVA6_REPO_DIR}/core/include/${TARGET_CFG}_config_pkg.sv
${CVA6_REPO_DIR}/core/include/riscv_pkg.sv
${CVA6_REPO_DIR}/core/include/ariane_dm_pkg.sv
Expand Down
2 changes: 1 addition & 1 deletion core/acc_dispatcher.sv
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// Description: Functional unit that dispatches CVA6 instructions to accelerators.

module acc_dispatcher import ariane_pkg::*; import riscv::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter type acc_req_t = acc_pkg::accelerator_req_t,
parameter type acc_resp_t = acc_pkg::accelerator_resp_t,
parameter type acc_cfg_t = logic,
Expand Down
2 changes: 1 addition & 1 deletion core/alu.sv
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


module alu import ariane_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty
) (
input logic clk_i, // Clock
input logic rst_ni, // Asynchronous reset active low
Expand Down
2 changes: 1 addition & 1 deletion core/amo_buffer.sv
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// Furthermore it handles interfacing with the commit stage

module amo_buffer #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty
) (
input logic clk_i, // Clock
input logic rst_ni, // Asynchronous reset active low
Expand Down
2 changes: 1 addition & 1 deletion core/ariane_regfile.sv
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
//

module ariane_regfile_lol #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter int unsigned DATA_WIDTH = 32,
parameter int unsigned NR_READ_PORTS = 2,
parameter bit ZERO_REG_ZERO = 0
Expand Down
2 changes: 1 addition & 1 deletion core/ariane_regfile_ff.sv
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//

module ariane_regfile #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter int unsigned DATA_WIDTH = 32,
parameter int unsigned NR_READ_PORTS = 2,
parameter bit ZERO_REG_ZERO = 0
Expand Down
2 changes: 1 addition & 1 deletion core/ariane_regfile_fpga.sv
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//

module ariane_regfile_fpga #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter int unsigned DATA_WIDTH = 32,
parameter int unsigned NR_READ_PORTS = 2,
parameter bit ZERO_REG_ZERO = 0
Expand Down
2 changes: 1 addition & 1 deletion core/axi_shim.sv
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


module axi_shim #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter int unsigned AxiNumWords = 4, // data width in dwords, this is also the maximum burst length, must be >=2
parameter type axi_req_t = logic,
parameter type axi_rsp_t = logic
Expand Down
2 changes: 1 addition & 1 deletion core/branch_unit.sv
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// Description: Branch target calculation and comparison

module branch_unit #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty
) (
input logic clk_i,
input logic rst_ni,
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/amo_alu.sv
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// Date: 15.09.2018
// Description: Combinatorial AMO unit
module amo_alu #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty
) (
// AMO interface
input ariane_pkg::amo_t amo_op_i,
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/axi_adapter.sv
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//import std_cache_pkg::*;

module axi_adapter #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter int unsigned DATA_WIDTH = 256,
parameter logic CRITICAL_WORD_FIRST = 0, // the AXI subsystem needs to support wrapping reads for this feature
parameter int unsigned CACHELINE_BYTE_OFFSET = 8,
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/cache_ctrl.sv
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


module cache_ctrl import ariane_pkg::*; import std_cache_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter ariane_cfg_t ArianeCfg = ArianeDefaultConfig // contains cacheable regions
) (
input logic clk_i, // Clock
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/cva6_icache.sv
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


module cva6_icache import ariane_pkg::*; import wt_cache_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
/// ID to be used for read transactions
parameter logic [MEM_TID_WIDTH-1:0] RdTxId = 0,
/// Contains cacheable regions
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/cva6_icache_axi_wrapper.sv
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//

module cva6_icache_axi_wrapper import ariane_pkg::*; import wt_cache_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter ariane_cfg_t ArianeCfg = ArianeDefaultConfig, // contains cacheable regions
parameter type axi_req_t = logic,
parameter type axi_rsp_t = logic
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/miss_handler.sv
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// --------------

module miss_handler import ariane_pkg::*; import std_cache_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter int unsigned NR_PORTS = 3,
parameter type axi_req_t = logic,
parameter type axi_rsp_t = logic
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/std_cache_subsystem.sv
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


module std_cache_subsystem import ariane_pkg::*; import std_cache_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter ariane_cfg_t ArianeCfg = ArianeDefaultConfig, // contains cacheable regions
parameter type axi_ar_chan_t = logic,
parameter type axi_aw_chan_t = logic,
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/std_nbdcache.sv
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


module std_nbdcache import std_cache_pkg::*; import ariane_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter ariane_cfg_t ArianeCfg = ArianeDefaultConfig, // contains cacheable regions
parameter type axi_req_t = logic,
parameter type axi_rsp_t = logic
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/tag_cmp.sv
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// checks for hit or miss on cache
//
module tag_cmp #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter int unsigned NR_PORTS = 3,
parameter int unsigned ADDR_WIDTH = 64,
parameter type l_data_t = std_cache_pkg::cache_line_t,
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/wt_axi_adapter.sv
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


module wt_axi_adapter import ariane_pkg::*; import wt_cache_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter int unsigned ReqFifoDepth = 2,
parameter int unsigned MetaFifoDepth = wt_cache_pkg::DCACHE_MAX_TX,
parameter type axi_req_t = logic,
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/wt_cache_subsystem.sv
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


module wt_cache_subsystem import ariane_pkg::*; import wt_cache_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter ariane_pkg::ariane_cfg_t ArianeCfg = ariane_pkg::ArianeDefaultConfig, // contains cacheable regions
parameter int unsigned NumPorts = 3,
parameter type noc_req_t = logic,
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/wt_dcache.sv
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


module wt_dcache import ariane_pkg::*; import wt_cache_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter int unsigned NumPorts = 3, // number of miss ports
// ID to be used for read and AMO transactions.
// note that the write buffer uses all IDs up to DCACHE_MAX_TX-1 for write transactions
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/wt_dcache_ctrl.sv
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


module wt_dcache_ctrl import ariane_pkg::*; import wt_cache_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter logic [CACHE_ID_WIDTH-1:0] RdTxId = 1, // ID to use for read transactions
parameter ariane_pkg::ariane_cfg_t ArianeCfg = ariane_pkg::ArianeDefaultConfig // contains cacheable regions
) (
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/wt_dcache_mem.sv
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


module wt_dcache_mem import ariane_pkg::*; import wt_cache_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter bit AxiCompliant = 1'b0, // set this to 1 when using in conjunction with AXI bus adapter
parameter int unsigned NumPorts = 3
) (
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/wt_dcache_missunit.sv
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


module wt_dcache_missunit import ariane_pkg::*; import wt_cache_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter bit AxiCompliant = 1'b0, // set this to 1 when using in conjunction with AXI bus adapter
parameter logic [CACHE_ID_WIDTH-1:0] AmoTxId = 1, // TX id to be used for AMOs
parameter int unsigned NumPorts = 3 // number of miss ports
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/wt_dcache_wbuffer.sv
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@


module wt_dcache_wbuffer import ariane_pkg::*; import wt_cache_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter ariane_pkg::ariane_cfg_t ArianeCfg = ariane_pkg::ArianeDefaultConfig // contains cacheable regions
) (
input logic clk_i, // Clock
Expand Down
2 changes: 1 addition & 1 deletion core/cache_subsystem/wt_l15_adapter.sv
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@


module wt_l15_adapter import ariane_pkg::*; import wt_cache_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty,
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty,
parameter bit SwapEndianess = 1
) (
input logic clk_i,
Expand Down
10 changes: 5 additions & 5 deletions core/commit_stage.sv
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


module commit_stage import ariane_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty
)(
input logic clk_i,
input logic rst_ni,
Expand Down Expand Up @@ -77,7 +77,7 @@ module commit_stage import ariane_pkg::*; #(
always_comb begin : dirty_fp_state
dirty_fp_state_o = 1'b0;
for (int i = 0; i < CVA6Cfg.NrCommitPorts; i++) begin
dirty_fp_state_o |= commit_ack_o[i] & (commit_instr_i[i].fu inside {FPU, FPU_VEC} || is_rd_fpr(commit_instr_i[i].op));
dirty_fp_state_o |= commit_ack_o[i] & (commit_instr_i[i].fu inside {FPU, FPU_VEC} || ariane_pkg::is_rd_fpr_cfg(commit_instr_i[i].op, CVA6Cfg.FpPresent));
// Check if we issued a vector floating-point instruction to the accellerator
dirty_fp_state_o |= commit_instr_i[i].fu == ACCEL && commit_instr_i[i].vfp;
end
Expand Down Expand Up @@ -117,7 +117,7 @@ module commit_stage import ariane_pkg::*; #(
// we can definitely write the register file
// if the instruction is not committing anything the destination
commit_ack_o[0] = 1'b1;
if (is_rd_fpr(commit_instr_i[0].op)) begin
if (ariane_pkg::is_rd_fpr_cfg(commit_instr_i[0].op, CVA6Cfg.FpPresent)) begin
we_fpr_o[0] = 1'b1;
end else begin
we_gpr_o[0] = 1'b1;
Expand Down Expand Up @@ -197,7 +197,7 @@ module commit_stage import ariane_pkg::*; #(
// ------------------
// AMO
// ------------------
if (RVA && instr_0_is_amo) begin
if (CVA6Cfg.RVA && instr_0_is_amo) begin
// AMO finished
commit_ack_o[0] = amo_resp_i.ack;
// flush the pipeline
Expand Down Expand Up @@ -229,7 +229,7 @@ module commit_stage import ariane_pkg::*; #(
if (!exception_o.valid && !commit_instr_i[1].ex.valid
&& (commit_instr_i[1].fu inside {ALU, LOAD, CTRL_FLOW, MULT, FPU, FPU_VEC})) begin

if (is_rd_fpr(commit_instr_i[1].op))
if (ariane_pkg::is_rd_fpr_cfg(commit_instr_i[1].op, CVA6Cfg.FpPresent))
we_fpr_o[1] = 1'b1;
else
we_gpr_o[1] = 1'b1;
Expand Down
2 changes: 1 addition & 1 deletion core/compressed_decoder.sv
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


module compressed_decoder #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty
) (
input logic [31:0] instr_i,
output logic [31:0] instr_o,
Expand Down
2 changes: 1 addition & 1 deletion core/controller.sv
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


module controller import ariane_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty
) (
input logic clk_i,
input logic rst_ni,
Expand Down
2 changes: 1 addition & 1 deletion core/csr_buffer.sv
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


module csr_buffer import ariane_pkg::*; #(
parameter ariane_pkg::cva6_cfg_t CVA6Cfg = ariane_pkg::cva6_cfg_empty
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty
) (
input logic clk_i, // Clock
input logic rst_ni, // Asynchronous reset active low
Expand Down
Loading

0 comments on commit 1db42ee

Please sign in to comment.