The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> fork join block
https://designers-guide.org/forum/YaBB.pl?num=1295879383

Message started by Deb on Jan 24th, 2011, 6:29am

Title: fork join block
Post by Deb on Jan 24th, 2011, 6:29am

Dear All,

Please help me in the following issue.

I am giving here a code snippet. Please look into this.

///////////////////////////////////////////////////////////////////////////////

fork : globalOperator

           real timeOfStart;
           integer setMatchHigh;
           real timeOfMatch;
             
           timeOfStart = $abstime;
                $display("Fork Entered for %d time and timeOfStart for this fork is %f: \n", countStart, timeOfStart);  
               
/*             forever begin
                while (($abstime - timeOfStart) < delay)
         begin
                     if(!setExpr)
        begin
         $display("Expr became low before delay time exceeded and hence Thread disabled. \n");
           disable globalOperator;
            end
        else
        begin
           match = 1'b0;
        end
           end
                end    
             
                 forever begin
                 @(cross(($abstime - (timeOfStart + delay)), +1, TimeTolerance))
    begin
                 setMatchHigh = 1;
                      $display("setMatchHigh is made high. \n");
     timeOfMatch = $abstime;
        end
                end

         if(setExpr && setMatchHigh)
   begin
                 match = 1'b1;
 countMatch = countMatch + 1;
       end
               
                @(cross(($abstime - (timeOfMatch + KeepMatchHighTime)), +1, TimeTolerance))
       begin
   if(match)
           begin
      match = 1'b0;
      $display("%d Match was detected and match signal is made low: \n", countMatch);
          disable globalOperator;
                        end
       end      
       join

  end

//////////////////////////////////////////////////////////////////////////

Within the fork block, after each thread is created, I want to check setExpr for delay value after timeOfStart. For that I have used the while loop but its basically stalling the simulation. How can I do that within the fork block? Please suggest.  Also please suggest how can I use a cross statement within the fork block.

Thanks in advance for your kind support.

------------------------------
Thanking you,

Yours sincerely,
Debjit
======================
Debjit Pal

Title: Re: fork join block
Post by Marq Kole on Feb 2nd, 2011, 6:17am

There is no delay in your while loop, so it will continue to evaluate the code, never progressing through time. If you add a delay anywhere in the loop the while loop will probably work. However, this is a kind of "polling"technique which is quite costly in terms of performance and only as accurate as the delay value you specify. You might want to rework this into an event-driven test case, for instance an event that triggers on any change in setExpr.

Cheers,
Marq

Title: Re: fork join block
Post by Deb on Feb 2nd, 2011, 7:42am

Hi Marq,

Yep !! You are very correct.. I am implemented it already in other fashion with a concept of loop unrolling.. But anyways.. Thanks for your kind support...

Yours sincerely,

Debjit .

Debjit Pal.

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.