How to access single transaction item from a complete transaction UVM

Hi,

I’m not able to access single transaction variable from a complete transaction.Please help me in resolving this issue

Below code is part of my scoreboard,
after_entry is a class instance,data is class member,from monitor complete transaction is coming to Scoreboard

`uvm_info( get_name(), { "using uvm_default_printer\n",      after_entry.data.sprint() }, UVM_LOW )
	   	$display("transaction name %s",after_entry.data.get_name());
		if(after_entry.data.get_name()=="deagg_out_tr")
		$display("packet no %0d at time %0t \n",after_entry.data.tr_no,$time);

when I try to display tr_no from deagg_out_tr below compilation error is coming.

ncvlog: *E,NOTCLM (/user/kabo/src/test_uvm/pw_svf_scoreboard_uvm/sv/pw_scoreboard.sv,425|63): tr_no is not a class item.

Thanks in advance

In reply to kalyanib:

I assume after_entry is your transaction and deagg_out_tr is a data member of this transaction. then you can access this data member like this:

after_entry.deagg_out_tr

Hi,

same error is coming again,deagg_out_tr is not a class item …if I use after_entry.deagg_out_tr.tr_no also

deagg_out_tr is transaction coming from monitor

In scoreboard ,the export is connected to check_fifo ap
check_export.connect( check_fifo.analysis_export );

and from from check_fifo I’m accessing transaction

uvm_transaction checked;
check_fifo.get(checked);

and this checked parsing as an argument for the funtcion check_sb_data
check_sb_data(checked, get_stream_id(checked));

In check_sb_data function
function void pw_scoreboard::check_sb_data(uvm_transaction t,int stream_id=0);

   `uvm_info( get_name(), { "using uvm_default_printer\n", t.sprint() }, UVM_LOW ) 
	//if(t.get_name()=="deagg_out_tr")
	//$display("packet no %0d at time %0t \n",t.tr_no,$time);

t.sprint() is giving below output

Name          Type                   Size  Value 
-------------------------------------------------
deagg_out_tr  deagg_out_transaction  -     @71710
  tr_no       integral               16    'h1   
  pkt_sts     integral               1     'h0   
  pkt_len     integral               16    'h1786
  pkt_data    da(integral)           6022  -     
    [0]       integral               8     'h70  
    [1]       integral               8     'h17  
    ...       ...                    ...   ...

Now I want to access the tr_no,pkt_len. How can I get this ???
When tried above commented display for accessing tr_no ,I’m getting compilation error

ncvlog: *E,NOTCLM (/user/kabo/src/test_uvm/pw_svf_scoreboard_uvm/sv/pw_scoreboard.sv,371|48): tr_no is not a class item.

In reply to kalyanib:

OK, I see deagg_out_tr is your transaction having the data memebers tr_no, pkt_sts, pkt_len, pkt_data.

Yopu can access the data members like this:

deagg_out_tr.pkt_len.
The syntax is
<transaction_object>.

I did the same thing in my display ,It’s giving error

$display(“packet no %0d at time %0t \n”,t.tr_no,$time);

Hi ,
Please help me in solving this issue,not able to fix it.
I’m sending three transactions from monitor to Scoreboard,each transaction having different transaction variables.

Not able to access a single transaction variable from a transaction in Scoreboard.And able access complete transaction.

Thanks in advance.

In reply to kalyanib:

To debug you can print the whole transaction using the %p formatter.
Try this.

Because I see only a very small piece of your code and you do not post the complete error message it is impossible to help you.

with t.sprint() function I’m able print entire transaction,I have pasted the output in above reply.

when I try to access tr_no from deagg_out_tr below compilation error is coming.

