From 8db5b4d7aa617a741679691ee1e9e222c752ae0d Mon Sep 17 00:00:00 2001 From: Matteo Perotti Date: Tue, 8 Oct 2024 14:08:31 +0200 Subject: [PATCH] [hardware] :bug: Fix vector slicing in operand requester --- hardware/src/lane/operand_requester.sv | 45 +++++++++++++++----------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/hardware/src/lane/operand_requester.sv b/hardware/src/lane/operand_requester.sv index b6159665d..0e23915d5 100644 --- a/hardware/src/lane/operand_requester.sv +++ b/hardware/src/lane/operand_requester.sv @@ -213,7 +213,8 @@ module operand_requester import ara_pkg::*; import rvv_pkg::*; #( // A set bit indicates that the the master q is requesting access to the bank b // Masters 0 to NrOperandQueues-1 correspond to the operand queues. // The remaining four masters correspond to the ALU, the MFPU, the MASKU, the VLDU, and the SLDU. - localparam NrMasters = NrOperandQueues + 5; + localparam NrGlobalMasters = 5; + localparam NrMasters = NrOperandQueues + NrGlobalMasters; typedef struct packed { vaddr_t addr; @@ -223,10 +224,18 @@ module operand_requester import ara_pkg::*; import rvv_pkg::*; #( opqueue_e opqueue; } payload_t; - logic [NrBanks-1:0][NrMasters-1:0] operand_req; + logic [NrBanks-1:0][NrOperandQueues-1:0] lane_operand_req; + logic [NrOperandQueues-1:0][NrBanks-1:0] lane_operand_req_transposed; + logic [NrBanks-1:0][NrGlobalMasters-1:0] ext_operand_req; logic [NrBanks-1:0][NrMasters-1:0] operand_gnt; payload_t [NrMasters-1:0] operand_payload; + for (genvar b = 0; b < NrBanks; b++) begin + for (genvar r = 0; r < NrOperandQueues; r++) begin + assign lane_operand_req[b][r] = lane_operand_req_transposed[r][b]; + end + end + for (genvar requester = 0; requester < NrOperandQueues; requester++) begin: gen_operand_requester // State of this operand requester state_t state_d, state_q; @@ -275,7 +284,7 @@ module operand_requester import ara_pkg::*; import rvv_pkg::*; #( // Make no requests to the VRF operand_payload[requester] = '0; - for (int bank = 0; bank < NrBanks; bank++) operand_req[bank][requester] = 1'b0; + for (int bank = 0; bank < NrBanks; bank++) lane_operand_req_transposed[requester][bank] = 1'b0; // Do not acknowledge any operand requester commands operand_request_ready_o[requester] = 1'b0; @@ -357,7 +366,7 @@ module operand_requester import ara_pkg::*; import rvv_pkg::*; #( automatic int bank = requester_q.addr[idx_width(NrBanks)-1:0]; // Operand request - operand_req[bank][requester] = !stall; + lane_operand_req_transposed[requester][bank] = !stall; operand_payload[requester] = '{ addr : requester_q.addr >> $clog2(NrBanks), opqueue: opqueue_e'(requester), @@ -449,11 +458,11 @@ module operand_requester import ara_pkg::*; import rvv_pkg::*; #( always_comb begin // Default assignment for (int bank = 0; bank < NrBanks; bank++) begin - operand_req[bank][NrOperandQueues + VFU_Alu] = 1'b0; - operand_req[bank][NrOperandQueues + VFU_MFpu] = 1'b0; - operand_req[bank][NrOperandQueues + VFU_MaskUnit] = 1'b0; - operand_req[bank][NrOperandQueues + VFU_SlideUnit] = 1'b0; - operand_req[bank][NrOperandQueues + VFU_LoadUnit] = 1'b0; + ext_operand_req[bank][VFU_Alu] = 1'b0; + ext_operand_req[bank][VFU_MFpu] = 1'b0; + ext_operand_req[bank][VFU_MaskUnit] = 1'b0; + ext_operand_req[bank][VFU_SlideUnit] = 1'b0; + ext_operand_req[bank][VFU_LoadUnit] = 1'b0; end // Generate the payload @@ -494,15 +503,15 @@ module operand_requester import ara_pkg::*; import rvv_pkg::*; #( }; // Store their request value - operand_req[alu_result_addr_i[idx_width(NrBanks)-1:0]][NrOperandQueues + VFU_Alu] = + ext_operand_req[alu_result_addr_i[idx_width(NrBanks)-1:0]][VFU_Alu] = alu_result_req_i; - operand_req[mfpu_result_addr_i[idx_width(NrBanks)-1:0]][NrOperandQueues + VFU_MFpu] = + ext_operand_req[mfpu_result_addr_i[idx_width(NrBanks)-1:0]][VFU_MFpu] = mfpu_result_req_i; - operand_req[masku_result_addr[idx_width(NrBanks)-1:0]][NrOperandQueues + VFU_MaskUnit] = + ext_operand_req[masku_result_addr[idx_width(NrBanks)-1:0]][VFU_MaskUnit] = masku_result_req; - operand_req[sldu_result_addr[idx_width(NrBanks)-1:0]][NrOperandQueues + VFU_SlideUnit] = + ext_operand_req[sldu_result_addr[idx_width(NrBanks)-1:0]][VFU_SlideUnit] = sldu_result_req; - operand_req[ldu_result_addr[idx_width(NrBanks)-1:0]][NrOperandQueues + VFU_LoadUnit] = + ext_operand_req[ldu_result_addr[idx_width(NrBanks)-1:0]][VFU_LoadUnit] = ldu_result_req; // Generate the grant signals @@ -537,8 +546,8 @@ module operand_requester import ara_pkg::*; import rvv_pkg::*; #( .rr_i ('0 ), .data_i ({operand_payload[MulFPUC:AluA], operand_payload[NrOperandQueues + VFU_MFpu:NrOperandQueues + VFU_Alu]} ), - .req_i ({operand_req[bank][MulFPUC:AluA], - operand_req[bank][NrOperandQueues + VFU_MFpu:NrOperandQueues + VFU_Alu]}), + .req_i ({lane_operand_req[bank][MulFPUC:AluA], + ext_operand_req[bank][VFU_MFpu:VFU_Alu]}), .gnt_o ({operand_gnt[bank][MulFPUC:AluA], operand_gnt[bank][NrOperandQueues + VFU_MFpu:NrOperandQueues + VFU_Alu]}), .data_o (payload_hp ), @@ -562,8 +571,8 @@ module operand_requester import ara_pkg::*; import rvv_pkg::*; #( .rr_i ('0 ), .data_i ({operand_payload[SlideAddrGenA:MaskB], operand_payload[NrOperandQueues + VFU_LoadUnit:NrOperandQueues + VFU_SlideUnit]} ), - .req_i ({operand_req[bank][SlideAddrGenA:MaskB], - operand_req[bank][NrOperandQueues + VFU_LoadUnit:NrOperandQueues + VFU_SlideUnit]}), + .req_i ({lane_operand_req[bank][SlideAddrGenA:MaskB], + ext_operand_req[bank][VFU_LoadUnit:VFU_SlideUnit]}), .gnt_o ({operand_gnt[bank][SlideAddrGenA:MaskB], operand_gnt[bank][NrOperandQueues + VFU_LoadUnit:NrOperandQueues + VFU_SlideUnit]}), .data_o (payload_lp ),