信号连接到以下多个驱动器

2023-12-24

我尝试运行以下命令并收到此错误:

这是 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 对应部分中那样,或者如何避免这种情况下的“多驱动程序”问题?

Thanks.


在你的 Verilog 代码中,大多数index位是双驱动常量(x) 或未驱动(z): index[7:0]:zzzxxxx1

解释如下。外层循环是从4到0,意思是index[7:5]未驱动(z)。内循环是从0到i,展开后如下所示:

assign index[4] = (0 + 1) * max_cols + (4 + 1 - 0);
assign index[4] = (1 + 1) * max_cols + (4 + 1 - 1);
...
assign index[1] = (0 + 1) * max_cols + (1 + 1 - 0);
assign index[1] = (1 + 1) * max_cols + (1 + 1 - 1);
assign index[0] = (0 + 1) * max_cols + (0 + 1 - 0);

So index[4:1]是双驱动的(x),并且仅index[0]有一个司机。

编译后的代码和测试如下:电子设计自动化游乐场 http://www.edaplayground.com/s/4/47

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

信号连接到以下多个驱动器 的相关文章

随机推荐