Jump to content

Can TLM2 do distributed system


Recommended Posts

TLM2 is good at SOC(system-on-chip) modeling where all IP blocks(UART, Ethernet, DDR,etc) are in one chip(i.e. one sc_main) that is running the same OS in general.

Can I model a distributed system? e.g. a few computer nodes connected via some fabric(infiniband, or pcie-switch), each node runs its own (different) OS, which means each node will have its own sc_main() in the model.

Put another way, I understand with one sc_main() I can connect all IP blocks to model the SOC via TLM2, can I model multiple nodes that each has its own sc_main() and will boot with its own OS? is it possible?

Link to comment
Share on other sites

You can model multiple nodes but all of them have to be in one sc_main (if you use SystemC reference simulator which is single threaded only). The other option: you might build separate simulations and couple them via OS means (e.g. pipes, TCP, ...) and encapulsate this communication into a block having TLM sockets.

Link to comment
Share on other sites

Yes I was thinking about using tcp-BSD-sockets to connect multiple sc_mains, "encapulsate this communication into a block having TLM sockets" -- what does this exactly mean, is it something like below:

                          sc_main1

                              |

sc_main2 -- TLM2-Memory -- sc_main3

                              |

               Regular Linux process

          (main() instead of sc_main())

 

How can these 3 sc_mains and 1 main to communicate to each other? the sc_main1/sc_main2/sc_main3 can still use TLM to talk to the centered TLM2-memory device via some mutex protection(TLM2-memory is a shared memory for all), however I don't know how to tap a typical main() that is not linked to systemc into TLM2-Memory device, maybe a Unix-domain-socket?

The question really boils down to what's the best way for multiple sc_mains to access shared resource, in the demo above, assuming it's a memory pool used by all. I'm not sure how systemc/tlm handles this scenario yet. How can a systemc-model communicates with another model at a transaction level, e.g. a PCI master(x86) and a PCI slave(ARM graphic card) each runs its own sc_main() but share the same DDR somewhere else(e.g. a PCI DDR card)

Link to comment
Share on other sites

Quote

...a few computer nodes connected via some fabric(infiniband, or pcie-switch), each node runs its own (different) OS, which means each node will have its own sc_main() in the model.

The implication is not true, multiple `sc_main`s is not strictly necessary. You can still have a single `sc_main` even if there are multiple CPU models (each booting its own OS).

 

Quote

How can these 3 sc_mains and 1 main to communicate to each other? the sc_main1/sc_main2/sc_main3 can still use TLM to talk to the centered TLM2-memory device via some mutex protection(TLM2-memory is a shared memory for all), however I don't know how to tap a typical main() that is not linked to systemc into TLM2-Memory device, maybe a Unix-domain-socket?

An `sc_main` is just a function that is called from `main()` - where the implementation of `main()` is within the SystemC library. If you really want two different `sc_main`, then you also need two different `main()` - meaning you must have two different processes. Then you can use any IPC for communication like Eyck already explained.

 

Link to comment
Share on other sites

You're correct. The part I don't understand from Eyck is "encapsulate this communication into a block having TLM sockets", how can multiple processes talk via TLM sockets? TLM sockets are strictly inside the same single main() process as far as I can tell. A typical BSD-socket() can talk across processes though. How to connect multiple sc_main processes at transaction level(e.g. TLM) is my confusion, as standard unix socket can not do transaction-level communication so I can not use it. Thanks for your answers.

 

 

Link to comment
Share on other sites

You can create a module having a tlm_target socket which takes the payload and sends it accross a socket to a similar module where you take the data received by the socket and send it across the tlm_initiator socket. This way you encapsulate the socket data transfer into a TLM payload transfer. Eventually this allows you to run a simulation in a single thread/sc_main or distribute it accross several processes with little changes. In the latter case you only have to take care of the time syncronization of the to simulation kernels.

Link to comment
Share on other sites

() -- means the whole sc_main() process

[] -- means a block inside sc_main()

-> is the payload flow

so, if I understand correctly,  below shall get multiple-process sc_mains work at transaction level, meanwhile I must make sure all sc_main's timestamps will be in sync. In fact I don't know how to keep timestamp in sync between different sc_mains, I might just as well pull in everything under one sc_main after all.

([sc_main1] -> [tlm_target+bsdsocket()])  ----------->( [bsdsocket() + tlm_initiator] -> [sc_main2])

Thanks a lot for the helps!!

 

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...