Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Verilog 连接到多个驱动器的信号结果植入_Verilog - Fatal编程技术网

Verilog 连接到多个驱动器的信号结果植入

Verilog 连接到多个驱动器的信号结果植入,verilog,Verilog,我一直在尝试实现一个简单的verilog程序,但我始终遇到两个错误,我似乎可以找到解决方案。我收到的两个错误是: 1. Line 21: Empty module <AddOrSubtractThenSelectAndDecodedInto7SegmentsDisplay> remains a black box. 2. Line 40: Signal Result[3] in unit AddOrSubtractThenSelectAndDecodedInto7Segments

我一直在尝试实现一个简单的verilog程序,但我始终遇到两个错误,我似乎可以找到解决方案。我收到的两个错误是:

1. Line 21: Empty module <AddOrSubtractThenSelectAndDecodedInto7SegmentsDisplay> remains a black box. 

2. Line 40: Signal Result[3] in unit AddOrSubtractThenSelectAndDecodedInto7SegmentsDisplay is connected to following multiple drivers:

Driver 0: output signal Result[3] of instance Latch (Result[3]).
Driver 1: output signal Result[3] of instance Latch (_i000011).
Driver 0: output signal Result[2] of instance Latch (Result[2]).
Driver 1: output signal Result[2] of instance Latch (_i000012).
Driver 0: output signal Result[1] of instance Latch (Result[1]).
Driver 1: output signal Result[1] of instance Latch (_i000013).
Driver 0: output signal Result[0] of instance Latch (Result[0]).
Driver 1: output signal Result[0] of instance Latch (_i000014).
Module AddOrSubtractThenSelectAndDecodedInto7SegmentsDisplay remains a blackbox, due to errors in its contents

您在这里推断一个闩锁:

always @(A,B,S) begin
    if (S == 1)
        {OF,Result} = A + B;
    else if (S == 0)
        {OF,Result} = A - B;
    // <-- inferred latch because S=2 and S=3 is not described
end 
注意:通常认为将您计划合成的内容指定为X的值是不好的做法

要解决多个驱动程序错误,您必须在同一个always块中设置所有对
结果的分配。移动指定或合并始终块


注:除非要求严格遵守1995年的编码惯例,否则不应在灵敏度列表中声明信号。而是使用2001年添加到verilog中的自动灵敏度列表(
@*
@(*)
)。您有2001年的支持,因为1995年不支持逗号作为灵敏度列表的信号分隔符;1995使用
作为灵敏度列表的信号分隔符。

我已经为同一个问题写了一个答案。您可以签入以下链接:

您已推断出锁存,因为您已获取2位宽的“S”,并且未为“S”的2个选项指定“Result”的值

if或case语句可能不完整 合成为闩锁。因为对于工具,您没有指定,什么 在剩余的if/case条件下在网络上驾驶。在这种情况下,, 工具将尝试制作一个硬件,该硬件将驱动前面的值 在这些条件下。为此,将推断出一个闩锁

现在,您将得到多个驱动程序错误,因为“结果”是通过多个始终块驱动的

“reg”变量不能有多个驱动程序。但是“电线”可以 当然有。因此,如果一个网络有多个驱动程序,那么它必须是 “电线”型

always @(A,B,S) begin
    if (S == 1)
        {OF,Result} = A + B;
    else if (S == 0)
        {OF,Result} = A - B;
    // <-- inferred latch because S=2 and S=3 is not described
end 
always @(OF,Result) begin
  // ...

  if (OF == 1)begin
    Result = 4'bx; // <-- second driver on 'Result'. Illegal for synthesis
    Display = 7'b0011101;
  end
end
always @(A,B,S) begin
    if (S == 1)
        {OF,Result} = A + B;
    else if (S == 0)
        {OF,Result} = A - B;
    // What for S == 2 or S == 3?
    // So tool thinks, that you want to have previous value of Result
    // in both cases, and hence it needs to infer a latch for Result to
    // have the previous value.
end