diff --git a/hardware/src/masku/masku.sv b/hardware/src/masku/masku.sv index 168e533b2..da6fb002a 100644 --- a/hardware/src/masku/masku.sv +++ b/hardware/src/masku/masku.sv @@ -317,12 +317,23 @@ module masku import ara_pkg::*; import rvv_pkg::*; #( // Remaining elements of the current instruction in the commit phase vlen_t commit_cnt_d, commit_cnt_q; - // vpopc substitute - assign popcount = vcpop_operand[$clog2(DataWidth*NrLanes):0]; + // Population count for vcpop.m instruction + popcount #( + .INPUT_WIDTH (DataWidth*NrLanes) + ) i_popcount ( + .data_i (vcpop_operand), + .popcount_o(popcount ) + ); - // vfirst substitute - assign vfirst_count = vcpop_operand[$clog2(DataWidth*NrLanes)-1:0]; - assign vfirst_empty = vcpop_operand[0]; + // Trailing zero counter + lzc #( + .WIDTH(DataWidth*NrLanes), + .MODE (0) + ) i_clz ( + .in_i (vcpop_operand), + .cnt_o (vfirst_count ), + .empty_o (vfirst_empty ) + ); always_comb begin: p_mask_alu alu_result = '0;