Regarding the compare transaction in scoreboard

Dear All,

I’m trying to understand the application of transaction in scoreboard.
In the common usage, there are 2 agents.
one monitor samples DUT inputs and another monitor samples DUT outputs.

For reusability, one transaction taken in monitor, driver and scoreboard.
In scoreboard, generally, it is comparing between driver and monitor transaction.

From here I can’t understand how scoreboard compare driver’s transaction and monitor’s transaction.

For example, If I got a transaction

class trans extends uvm_sequence_item;
   logic [15:0] dout;
rand bit [15:0] din;
rand bit        ld, inc, rst_n;
...
endclass

Probably we can say monitor, driver and scoreboard will use “trans”. then in scoreboard trans would be used to compare between driver’s “trans” and monitor’s “trans” such as below in scoreboard,

...
trans ext_tr, out_tr;
    forever begin
        expfifo.get(exp_tr);
        ...
        outfifo.get(out_tr);
        ...
        if (out_tr.compare(exp_tr) begin
            pass();
        else
            fail();
    end
...

    end

AS you can see “out_tr.compare(exp_tr)” I can’t understand how to compare between out_tr and exp_tr by using comapre method?

I assume that if I got the below transaction values in trans, and DUT has a behavior as "dout = din +2 ".

out_tr              exp_tr

dout=('h50);        dout;
din;                din=('h48)
ld=('h1);           ld=('h1);
inc=('h0);          inc=('h0);
rst_n=('h1);        rst_n=('h1);

If I ran out_tr.compare(exp_tr) then probably it was made an mismatch message If I correctly understand compare method.
How does compare method work between out_tr and exp_tr?