Verilog 我的产量不断变化

Verilog 我的产量不断变化,verilog,Verilog,这是booth乘法器的代码我的问题当数据a和b可用时,它将开始乘法并继续如果我想检查我的答案,我必须做#80$停止,但我如何修改我的代码,以便当busy标志变为零时,我的输出必须在数据行,等待其他输入请给我一些建议我正在尝试此操作直到昨天我才知道我可以手动使用$finish或$stop,但我不希望自动停止模拟,作为另一个可用的输入,它将再次启动,为什么我使用busy标志,您可以等到busy被取消评估。大概是这样的: module multi_tst_tst; reg clk, start;

这是booth乘法器的代码我的问题当数据a和b可用时,它将开始乘法并继续如果我想检查我的答案,我必须做#80$停止,但我如何修改我的代码,以便当busy标志变为零时,我的输出必须在数据行,等待其他输入请给我一些建议我正在尝试此操作直到昨天我才知道我可以手动使用$finish或$stop,但我不希望自动停止模拟,作为另一个可用的输入,它将再次启动,为什么我使用busy标志,您可以等到busy被取消评估。大概是这样的:

module multi_tst_tst;
  reg clk, start;
  reg [7:0] a, b;
  wire [15:0] ab;
  wire busy;

  multiplier multiplier1 (ab, busy, a, b, clk, start);

  initial begin
    clk = 0;
    a =8'b11100000; b =8'b00100000; start = 1; #10 start = 0;
  end
  always #5 clk = !clk;

  //$strobe("ab: %d busy: %d at time=%t", ab, busy, $stime);
endmodule
对于更详细的测试,测试(几乎)所有可能的输入:

  initial begin
    clk = 0;
    a =8'b11100000; b =8'b00100000; start = 1; 
    #10 start = 0;
    @(negedge busy); // waits until busy goes from 1 to 0
    $finish;
  end
初始开始
clk=0;
对于(a=8'd0;a
  initial begin
    clk = 0;
    a =8'b11100000; b =8'b00100000; start = 1; 
    #10 start = 0;
    @(negedge busy); // waits until busy goes from 1 to 0
    $finish;
  end
initial begin
  clk = 0;
  for (a=8'd0;a<8'd255;a=a+1) begin
    for (b=8'd0;b<8'd255;b=b+1) begin
      start = 1;
      #10 start = 0;
      @(negedge busy); //wait until multiplier ends
      @(posedge clk);  //waits one clock cycle before moving to the next pair of numbers
    end
  end