Jump to content
g_as

Send one byte over tlm 2.0

Recommended Posts

I set the following in the constructor  

char test = 'X';

 uint32_t t_add  = 0;

and in the run()

sc_core::sc_time delay = sc_core::SC_ZERO_TIME;

tlm::tlm_generic_payload trans;
trans.set_command(tlm::TLM_WRITE_COMMAND);
trans.set_address(t_add);
trans.set_data_ptr((unsigned char*)&test);
trans.set_data_length(1);

socket->b_transport(trans, delay);

I didn't receive the 'X' at the target?

Do I miss something at the initiator?

Share this post


Link to post
Share on other sites

Well, I don't know how your infrastructure looks like, but in general your setup is ok. What is missing is to set the streaming width which should be one in your case.

So a bit more context would be allow to help you better. Context means:

  • how are the sockets connected (is there a direct connection initiator->target or do you use some bus system)
  • how do you read the value out of the payload?

Best regards

Share this post


Link to post
Share on other sites

Thanks Eyck

I set the streaming width to 1; Still the same issue

The initiator is connected to a bus.

I expect this data to be directed to a memory connected on the same bus. When I read this memory I find a garbage value.

Could you please give me a hint how can I debug that the bus routed the data correctly?

If I have "m" targets and "n" initiators connected to a bus:

1. Are their arrangement mandatory? or they are connected using names?

2. Do I need to arrange this connection according to the addresses I assign to them?

3. If I have a bus with 8 ports and I would like to connect only 6 is there a way to terminate the left 2?

Regards,

Share this post


Link to post
Share on other sites

Well, without lnowing the implementation it is hard to tell. I suppose your initiator sockets are connected to target sockets at he bus and the initiator sockets of the bus are connected to the target sockets of your target components. All these sockets need to be bound to each other (by calling bind() or the operator() function). There is no concept of bind-by-name in SystemC. Maybe you should have a look here: https://www.doulos.com/knowhow/systemc/tlm2/tutorial__3/

Sockets need to be bound except they are declared with the appropriate binding policy (the 4th template of the sockets). If this is not the case you need to create dummy targets.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×