Skip to content

Commit

Permalink
[hardware] WIP: vrgather/vcompress
Browse files Browse the repository at this point in the history
  • Loading branch information
mp-17 committed Nov 21, 2024
1 parent 171139b commit 0a21de3
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 6 deletions.
2 changes: 2 additions & 0 deletions hardware/include/ara_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ package ara_pkg;
VCPOP, VFIRST,
// Mask operations
VMANDNOT, VMAND, VMOR, VMXOR, VMORNOT, VMNAND, VMNOR, VMXNOR,
// Complex permutations
VRGATHER, VRGATHEREI16, VCOMPRESS,
// Scalar moves from VRF
VMVXS, VFMVFS,
// Slide instructions
Expand Down
33 changes: 33 additions & 0 deletions hardware/src/ara_dispatcher.sv
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,22 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #(
6'b001001: ara_req_d.op = ara_pkg::VAND;
6'b001010: ara_req_d.op = ara_pkg::VOR;
6'b001011: ara_req_d.op = ara_pkg::VXOR;
6'b001100: begin
ara_req_d.op = ara_pkg::VRGATHER;
ara_req_d.eew_vs1 = eew_q[ara_req_d.vs1];
// The MASKU will ask for elements from vs2 through the MaskB opqueue
// and deshuffle them with eew_vd_op encoding
ara_req_d.eew_vd_op = eew_q[ara_req_d.vs2];
end
6'b001110: begin // VRGATHEREI16
ara_req_d.op = ara_pkg::VRGATHEREI16;
// This allows the MASKU to deshuffle vs1 correctly
// Then, the MASKU will treat vs1 with eew == EW16
ara_req_d.eew_vs1 = eew_q[ara_req_d.vs1];
// The MASKU will ask for elements from vs2 through the MaskB opqueue
// and deshuffle them with eew_vd_op encoding
ara_req_d.eew_vd_op = eew_q[ara_req_d.vs2];
end
6'b010000: begin
ara_req_d.op = ara_pkg::VADC;

Expand Down Expand Up @@ -816,6 +832,12 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #(
6'b001001: ara_req_d.op = ara_pkg::VAND;
6'b001010: ara_req_d.op = ara_pkg::VOR;
6'b001011: ara_req_d.op = ara_pkg::VXOR;
6'b001100: begin
ara_req_d.op = ara_pkg::VRGATHER;
// The MASKU will ask for elements from vs2 through the MaskB opqueue
// and deshuffle them with eew_vd_op encoding
ara_req_d.eew_vd_op = eew_q[ara_req_d.vs2];
end
6'b001110: begin
ara_req_d.op = ara_pkg::VSLIDEUP;
ara_req_d.stride = acc_req_i.rs1;
Expand Down Expand Up @@ -1054,6 +1076,12 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #(
6'b001001: ara_req_d.op = ara_pkg::VAND;
6'b001010: ara_req_d.op = ara_pkg::VOR;
6'b001011: ara_req_d.op = ara_pkg::VXOR;
6'b001100: begin
ara_req_d.op = ara_pkg::VRGATHER;
// The MASKU will ask for elements from vs2 through the MaskB opqueue
// and deshuffle them with eew_vd_op encoding
ara_req_d.eew_vd_op = eew_q[ara_req_d.vs2];
end
6'b001110: begin
ara_req_d.op = ara_pkg::VSLIDEUP;
ara_req_d.stride = {{ELEN{insn.varith_type.rs1[19]}}, insn.varith_type.rs1};
Expand Down Expand Up @@ -1414,6 +1442,11 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #(
6'b001001: ara_req_d.op = ara_pkg::VAADD;
6'b001010: ara_req_d.op = ara_pkg::VASUBU;
6'b001011: ara_req_d.op = ara_pkg::VASUB;
6'b010111: begin
ara_req_d.op = ara_pkg::VCOMPRESS;
// Encoding corresponding to unmasked operations are reserved
if (!insn.varith_type.vm) illegal_insn = 1'b1;
end
6'b011000: begin
ara_req_d.op = ara_pkg::VMANDNOT;
// The source operands should have the same byte encoding
Expand Down
16 changes: 10 additions & 6 deletions hardware/src/masku/masku.sv
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ module masku import ara_pkg::*; import rvv_pkg::*; #(
logic [NrLanes*DataWidth-1:0] alu_result_vm, alu_result_vm_m, alu_result_vm_shuf;
logic found_one, found_one_d, found_one_q;

// VRGATHER/VCOMPRESS signals
// Current vrgather index
logic [15:0] vrgat_idx;

// How many elements we are processing per cycle
logic [idx_width(NrLanes*DataWidth):0] delta_elm_d, delta_elm_q;

Expand Down Expand Up @@ -685,12 +689,6 @@ module masku import ara_pkg::*; import rvv_pkg::*; #(
logic [NrLanes*DataWidth-1:0] vrgat_res;
// Buffer for the current element
logic [DataWidth-1:0] vrgat_buf;
// EEW of the current element
vsew_e vrgat_eew;
// Max 64Ki elements to count
logic [15:0] vrgat_cnt;
// Current index
logic [15:0] vrgat_idx;

// Extract the correct elements
vrgat_res = '1; // Default assignment
Expand Down Expand Up @@ -986,6 +984,12 @@ module masku import ara_pkg::*; import rvv_pkg::*; #(
// VCOMPRESS



// Stream the address requests into the lanes in parallel

// Save the indices into the MASKU ALU vrgather/vcompress queue for later use


///////////////////////
// MASKU ALU Control //
///////////////////////
Expand Down

0 comments on commit 0a21de3

Please sign in to comment.