从不同的测试平台调用任务系统验证日志



我正在尝试从测试平台文件中调用接口文件中定义的任务。 任务定义为

task master_monitor(
                   output bit [ADDR_WIDTH-1:0] addr,
                   output bit [DATA_WIDTH-1:0] data,
                   output bit we                    
                  );
          while (!cyc_o) @(posedge clk_i);                                                  
          while (!ack_i) @(posedge clk_i);
          addr = adr_o;
          we = we_o;
          if (we_o) begin
            data = dat_o;
          end else begin
            data = dat_i;
          end
          while (cyc_o) @(posedge clk_i);                                                  
     endtask 

在我的测试平台中,接口被实例化为wb_bus,我尝试通过以下方式调用任务:

wire [WB_DATA_WIDTH-1:0] dat_wr_o;
wire [WB_DATA_WIDTH-1:0] adr;
wire we;
initial
begin
    repeat(10) begin
    wb_bus.master_monitor(adr, dat_wr_o, we);
    end
end

当我在 modelim 上模拟时,我最终会遇到以下错误:

   ** Error: (vsim-3047) ../testbench/top.sv(52): actual value for formal 'data' of 'master_read' must be assignable.
#    Time: 0 ps  Iteration: 0  Instance: /top File: ../testbench/top.sv
# ** Error: (vsim-3047) ../testbench/top.sv(53): actual value for formal 'we' of 'master_monitor' must be assignable.
#    Time: 0 ps  Iteration: 0  Instance: /top File: ../testbench/top.sv
# ** Error: (vsim-3047) ../testbench/top.sv(53): actual value for formal 'data' of 'master_monitor' must be assignable.
#    Time: 0 ps  Iteration: 0  Instance: /top File: ../testbench/top.sv
# ** Error: (vsim-3047) ../testbench/top.sv(53): actual value for formal 'addr' of 'master_monitor' must be assignable.
#    Time: 0 ps  Iteration: 0  Instance: /top File: ../testbench/top.sv

我是否以正确的方式传递变量?有人可以帮助我吗?

您不能像adr那样将有线信号传递到任务的输出范围。将它们更改为 logic ,或者创建传递给任务参数的中间变量,然后将它们assign到线路。

最新更新