`uvm_info( get_name(), { “using uvm_default_printer\n”, t.sprint() }, UVM_LOW )
if(t.get_name()==“deagg_out_tr”)
$display(“packet no %0d at time %0t \n”,t.tr_no,$time);

ncvlog: *E,NOTCLM (/user/kabo/src/test_uvm/pw_svf_scoreboard_uvm/sv/pw_scoreboard.sv,425|63): tr_no is not a class item.
Thanks in advance

In reply to kalyanib:

You are printing transaction t with t.sprint.
Afterwards you are working with another trasnaction: deagg_out_tr.
Dou you 1 resource with 2 different transaction types?

Did you try to print t.tr_out?

t is having three transactions deagg_out_tr ,deagg_1 deagag_2

In reply to kalyanib:

But all 3 transactions are of the same type and they are transmitted in serial order, right?
If this is the case you do not need checks like

if(t.get_name()=="deagg_out_tr")

Try t.tr_no and it should work.

yes,the 3 transactions are transmitted in serial order,but each transaction having different transaction variables,tr_no is present only in deagg_out_tr,not in other transactions.

I tried accessing by t.tr_no,not working.

In reply to kalyanib:

Could you please show more code from your scoreboard, especially the exports/ports you have and how you retrieve the date from your resources like tlm_fifo.

my_env conncet phase
rx_mon.item_collected_port_deagg.connect(chkr.inp1_exports[0]);
chkr.outp1_aports[0].connect(deagg_scbd.check_export);

my_scoreboard extends pw_scoreboard

In pw_scoreboard which is present in my_env2,my_scoreboard data comparison I’m doing in pw_scoreboard .

uvm_analysis_export #(T_CHECKED) check_export;

local uvm_tlm_analysis_fifo #(T_CHECKED) check_fifo;

check_export.connect( check_fifo.analysis_export );

task pw_scoreboard::run();
uvm_transaction posted;
uvm_transaction checked;
forever begin
check_fifo.get(checked);
uvm_info( get_name(), { using uvm_default_printer\n", checked.sprint() }, UVM_LOW ) uvm_info(“PW_SB”, $sformatf(“tr_no %0d”,checked.tr_no), UVM_LOW);
end

For this I’m getting compilation Error ,
ncvlog: *E,NOTCLM (/user/kabo/src/test_uvm/pw_svf_scoreboard_uvm/sv/pw_scoreboard.sv,898|67): tr_no is not a class item.

I’m thinking the problem is because of both scoreboards pw_scoreboard and my scoreboard are in different enviroment

tr_no is class item of deagg_transaction which is present in my_env ,but I’m trying to access it in my_env2.

Now help me out ,how access this tr_no ??

In reply to kalyanib:

Your scoreboard topology is not really clear to me.
But I found the following:

task pw_scoreboard::run();
  uvm_transaction posted;
  uvm_transaction checked;

I have 2 things with respect to this piece of code
(1) task run is depecated in UVM. Use run_phase instead
(2) posted and checked are of type uvm_transaction. This is the base class and does not know anything about the data members you want to access.

Thanks for the replies,

task pw_scoreboard::run();
uvm_transaction checked;

check_fifo.get(checked);
`uvm_info( get_name(), { using uvm_default_printer\n", checked.sprint() }, UVM_LOW )

with above sprint I’m able to see the transaction in the log like this,

UVM_INFO /user/kabo/src/test_uvm/pw_svf_scoreboard_uvm/sv/pw_scoreboard.sv(899) @ 352875.00000ns: uvm_test_top.rx_env.deagg_scbd [deagg_scbd] :using uvm_default_printer

Name Type Size Value

deagg_out_tr deagg_out_transaction - @71710
tr_no integral 16 'h1
pkt_sts integral 1 'h0
pkt_len integral 16 'h1786
pkt_data da(integral) 6022 -
[0] integral 8 'h70
[1] integral 8 'h17
[2] integral 8 'h40
… … … …

I understood checked is of type uvm_transaction. This is the base class and does not know anything about the data members,
but Is there any way to access these variables individually ???

In reply to kalyanib:

Of course there is away to do this. Simply use your transaction or seq_item definition containing these data members instead of the base_class uvm_transaction.

Replace

uvm_transaction checked;

with

your_transaction checked;

I’m asking from checked ,how can I access different tr variables??
I can’t change uvm_transaction to my_transaction, because morethan one transaction is coming from fifo.

In reply to kalyanib:

All transaction you’ll process are of the same type. For this reason you can change the type of your transaction from uvm_transaction to your_transaction.