renvill
renvill

Reputation: 163

Difference between two Specman events with the same sampling event @sim

I have two events with the same sampling event @sim:

unit monitor_a_u is {
    sample_a : interface_port of tlm_analysis of data_item_s is instance;

    data_a : simple_port of uint(bits:32) is instance;
    keep data_a.hdl_path() == "<data_a's path>";

    event signal_a_r is rise(signal_a$) @sim;

    on signal_a_r {
        var data_a : data_item_s = new;
        data_a = data_a$;
        sample_a$.write(data_a);
};    

unit monitor_b_u is {
    sample_b : interface_port of tlm_analysis of data_item_s is instance;

    data_b : simple_port of uint(bits:32) is instance;
    keep data_b.hdl_path() == "<data_b's path>";

    event signal_b_f is fall(signal_b$) @sim;

    on signal_b_f {
        var data_b : data_item_s = new;
        data_b = data_b$;
        sample_b$.write(data_b);
};

When the two events above are triggered, data are sampled and compared by a scoreboard:

unit my_scbd_u like uvm_scoreboard {
    scbd_port sample_a : add   data_item_s;
    scbd_port sample_b : match data_item_s;

    sample_a_predict(item: data_item_s) is only {
        add_to_scbd(item);
        set_match_port(item, sample_b);
    };
};

extend my_top_env {
    my_scbd : my_scbd_u is instance;
    mon_a   : monitor_a_u is instance;
    mon_b   : monitor_b_u is instance;

    connect_ports() is also {
        mon_a.sample_a.connect(my_scbd.sample_a);
        mon_b.sample_b.connect(my_scbd.sample_b);
    };
};

Now in the simulator (IES ver. 15), the data I'd like to sample is at the vertical cursor in the waveform below, and the values are shown under the 'Values' column:

                     __
signal_a  __________|  |____________
          __________ _______________
data_a    ____0x1___X____0x0________
                    _____
signal_b  _________|     |___________
          _______________ ___________
data_b    _____0xA_______X___0xB_____

A data mismatch is detected at the time when signal_b falls, and the displayed message is something like: "data_b (0xA) is not equal to data_a (0x0)". I'm expecting the error report to be "data_b (**0xB**) is not equal to data_a (0x0)".

Can someone explain why the scoreboard seems to get data differently from what is seen on the waveform? Could this be a delta delay issue in Specman?

Upvotes: 0

Views: 416

Answers (1)

user3467290
user3467290

Reputation: 781

The Scoreboard itself does not sample the lines, it just adds the values that were passed to it via the ports. I guess that when port_b was written, the scoreboard got its current value (which was A at that time). When the value was compared, when port_a was written - the scoreboard compared against the stored value (A), and not the new value.

Do I see correct - The value A (the "add") is updated before the B (the "match")? If so, I assume you are using the delay_match_in_scbd() instead of match_in_scbd(). This means that the Scoreboard stores the value, and the compare take place when add() is called.

You can issue the command "trace scoreboard" to see when items are written to the scoreboard ports, and when compare takes place.

Upvotes: 1

Related Questions