Verilog AMS fork join

Discussion in 'Cadence' started by Debjit Pal, Jan 24, 2011.

  1. Debjit Pal

    Debjit Pal Guest

    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 statementwithin the fork block.

    Thanks in advance for your kind support.

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

    Yours sincerely,
    Debjit
    ======================
    Debjit Pal
     
    Debjit Pal, Jan 24, 2011
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.