Error in code

Hi,

Can someone tell me where exactly am I going wrong as everything seems to be in place?
I have tried to design a counter which loads the value when high and gives output according to the design intent. But I get an error which I can’t really figure it out in my

Here is my link to EDA playground

COUNTER

ThankYou

Declarations must precede statements. You need to first declare the handle for the object before using it in the statement.

In reply to sai_pra99:

You have a few mistakes in your code:
(1) Your sequence has to be parameterized for your seq_item.
(2) in the monitor you are declaring and constructing your transaction after the firts method call. This is illegal
(3) your seq_iten does not contain a filed named rst.
(4) in your moniror you are using convert2str. but the right name is convert2string.
(5) in your test you are using avirtual interface reg_if which is not declared.
(6) Never and never make an assignment in the test to the virtual interface.

There might be more mistakes. Try to fix the list mentioned above.
This code has fixed some of your mistakes:

In reply to chr_sue:

Thanks, Shreeman, and chr_sue.
I have rectified all of them.

I always have this doubt why do I have a synchronization problem with executing this code. As you can see the sequences are executed first rather than sequence->sequencer->driver->sbd->sequence
. Do I have to add a certain delay or a piece of code that would sync or should I use an even that could hold the sequence until the scoreboard completes? This has been happening to me for every sequential circuit

My link to EDA playground COUNTER

In reply to sai_pra99:

The problem is you are not driving with respect to clock at the driver. So everything gets driven at 190ns. See below



 virtual task drive_item(c_item item);
         **@(posedge vif.clk);**
         vif.data_in<=item.data_in;
         vif.updown<=item.updown;
         vif.load<=item.load;
    
     endtask