Jump to content

Recommended Posts

Hi guys

I'm working on a simulation system that the connection between components changes during the execution of the system.

First time I'm facing this issue and not quite sure if I can change module to module connections during run-time and dynamically.

Any thoughts how I can do this in SystemC?

Thanks

Link to comment
Share on other sites

Thanks a lot. I hope there was a way to avoid hacky solutions.

I know SystemC is heavily used for modeling SoCs (where things are pretty much fixed by design) but this is a real network-related use case which I could happily use SystemC to model.

Link to comment
Share on other sites

There are several ways to approach this. A custom channel would be another approach, where the channel determined connectivity internally.

I would also say that these approaches would not be considered "hacky". SystemC is intentionally built on C++ [see note] to allow you more freedom in modeling. Synthesis tools are a bit more picky, but for modeling there are many approaches. Usually, it helps to provide block diagrams describing what you are modeling and where the connectivity needs to be dynamic. From that we can make a number of suggestions.

A hack approach would involve modifying the SystemC source code itself directly. That I would strongly discourage. You may look at it and even copy ideas from it, but don't use a modified SystemC source except experimentally when proposing changes via a git branch (and you probably need to be a committee member).

Note: The best modeling teams develop strong C++ proficiency (i.e., go beyond the basics of C and really learn a solid breadth of coding techniques in C++ using the full standard library).

Link to comment
Share on other sites

On 1/4/2021 at 7:04 PM, David Black said:

There are several ways to approach this. A custom channel would be another approach, where the channel determined connectivity internally.

I would also say that these approaches would not be considered "hacky". SystemC is intentionally built on C++ [see note] to allow you more freedom in modeling. Synthesis tools are a bit more picky, but for modeling there are many approaches. Usually, it helps to provide block diagrams describing what you are modeling and where the connectivity needs to be dynamic. From that we can make a number of suggestions.

A hack approach would involve modifying the SystemC source code itself directly. That I would strongly discourage. You may look at it and even copy ideas from it, but don't use a modified SystemC source except experimentally when proposing changes via a git branch (and you probably need to be a committee member).

Note: The best modeling teams develop strong C++ proficiency (i.e., go beyond the basics of C and really learn a solid breadth of coding techniques in C++ using the full standard library).

Thanks a lot David. Having been developing SystemC models for years, I cherish your insight.

I have attached a sample of design I'm trying to model. Tasks T_A communicate with tasks T_B over a communication channel (depicted as FIFOs). The connections between T_A and T_Bs are changing. Communication Manager (depicted) manages how the connections should be changing.

I can pull in the communication channels (FIFOs with added features) into the implementation of T_A or T_Bs but it's not a good representative of the actual system. I was hoping to keep them as separate entities (keep all connections within Communication Manager and free the tasks from having the knowledge of whom they need to connect to) and connect/reconnect using ports/exports or TLM sockets.

I can certainly do C++ modeling and use SystemC for handling events/timing as well. 

Any techniques/ideas you have is very much appreciated.

Sample Model.pdf

Link to comment
Share on other sites

  • 2 weeks later...

How about connecting all your nodes via the fifos to your communication manager? Then, the communication manager can internally manage how to route data received from the nodes based on your scenario? This would keep the structure of the model static while the actual communication paths change over the course of simulation.

Link to comment
Share on other sites

  • 3 weeks later...

Thanks. That's an interesting idea. I ended up solving it a different way though.

I decided to go away from explicit binding though. Basically ended developing a thin infrastructure layer on top of SystemC and define my own version of ports/exports where I can change the bindings on the fly. Of course I'm losing all the sanity checks and sophistication that is done on port/export bidings.

If you think that's an exceptionally bad path to take please let me know. At this moment it's working for me but then if I realize that it's extremely error prone then I'd rather do the right thing.

Link to comment
Share on other sites

Your approach is also valid. You simply cannot profit with this approach from the infrastructure provided by SystemC, e.g., tracing the communication between the nodes. Whether this may pose a problem in the future is up to you to decide.

Link to comment
Share on other sites

  • 2 weeks later...

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.

 Share

×
×
  • Create New...