[sv-ec] Errata: Re: SystemVerilog Functions vs. string methods

From: Rich, Dave <Dave_Rich_at_.....>
Date: Tue Sep 27 2005 - 07:56:42 PDT
I believe that in sections 4.7.11 through 4.7.15 "task" should be replaced with "function string"
 
See post from Verification Guild.

[quote="Izmunuti"]One cannot call (or "activate") a task from within a function.  This is reasonable considering that functions must be zero-time while tasks may not be.

So, innocently, I coded the following method in a class:

   virtual function void display(string prefix);
      string kkstr;
      
      for (int kk=0; kk < this.ex.size; kk++) begin
         kkstr.itoa(kk);
         this.ex[kk].display({ prefix, ", Extent ", kkstr });
      end
   endfunction

However, this results in 

###### xyz.sv(228):          kkstr.itoa(kk);
** Error: xyz.sv(228): Task call in function is illegal.

Looking at the LRM 3.1a, sure enough, itoa is a _task_ not a void function:

3.7.11 itoa()
task itoa(integer i)

So, this is inconvenient.  Am I being stupid or is this an oversight in the SystemVerilog standard?  Methods of a class like "string" should not advance time and need not be tasks.

Sure, I can make my function into a task, but the work-around is not the point...[/quote]



David Rich
Verification Technologist
Design Verification & Test Division
Mentor Graphics Corporation
dave_rich@mentor.com
Office:   408 487-7206
Cell:     510 589-2625
Received on Tue Sep 27 07:56:59 2005

This archive was generated by hypermail 2.1.8 : Tue Sep 27 2005 - 07:58:27 PDT