Delaying the start of scoreboard

I am trying to make APB VIP.

However I am stuck at scoreboard-
The idea is to delay the scoreboard start until the monitor has sent all the transactions (5 writes, 5 reads) to Scoreboard.
I tried the Delay method in run phase and it’s working fine but I want something which can be true for every test.

Is there a way to check the last transaction in sequence or monitor and then trigger an event from there to start the scoreboard ?

Thanks,
SR

MONITOR:



task run_phase(uvm_phase phase);
	apb_transaction apb_tx_mon;

forever begin
	apb_tx_mon = apb_transaction::type_id::create("apb_tx_mon", this);

	@(posedge apb_vin.clk)
	begin
			 
		if (apb_vin.penable)
		
		begin
			apb_tx_mon.paddr 	= apb_vin.paddr;
			apb_tx_mon.pwdata	= apb_vin.pwdata;
			apb_tx_mon.pwrite	= apb_vin.pwrite;
			if (!apb_vin.pwrite) begin
		#1;	apb_tx_mon.prdata	= apb_vin.prdata;
		
		end
			`uvm_info("MONITOR", "CALLING WRITE METHOD", UVM_MEDIUM);
			apb_mon_ap.write(apb_tx_mon);
				
	end
	end
end

SCOREBOARD:


task run();
#420;
	int i;
	i= sb_fifo.used();
	
	while(sb_fifo.used() != 0) 
begin
	`uvm_info("SCOREBOARD", $sformatf("fifo size: %0d ", sb_fifo.used()), UVM_MEDIUM);	
	sb_fifo.get(apb_tx);

	
	//`uvm_info("SCOREBOARD_PRINT", $sformatf("paddr=%0d, prdata=%0d, pwdata=%0d, pwrite=%0d", apb_tx.paddr, apb_tx.prdata, apb_tx.pwdata, apb_tx.pwrite), UVM_MEDIUM);
		if (!apb_tx.pwrite)
		begin

		`uvm_info("SCOREBOARD", $sformatf("pwrite= %0d", apb_tx.pwrite ), UVM_MEDIUM);
		compare(apb_tx);
		
		end
		else 
			write_box.put(apb_tx);
	end

endtask

In reply to Suresh_R:

Using absolute time in a TLM component is useless. The starting point of your scoreboard is the trigger event.

Could you please explain what apb_tx.pwrite is?

I believe your problem is somewhere else.

In reply to chr_sue:

apb_tx.pwrite is simply a read/write signal.
apb_tx.pwrite = 1 //Write
apb_tx.pwrite = 0 //Read

In reply to Suresh_R:

In reply to chr_sue:
apb_tx.pwrite is simply a read/write signal.
apb_tx.pwrite = 1 //Write
apb_tx.pwrite = 0 //Read

And what are you compairing? You can compare 2 items, but you have only one. Using the compare method of the seq_item you hae to call this on an item like this:

item1.compare(item2);

compares item1 against item2.

In reply to chr_sue:

The write transaction (data and addr) are stored in mailbox. Compare task is called whenever a read transaction happens to compare with the mailbox data.

In reply to Suresh_R:

This was not my question. I believe your syntax is wrong.

In reply to chr_sue:

I have defined a task named compare(). As I have mentioned earlier, the scoreboard is working perfectly fine with the #420 delay. But I want something concrete which works for every test.

In reply to Suresh_R:

OK, where do you trigger your event, you are waiting for in the scoreboard?

In reply to chr_sue:

Not actually triggering. That was mistakenly pasted when I was planning to trigger it from monitor. I have edited the question to remove the wrong part.

In reply to Suresh_R:

I do not understand what the benefit is to make the compare after all transactions have been executed. But currently you are retrieving each single transaction from the sb_fifo.
You have a wrong condition in your while loop.
Your objective is to store all transactions first before doing the compare. Just modify your code to reach this objective, i.e. count the number of the transactions you received from the monitor. And then do the compare for each transaction pair.
To be honest, it is not a good idea to do this because you are burning your computer resources and slowing down the simulation. Compairing on the fly as the transactions arrive is the real solution.

In reply to chr_sue:

I cannot compare on the fly as the transactions arrive. I have to wait for read transactions. I am doing 5 writes and then 5 reads from the same addresses.

To minimize the damage I am not saving the read transactions - the while condition does that for me. It compares as soon as a read transaction arrives.