Skip to content

Commit

Permalink
config_pkg: clean-up config packages
Browse files Browse the repository at this point in the history
  • Loading branch information
mp-17 committed Dec 20, 2024
1 parent 35e5850 commit 01b26d5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 80 deletions.
8 changes: 4 additions & 4 deletions core/include/build_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ package build_config_pkg;

cfg.XLEN = CVA6Cfg.XLEN;
cfg.VLEN = CVA6Cfg.VLEN;
cfg.PLEN = CVA6Cfg.PLEN;
cfg.GPLEN = CVA6Cfg.GPLEN;
cfg.PLEN = (CVA6Cfg.XLEN == 32) ? 34 : 56;
cfg.GPLEN = (CVA6Cfg.XLEN == 32) ? 34 : 41;
cfg.IS_XLEN32 = IS_XLEN32;
cfg.IS_XLEN64 = IS_XLEN64;
cfg.XLEN_ALIGN_BYTES = $clog2(CVA6Cfg.XLEN / 8);
Expand Down Expand Up @@ -76,7 +76,7 @@ package build_config_pkg;
cfg.RVZicntr = CVA6Cfg.RVZicntr;
cfg.RVZihpm = CVA6Cfg.RVZihpm;
cfg.NR_SB_ENTRIES = CVA6Cfg.NrScoreboardEntries;
cfg.TRANS_ID_BITS = CVA6Cfg.TRANS_ID_BITS;
cfg.TRANS_ID_BITS = $clog2(CVA6Cfg.NrScoreboardEntries);

cfg.FpPresent = bit'(FpPresent);
cfg.NSX = bit'(NSX);
Expand Down Expand Up @@ -158,7 +158,7 @@ package build_config_pkg;
cfg.ModeW = (CVA6Cfg.XLEN == 32) ? 1 : 4;
cfg.ASIDW = (CVA6Cfg.XLEN == 32) ? 9 : 16;
cfg.VMIDW = (CVA6Cfg.XLEN == 32) ? 7 : 14;
cfg.PPNW = CVA6Cfg.PPNW;
cfg.PPNW = (CVA6Cfg.XLEN == 32) ? 22 : 44;
cfg.GPPNW = (CVA6Cfg.XLEN == 32) ? 22 : 29;
cfg.MODE_SV = (CVA6Cfg.XLEN == 32) ? config_pkg::ModeSv32 : config_pkg::ModeSv39;
cfg.SV = (cfg.MODE_SV == config_pkg::ModeSv32) ? 32 : 39;
Expand Down
6 changes: 0 additions & 6 deletions core/include/config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ package config_pkg;
int unsigned XLEN;
// Virtual address Size (in bits)
int unsigned VLEN;
//
int unsigned PLEN;
int unsigned GPLEN;
int unsigned PPNW;
// Atomic RISC-V extension
bit RVA;
// Bit manipulation RISC-V extension
Expand Down Expand Up @@ -206,8 +202,6 @@ package config_pkg;
bit unsigned UseSharedTlb;
// MMU depth of shared TLB
int unsigned SharedTlbDepth;
//
int unsigned TRANS_ID_BITS;
} cva6_user_cfg_t;

typedef struct packed {
Expand Down
71 changes: 1 addition & 70 deletions core/include/cv64a6_imafdcv_sv39_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ package cva6_config_pkg;
localparam config_pkg::cva6_user_cfg_t cva6_cfg = '{
XLEN: unsigned'(CVA6ConfigXlen),
VLEN: unsigned'(64),
PLEN: unsigned'(56),
GPLEN: unsigned'(41),
PPNW: unsigned'(44),
FpgaEn: bit'(0), // for Xilinx and Altera
FpgaAlteraEn: bit'(0), // for Altera (only)
TechnoCut: bit'(0),
Expand Down Expand Up @@ -153,73 +150,7 @@ package cva6_config_pkg;
SharedTlbDepth: int'(64),
NrLoadPipeRegs: int'(CVA6ConfigNrLoadPipeRegs),
NrStorePipeRegs: int'(CVA6ConfigNrStorePipeRegs),
DcacheIdWidth: int'(CVA6ConfigDcacheIdWidth),
TRANS_ID_BITS: $clog2(unsigned'(CVA6ConfigNrScoreboardEntries))
DcacheIdWidth: int'(CVA6ConfigDcacheIdWidth)
};

typedef struct packed {
logic [cva6_cfg.XLEN-1:0] cause; // cause of exception
logic [cva6_cfg.XLEN-1:0] tval; // additional information of causing exception (e.g.: instruction causing it),
// address of LD/ST fault
logic [cva6_cfg.GPLEN-1:0] tval2; // additional information when the causing exception in a guest exception
logic [31:0] tinst; // transformed instruction information
logic gva; // signals when a guest virtual address is written to tval
logic valid;
} exception_t;

// Accelerator - CVA6's
typedef struct packed {
logic req_valid;
logic resp_ready;
logic [31:0] insn;
logic [cva6_cfg.XLEN-1:0] rs1;
logic [cva6_cfg.XLEN-1:0] rs2;
fpnew_pkg::roundmode_e frm;
logic [cva6_cfg.TRANS_ID_BITS-1:0] trans_id;
logic store_pending;
logic acc_cons_en; // Invalidation interface
logic inval_ready; // Invalidation interface
} accelerator_req_t;

typedef struct packed {
logic req_ready;
logic resp_valid;
logic [cva6_cfg.XLEN-1:0] result;
logic [cva6_cfg.TRANS_ID_BITS-1:0] trans_id;
exception_t exception;
logic store_pending;
logic store_complete;
logic load_complete;
logic [4:0] fflags;
logic fflags_valid;
logic inval_valid; // Invalidation interface
logic [63:0] inval_addr; // Invalidation interface
} accelerator_resp_t;

// Accelerator - CVA6's MMU
typedef struct packed {
logic acc_mmu_misaligned_ex;
logic acc_mmu_req;
logic [cva6_cfg.VLEN-1:0] acc_mmu_vaddr;
logic acc_mmu_is_store;
} acc_mmu_req_t;

typedef struct packed {
logic acc_mmu_dtlb_hit;
logic [cva6_cfg.PPNW-1:0] acc_mmu_dtlb_ppn;
logic acc_mmu_valid;
logic [cva6_cfg.PLEN-1:0] acc_mmu_paddr;
exception_t acc_mmu_exception;
} acc_mmu_resp_t;

typedef struct packed {
accelerator_req_t acc_req; // Insn/mem
logic acc_mmu_en; // MMU
acc_mmu_resp_t acc_mmu_resp; // MMU
} cva6_to_acc_t;

typedef struct packed {
accelerator_resp_t acc_resp; // Insn/mem
acc_mmu_req_t acc_mmu_req; // MMU
} acc_to_cva6_t;
endpackage

0 comments on commit 01b26d5

Please sign in to comment.