Re: Re-entrant tasks

From: Adam Krolnik (adamk@cyrix.com)
Date: Fri Apr 30 1999 - 13:19:40 PDT


Hi Tom,

I'm not sure I understand the first comment here. The second sentence implying
the third is what I do not understand.

>So far our comments on re-entrant tasks have been confined to the fact that
>they are never actually necessary. Since the processes that call them are
>instantiated statically, instances of tasks for them to call can also be
>instantiated statically.

Here is an example of what I believe people will utilize automatic tasks
for.

always @(push_read)
  do_read(address, exp_data, attr);

// Automatic task that will be called atmost twice!
task automatic do_read;
  input [31:0] address, exp_data;
  input [15:0] attr;
  begin
  if (bus_allocate)
    @(negedge bus_allocate);
  bus_allocate <= #1 1'b1;
  
  @(posedge clk);
  ads <= #1 address;
  repeat (2) @(posedge clk);
  {a, b, c, d, e, f, g} <= #1 attrs;
  @(posedge clk);
  {a,b,c,d,e,f,g} <= #1 16'bz;
  wait (response != 0);
  @(posedge clk);
  if (response == 2)
    begin
    repeat (3) @(posedge clk);
    rec_data = data_bus;
    if (ext_data != rec_data)
      begin
      $display("ERROR: address %0h didn't receive expected data %0h. Instead it
got %0h.", address, exp_data, rec_data);
      report_error();
      end
    end
  else
    begin
    $display("ERROR: received wrong response for address %0h. Received response
of %0h.", address, response);
    report_error;
    end
  end
endtask

A task that is capable of starting a second time while the first one
is still executing.

Now, it's true that one could copy the task to two different names (do_read
and do_read1) and mutex between them. But that is either error prone
(developers never should copy and maintain code in 2 places) or
creates lots of little include files to include code multiple times.

Reading the second list of combinations of old and new events (good
combinations indeed) since access to automatic variables
is only permissible while within the same thread/process some of
these combinations should be fine.

We have also asked the PLI task force to provide PLI access to
automatic variables for the provision to enable display for debugging purposes.

<p><p> Adam Krolnik
    Verification Engineer
    Cyrix - NSC.
    Richardson TX. 75085



This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:53:27 PDT and
sponsored by Boyd Technology, Inc.