RE: [sv-ec] mailbox - unblocking order

From: Chris Spear <Chris.Spear_at_.....>
Date: Wed May 21 2008 - 07:02:22 PDT
Dan,

 

Section 15.4.5 says: "The mailbox waiting queue is FIFO. This does not
guarantee the order in which processes arrive at the queue, only that
their arrival order shall be preserved by the mailbox." In your example,
proc1 executes first, so it first in the FIFO. Likewise, proc2, and
proc3 are in the middle, and end. This assures fairness. If proc1 has a
second m.get(), it would not execute until #5, so it would be behind
proc2 and proc3.

 

The exact time to unblock is not specified. This is similar the issue of
what to do when thread1 is blocking with @(signal). If thread2 changes
signal, should the simulator start thread1 immediately or only when
thread2 blocks.

 

Chris Spear

 

 

From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Daniel Mlynek
Sent: Wednesday, May 21, 2008 3:26 AM
To: sv-ec@eda.org
Subject: [sv-ec] mailbox - unblocking order

 

I cannot figure out how processes blocked by get mailbox function should
be unblocked. Is it tool dependend, random or LRM some how defines for
such cases should work.

1st should processes be unblocked in the order of blocking, or in fifo
order? (I'm not asking bout messages - messages should be strored in
FIFO) - the case is whe more thatn one process are blocked by get on the
same mailbox

2nd when the processes should unblock - exactly at the moment when
message is putted into mailbox - i below case it means that after
m.put(1) process unblocking_oric should be interrupted and process proc1
should be unblocked and finished and so on.  The other possibility is to
unblock processes proc1, proc2, proc3 after unblocking_proc in suspended
or iin this case finished.

 

 

module top;
    mailbox #(integer) m=new;
    integer i;
        integer file;
    

 

    initial begin :proc1
        #1
        m.get(i);
        $fdisplay(file,"#1 %d %d", i, m.num());
    end

 

    initial begin :proc2
        #2;
        m.get(i);
        $fdisplay(file,"#2 %d %d", i, m.num());
    end

 

 initial begin :proc3
        #3;
        m.get(i);
        $fdisplay(file,"#3 %d %d", i, m.num());
    end

 

    initial begin :ublocking_proc
        #5;
        file= $fopen("results.txt");
        m.put(1);

        $fdisplay(file,"put(1)");
        m.put(2);

        $fdisplay(file,"put(2)");
        m.put(3);

        $fdisplay(file,"put(3)");
          if (m.try_get(i))
               $fdisplay(file,"#4 try %d %d", i, m.num());
    end

 

endmodule

 

 

DANiel

 


 


-- 
This message has been scanned for viruses and 
dangerous content by MailScanner <http://www.mailscanner.info/> , and is

believed to be clean. 


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed May 21 07:06:41 2008

This archive was generated by hypermail 2.1.8 : Wed May 21 2008 - 07:07:29 PDT