Sensitivity list in task

Hello,

I have a dpi function, which I want to sample when there will be new transaction item available. Is there possible to have a sensitivity list inside task, similar to always block, so when the value of items change it will sample the dpi function.

for example:


  virtual task run_phase(uvm_phase phase);
    super.run_phase(phase);
    fork 
      collect_input_data();
      run_rm();
    join_none

  endtask

...

  virtual task collect_input_data();

    act_fifo.get(item_1);
    item_1_input = item_1.data;   

  endtask
 
  virtual task run_rm();

   forever @ (item_1_input,item_2_input)
     begin 
       dpi_function(item_1_input,item_2_input,output); 
     end
  endtask

In reply to EleneSajaia:

That should work assuming item_1_input is a class member (not local to the tasks). The only problem is if the value of data does not change between transactions, the dpi_function does not get called. If that is a problem, you could do @(item_1) instead.

In reply to dave_59:

thanks Dave.
Is it possible to put an array in sensitivity list?


...
item_1_input[ii] = item_1[ii].data; 
...
forever @ (item_1_input)
     begin 
       dpi_function(item_1_input); 
     end


In reply to EleneSajaia:

An event control must have a singular typed value (not an unpacked array). But you can get around this by using @(*).

forever @ (*)
     begin 
       dpi_function(item_1_input); 
     end

In reply to dave_59:

In reply to EleneSajaia:
An event control must have a singular typed value (not an unpacked array). But you can get around this by using @(*).

forever @ (*)
begin 
dpi_function(item_1_input); 
end

I tested it in the way you mentioned above, but it doesn’t seem to meet expectations, so what’s the reason?

In reply to jianfeng.he:
Your understanding of the fork/join is wrong.
Your fork/join has 2 branches,the repeat and the print part. In you case it selects the repeat branch first and executes it.This is a loop with 20 executions. Afterwards it continues with the print part, but nothing chanes there. It rmaons qiete leaves the fork/join.
I believe you want to see a simulation result like this.

and this is a solution using fork/join

In fact, I want to test whether it is feasible to use @ (*) when the sensitive list is a non packaged array, as Dave said. From the experimental results, there are two questions that make me confused.

  1. The two parallel processes (repeat/forever) did not run as expected: the change in the value of arry in line 15 was not captured by the sensitive list in line 19, but it was OK to use the commented line 18.
  2. When using the statement in line 18, the simulation did not report a timeout because of forever, but ended after the repeat process ended

In reply to jianfeng.he:

My 2nd code example shows exactly this behavior. Where is the problem?

In reply to chr_sue:
I find that the 2nd code is the same as the 1st code. It doesn’t seem to show the behavior that @ (*) can capture changes in non packaged arrays