Verilog “我该如何解决?”;错误-[ICPSD]驱动程序组合无效“;?

Verilog “我该如何解决?”;错误-[ICPSD]驱动程序组合无效“;?,verilog,system-verilog,hdl,synopsys-vcs,Verilog,System Verilog,Hdl,Synopsys Vcs,我正在调试下面显示的代码。我是SystemVerilog的新手,希望我能从中学习。让我知道任何建议 **我收到的错误有: Error-[ICPSD] Invalid combination of drivers Variable "Q" is driven by an invalid combination of structural and procedural drivers. Variables driven by a structural driver cannot hav

我正在调试下面显示的代码。我是SystemVerilog的新手,希望我能从中学习。让我知道任何建议

**我收到的错误有:

  Error-[ICPSD] Invalid combination of drivers
  Variable "Q" is driven by an invalid combination of structural and 
  procedural drivers. Variables driven by a structural driver cannot have any 
  other drivers.
  "divide.v", 13: logic [7:0] Q;
  "divide.v", 16: divide8bit testcase1(x, y, clk, Q, R);
  "divide.v", 23: Q = 8'b0;

  Error-[ICPSD] Invalid combination of drivers
  Variable "R" is driven by an invalid combination of structural and 
  procedural drivers. Variables driven by a structural driver cannot have any 
  other drivers.
  "divide.v", 13: logic [7:0] R;
  "divide.v", 16: divide8bit testcase1(x, y, clk, Q, R);
  "divide.v", 24: R = y;
**我的SystemVerilog代码是:

module divide8bit(
  input logic [7:0] x,y,
  input logic clk,
  output logic [7:0] Q,R);

  always_ff @(posedge clk)
    begin
      R <= R-x;
      Q <= Q + 8'd1;
    end
endmodule

module test1;

  logic [7:0] x,y,Q,R;
  logic clk;

  divide8bit testcase1 (x,y,clk,Q,R);

  initial 
    begin
            x = 8'd2;
            y = 8'd8;
            Q = 8'd0;
            R = y;
            clk = 1'd0;
            while(x <= R)
                begin
                    #5 clk = ~clk;
                end
            #5 $finish; 
        end
endmodule
模块divide8bit(
输入逻辑[7:0]x,y,
输入逻辑时钟,
输出逻辑[7:0]Q,R);
始终_ff@(posedge clk)
开始

R此处:您正在
模块test1
内分配给
Q
R
。同时,
模块testcase1
也尝试分配到
Q
R
。不要在
test1
中指定Q和R

您将如何在开始时分配它们,并延迟始终。这是我唯一的问题。我为这个问题已经做了好几个小时了。在always循环中进行所有初始化的问题是,它将重复,我只需要它们在Q=0和R=y处开始一次。您正在实现Q和R,以表现为触发器,可以使用重置信号进行初始化。使用带异步复位的触发器:我发现将testharness与DUT分离时,这个问题更容易理解。我发现更小的不同代码块更容易解析和理解层次结构,这可能值得在将来的问题中考虑。感谢您的见解。我现在就把它们分开!