Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Clearing the mailbox in system verilog

Status
Not open for further replies.

rkini

Newbie level 4
Newbie level 4
Joined
Apr 24, 2013
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,328
Is it possible to clear the mailbox contents?? Say if I want to flush out the contents of the mailbox at a certain point in my code, is there a way to do that???
 

You have to do this in a loop with try_get

while (my_mailbox.try_get(tx)) ; //this does a flush of the mailbox


The only problem with this is if you have pending blocked get()s on the same fifo. this code might not work properly ( a race) See http://www.eda.org/svdb/view.php?id=1738
 
  • Like
Reactions: rkini

    rkini

    Points: 2
    Helpful Answer Positive Rating
Will this approach also work if I havent bounded my mailbox?? I mean the try_get gets values only for the number of times of the contents and not the size of the mailbox, am I correct?
 

I have an environment class where i define a mailbox and construct its object as follows:
class environment;

mailbox driver2sb;

function void build()
driver2sb = new();// driver to scoreboard mailbox

endclass
In the scoreboard class i try to do :

class scoreboard;

mailbox driver2sb;

task start();

.....
.....
.....

while(driver2sb.try_get());
begin
$display("Clearing driver mailbox");
end

endclass

However I get the following error message:

errors: 0, warnings: 0
while(driver2sb.try_get());
|
ncvlog: *E,FAABPB (scoreboard.sv,52|22): task or function call does not specify all required formal arguments [10.2.2][10.3(IEEE)].
while(out2sb.try_get());


I dont know what I am doing wrong!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top