The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 12:47pm
Pages: 1
Send Topic Print
fork join block (Read 2237 times)
Deb
New Member
*
Offline



Posts: 5

fork join block
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
Back to top
 
 
View Profile   IP Logged
Marq Kole
Senior Member
****
Offline

Hmmm. That's
weird...

Posts: 122
Eindhoven, The Netherlands
Re: fork join block
Reply #1 - 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
Back to top
 
 
View Profile   IP Logged
Deb
New Member
*
Offline



Posts: 5

Re: fork join block
Reply #2 - 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.
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.