Skip to content

Commit

Permalink
Extensions and bug fixes
Browse files Browse the repository at this point in the history
* Stall CSR operations if there is a pending vector instruction

* Set vstart=0 for succesful vector instructions

* Extend and fix Ara exception reporting from VLSU

* Add MMU interface (just mock)

* Refactoring
  • Loading branch information
MaistoV committed Oct 18, 2023
1 parent cf97647 commit 11ceb51
Show file tree
Hide file tree
Showing 8 changed files with 1,035 additions and 820 deletions.
12 changes: 6 additions & 6 deletions hardware/include/ara_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,17 @@ package ara_pkg;
} ara_op_e;

// Return true if op is a load operation
function automatic is_load(ara_op_e op);
function automatic logic is_load(ara_op_e op);
is_load = op inside {[VLE:VLXE]};
endfunction : is_load

// Return true if op is a store operation
function automatic is_store(ara_op_e op);
function automatic logic is_store(ara_op_e op);
is_store = op inside {[VSE:VSXE]};
endfunction : is_store

// Return true of op is either VCPOP or VFIRST
function automatic vd_scalar(ara_op_e op);
function automatic logic vd_scalar(ara_op_e op);
vd_scalar = op inside {[VCPOP:VFIRST]};
endfunction : vd_scalar

Expand Down Expand Up @@ -322,11 +322,11 @@ package ara_pkg;
// Scalar response
elen_t resp;

// Instruction triggered an error
logic error;
// Instruction triggered an exception
ariane_pkg::exception_t exception;

// New value for vstart
vlen_t error_vl;
vlen_t exception_vstart;
} ara_resp_t;

////////////////////
Expand Down
43 changes: 37 additions & 6 deletions hardware/src/ara.sv
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,25 @@ module ara import ara_pkg::*; #(
input logic scan_enable_i,
input logic scan_data_i,
output logic scan_data_o,

// CSR input
input logic en_ld_st_translation_i,

// Interface with CVA6's sv39 MMU
// This is everything the MMU can provide, it might be overcomplete for Ara and some signals be useless
output ariane_pkg::exception_t mmu_misaligned_ex_o,
output logic mmu_req_o, // request address translation
output logic [riscv::VLEN-1:0] mmu_vaddr_o, // virtual address out
output logic mmu_is_store_o, // the translation is requested by a store
// if we need to walk the page table we can't grant in the same cycle
// Cycle 0
input logic mmu_dtlb_hit_i, // sent in the same cycle as the request if translation hits in the DTLB
input logic [riscv::PPNW-1:0] mmu_dtlb_ppn_i, // ppn (send same cycle as hit)
// Cycle 1
input logic mmu_valid_i, // translation is valid
input logic [riscv::PLEN-1:0] mmu_paddr_i, // translated address
input ariane_pkg::exception_t mmu_exception_i, // address translation threw an exception

// Interface with Ariane
input accelerator_req_t acc_req_i,
output accelerator_resp_t acc_resp_o,
Expand Down Expand Up @@ -123,8 +142,8 @@ module ara import ara_pkg::*; #(
pe_resp_t [NrPEs-1:0] pe_resp;
// Interface with the address generator
logic addrgen_ack;
logic addrgen_error;
vlen_t addrgen_error_vl;
ariane_pkg::exception_t addrgen_exception;
vlen_t addrgen_exception_vstart;
logic [NrLanes-1:0] alu_vinsn_done;
logic [NrLanes-1:0] mfpu_vinsn_done;
// Interface with the operand requesters
Expand Down Expand Up @@ -171,8 +190,8 @@ module ara import ara_pkg::*; #(
.pe_scalar_resp_ready_o(pe_scalar_resp_ready ),
// Interface with the address generator
.addrgen_ack_i (addrgen_ack ),
.addrgen_error_i (addrgen_error ),
.addrgen_error_vl_i (addrgen_error_vl )
.addrgen_exception_i (addrgen_exception ),
.addrgen_exception_vstart_i(addrgen_exception_vstart )
);

// Scalar move support
Expand Down Expand Up @@ -337,8 +356,8 @@ module ara import ara_pkg::*; #(
.pe_req_ready_o (pe_req_ready[NrLanes+OffsetStore : NrLanes+OffsetLoad]),
.pe_resp_o (pe_resp[NrLanes+OffsetStore : NrLanes+OffsetLoad] ),
.addrgen_ack_o (addrgen_ack ),
.addrgen_error_o (addrgen_error ),
.addrgen_error_vl_o (addrgen_error_vl ),
.addrgen_exception_o (addrgen_exception ),
.addrgen_exception_vstart_o (addrgen_exception_vstart ),
// Interface with the Mask unit
.mask_i (mask ),
.mask_valid_i (mask_valid ),
Expand All @@ -354,6 +373,18 @@ module ara import ara_pkg::*; #(
.addrgen_operand_target_fu_i(sldu_addrgen_operand_target_fu ),
.addrgen_operand_valid_i (sldu_addrgen_operand_valid ),
.addrgen_operand_ready_o (addrgen_operand_ready ),
// CSR input
.en_ld_st_translation_i,
// Interface with CVA6's sv39 MMU
.mmu_misaligned_ex_o ,
.mmu_req_o ,
.mmu_vaddr_o ,
.mmu_is_store_o ,
.mmu_dtlb_hit_i ,
.mmu_dtlb_ppn_i ,
.mmu_valid_i ,
.mmu_paddr_i ,
.mmu_exception_i ,
// Load unit
.ldu_result_req_o (ldu_result_req ),
.ldu_result_addr_o (ldu_result_addr ),
Expand Down
Loading

0 comments on commit 11ceb51

Please sign in to comment.