我尝试运行以下命令并收到此错误:
这是 Verilog 代码:
module needle( input referrence,input penalty,output index[7:0]);
//inout input_itemsets;
//input referrence;
//input penalty;
//output index;
parameter max_cols=8;
//
wire index[7:0];
wire referrence;
wire penalty;
//wire input_itemsets;
genvar i,idx;
generate
for( i = max_cols-4 ; i >= 0 ; i=i-1)
for( idx = 0 ; idx <= i ; idx=idx+1)
begin
assign index[i] = (idx + 1) * max_cols + (i + 1 - idx);
//assign index = (idx + 1) * max_cols + (i + 1 - idx);
//input_itemsets[index] <= maximum( input_itemsets[index-1-max_cols]+ referrence[index],
//input_itemsets[index-1] - penalty,
//input_itemsets[index-max_cols] - penalty);
end
endgenerate
endmodule
这是我收到的警告和错误:
WARNING:HDLCompiler:413 - "/home/suriyha/Monajalal/needle_t1/needle.v" Line 39: Result of 4-bit expression is truncated to fit in 1-bit target.
ERROR:HDLCompiler:1401 - "/home/suriyha/Monajalal/needle_t1/needle.v" Line 39: Signal index[3] in unit needle is connected to following multiple drivers:
Driver 0: output signal of instance Power (PWR_1_o_BUF_9).
Driver 1: output signal of instance Ground (GND_1_o_BUF_8).
Driver 2: output signal of instance Ground (GND_1_o_BUF_6).
Driver 3: output signal of instance Ground (GND_1_o_BUF_4).
Driver 4: output signal of instance Ground (GND_1_o_BUF_11).
Module needle remains a blackbox, due to errors in its contents
WARNING:HDLCompiler:1499 - "/home/suriyha/Monajalal/needle_t1/needle.v" Line 21: Empty module <needle> remains a black box.
然而,主要代码是“分配索引 = (idx + 1) * max_cols + (i + 1 - idx);” 但我决定将“索引”设为一个数组来避免这个问题,但是我还没有解决这个问题。所以无论 index 是一个数组还是一个变量,我都有这个多值问题。
代码的C版本也是:
for( idx = 0 ; idx <= i ; idx++){
index = (idx + 1) * max_cols + (i + 1 - idx);
input_itemsets[index]= maximum( input_itemsets[index-1-max_cols]+ referrence[index],
input_itemsets[index-1] - penalty,
input_itemsets[index-max_cols] - penalty);
}
我还想知道我们是否可以有一个嵌套循环,就像我们在 Verilog 版本的 C 对应部分中所拥有的那样,或者在这种情况下如何避免“多驱动程序”问题?
谢谢。