Jump to content

tracing waveforms in tlm


Recommended Posts

Hi,

I wanted to know ,is it possible to trace waveforms in tlm.I tried for alternate ways as it was done in system c earlier also.But i wasnt successful in my attempts.

  • One of the way i tried was by using the init_socket and targ_socket again in top which is completely wrong i guess.I cant reuse the tlm sockets again for my instantiated modules.

int sc_main(int argc,char* argv[])
{
    initiator* init;
    target* targ;

    tlm_utils::simple_initiator_socket<initiator>i_top_socket;
   tlm_utils::simple_initiator_socket<target>t_top_socket;

 

        init = new initiator("init");
        targ = new target("targ");


        init->i_socket(i_top_socket);
        targ->t_socket(t_top_socket);
 

   
    sc_clock clk1("clk1", 10, SC_NS, 0.5);
    sc_clock clk2("i_t_clk", 20, SC_NS, 0.5);

 

 

      init->i_socket.bind(targ->t_socket);
        init->ext_i_clk(clk1);
        targ->int_t_clk(clk2);
 

 

 

sc_trace_file* tf = sc_create_vcd_trace_file("b_transport");
    sc_trace(tf, clk1, "ext_clk");
    sc_trace(tf, clk2, "t_clk_internal");
    

    
    sc_trace(tf, init->i_socket, "i_socket");
    sc_trace(tf, targ->t_socket, "i_socket");
    

    sc_start(200, SC_NS);


    sc_close_vcd_trace_file(tf);
    

    return 0;

}

  • The other way i tried was getting the arguments not matching error i.e arguments support sc_signal type and i am using tlm types.I kno that the compiler is telling  the difference in arguments,but whats the alternate solution for this problem ?

Can anyone please tellme where am i going wrong and how to trace the transaction exactly ?

And Is it really possible to trace waveform in tlm ?

 

Thanks & regards,

Shubham

 

Link to comment
Share on other sites

Hi @David Black,

 

Either of them i.e tracing or recording is fine.I want to cross check the triggering of clocks and at what time exactly the transfer of data takes place in a waveform.

Can you please throw the light on how to record these transactions ? Is there requirement of any new software ? what will be the approach for recording?

In the above example which i had shared,i can see the waveforms of my clock but the transaction attributes(mainly data , address & cmd) i cant see.

 

Thanks & regards,

Shubham

 

  

Link to comment
Share on other sites

You may use the tlm recorder of the SystemC components lib (SCC, esp. here: https://git.minres.com/SystemC/SystemC-Components/src/branch/master/incl/scv4tlm). This writes into a text database (the SCV default). You can view this e.g. with Impulse (https://toem.de/index.php/projects/impulse) or SCViewer (https://git.minres.com/VP-Tools/SCViewer, binaries here: https://github.com/Minres/SCViewer/releases).

Basically you instantiate scc::tlm2_recorder_module and connect it's initiator and target sockets. to your target and initiator socket. Your sc_main should then look like:

int sc_main(int argc, char *argv[]) {
    scv_startup();
    scv_tr_text_init();
    scv_tr_db db("my_db.txlog");
    scv_tr_db::set_default_db(&db);
	dut_mod dut("dut");
    sc_start(1.0, SC_MS);
    return 0;
}

The database is closed upon destruction of the db object.

Best regards

Link to comment
Share on other sites

hi @Eyck,

I implemented the example as mentioned by you.But i am facing few problems to build it.

These are the steps which i had follwed.

1.I am using vs2015 for compiling,i used all sv4tlm files that has .h file name and included them in my main file .cpp and defined them also.You had mentioned under scc:: i need o instantiate,but when i had gone through the code ,found that it will come under namespace sv4tlm::,so made changes accordingly.

2.when i compiled my .cpp file,i was facing out with missing headers of scv.h file,as i was not aware about the scv files,after exploring and through accelera i included scv files.

  I made changes wrt to lib and source directories and it looks like the attached image.

3.By follwing al of this, i got the other error of scv.lib not found even though i had mentioned scv.lib;systemc.lib along with additional dependencies in linker properties.I had cross checked the properties by seeing one of the examples of scv .

 

Along with this ,the instantiated part code is as follows,

 

scv4tlm::tlm2_recorder_module<>  inst_mod("rec_module");

    inst_mod.target(targ->t_socket);
    inst_mod.initiator(init->i_socket);


    scv_startup();
    scv_tr_text_init();
    scv_tr_db db("my_db.txlog");
    scv_tr_db::set_default_db(&db);
    top t ("dut");

    sc_start(200,SC_NS);

 

But after follwing these steps,i was not succesfull in my attempts.

Can you please help me regarding this problem,where exactly is the issue.?

if i have made any mistakes in copying the files or in some other part of the code then can you please elaborate the steps to follow?

 

Thanks in advance.

 

Regards,

shubham

 

 

 

 

Screenshot (114).png

Link to comment
Share on other sites

Did you build the scv library? Just referencing the headers is not enough. Actually this should do the trick, if not posting the log might help.

Moreover you should change your toplevel. your initiator socket connects to the target socket of the recorder, the intiator socket of the recorder connects to the your target socket.

    scv_startup();
    scv_tr_text_init();
    scv_tr_db db("my_db.txlog");
    scv_tr_db::set_default_db(&db);

    top t ("dut");	
    scv4tlm::tlm2_recorder_module<>  inst_mod("rec_module");

    init->i_socket(inst_mod.target);
    inst_mod.initiator(targ->t_socket);

    sc_start(200,SC_NS); 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...