From f547478980ba5eb6529a5b15fe860fc79a1bd135 Mon Sep 17 00:00:00 2001 From: Emilien Garnier Date: Thu, 16 Jul 2026 11:22:40 +0200 Subject: [PATCH] [hardware] :bug: Fix vrgather out-of-range index hang in the mask unit --- CHANGELOG.md | 1 + hardware/src/masku/masku.sv | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 542eb153d..888622f72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Force cheshire's sim scripts re-generation - Fix u-boot to support RVV-linux - Fixed src emul check for vector integer extension operation + - Fix hang when a vrgather/vrgatherei16 index is out of range ### Added diff --git a/hardware/src/masku/masku.sv b/hardware/src/masku/masku.sv index d2fdccdc2..f63bf7339 100644 --- a/hardware/src/masku/masku.sv +++ b/hardware/src/masku/masku.sv @@ -1264,7 +1264,11 @@ module masku import ara_pkg::*; import rvv_pkg::*; #( // VID does not require any operand, while VRGATHER/VCOMPRESS's ALU operand is just preprocessed to get the indices. // Therefore, VRGATHER/VCOMPRESS's operand are special. Only the vd operand works in the MASKU ALU. if (!result_queue_full && (&masku_operand_alu_valid || vinsn_issue.op inside {VID,[VRGATHER:VCOMPRESS]}) - && (&masku_operand_vd_valid || (!vinsn_issue.use_vd_op && !(vinsn_issue.op inside {[VRGATHER:VCOMPRESS]}))) + // FIX (vrgather OOB hang): an out-of-range VRGATHER/VRGATHEREI16 index reads 0 + // (RVV 1.0 ยง16.4) and the masku never requests vd data for it, so the original + // &masku_operand_vd_valid gate waited forever. Waive vd-valid when the index is OOB. + && (&masku_operand_vd_valid || (!vinsn_issue.use_vd_op && !(vinsn_issue.op inside {[VRGATHER:VCOMPRESS]})) + || (vrgat_idx_oor_q && (vinsn_issue.op inside {VRGATHER,VRGATHEREI16}))) && (&masku_operand_m_valid || vinsn_issue.vm || vinsn_issue.op inside {[VMADC:VMSBC]}) && (!vrgat_idx_fifo_empty || !(vinsn_issue.op inside {[VRGATHER:VCOMPRESS]}))) begin