我编写了以下工作代码来计算启用信号。
logic l_en [0:N-1];
logic [0:N-1] l_output_grant [0:M-1];
always_comb begin
for (int i=0; i<N; i++) begin
l_en[i] = |{l_output_grant[0][i],
l_output_grant[1][i],
l_output_grant[2][i],
l_output_grant[3][i],
l_output_grant[4][i]};
end
end
我现在正在尝试将代码更改为 [0] 到 [4] 的参数。我尝试了以下代码
logic l_en [0:N-1];
logic [0:N-1] l_output_grant [0:M-1];
always_comb begin
for(int i=0; i<N; i++) begin
for(int j=0; j<M; j++) begin
l_en[i] = |l_output_grant[j][i];
end
end
end
这是行不通的。我认为这是因为它会在 j 的每次迭代中重新计算,因此如果 [j+1][i] 较低,则清除由 [j][i] 分配的启用。
请问我还有什么其他方法可以做到这一点?