信号已连接到以下多个驱动程序 [英] Signal is connected to following multiple drivers

查看:240
本文介绍了信号已连接到以下多个驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I trying to run the following and I receive this error:

以下是Verilog代码:

Here's the Verilog code:

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

这是我收到的警告和错误:

and here's the warnings and errors I receive:

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);但是我决定将索引设置为数组以避免这种问题,但是我仍在尝试。因此,无论索引是数组还是变量,我都遇到了多值问题。

However the main code is "assign index = (idx + 1) * max_cols + (i + 1 - idx);" but I decided to make "index" an array to avoid this problem, however I am yet running to it. So no matter if index is an array or just a variable I yet have this multiple value problem.

代码的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计数器中有问题,或者在这种情况下如何避免多重驱动程序问题?

I would also like to know if we can have a nested loop like what we have in its C counter part in the Verilog version or how to avoid the "multiple driver" problem in this case??

谢谢。

推荐答案

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

In your Verilog code, most index bits are constants that are either double driven(x) or not driven(z): index[7:0]:zzzxxxx1

解释如下。外部循环从4到0,这意味着 index [7:5] 是不受驱动的( z )。内部循环从0到 i ,展开为以下内容:

The explanation is the following. The outer loop is from 4 to 0, which means index[7:5] are undriven(z). The inner loop is from 0 to i, which unrolls to something like the following:

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);

所以 index [4:1] 是双驱动( x ),并且只有 index [0] 具有单个驱动程序。

So index[4:1] are double driven(x), and only index[0] has a single driver.

经过测试的编译代码: EDA游乐场

Compiled code with a test here: EDA Playground

这篇关于信号已连接到以下多个驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