只是尝试为所有寄存器和索引创建一个if finished
为真的连接data == dataNew
。我能想到的唯一方法是使用一堆finishedAgg
线作为中间值;我很想摆脱他们,但我无法弄清楚如何。似乎有比这更简单!
reg[24:0] data[0:24];
reg[24:0] dataNew[0:24];
wire finished;
genvar i;
generate
wire finishedAgg[-1:24];
assign finishedAgg[-1] = 1;
for (i=0; i<25; i=i+1) begin :b1
assign finishedAgg[i] = finishedAgg[i-1] & (data[i]==dataNew[i]);
end
assign finished = finishedAgg[24];
endgenerate
答案 0 :(得分:1)
这是我的剪辑:
reg [24:0] finishAgg;
wire finished;
always @(*)
for (int i=0; i<25; i=i+1) begin :b1
finishedAgg[i] = (data[i]==dataNew[i]);
end : b1
assign finished = &finishedAgg;
它不比你的版本短,但它不需要generate
块。我已经声明i
in-loop Systemverilog-style,我正在使用reduction-AND来发出finished
信号。