Xesium Posted January 4, 2021 Report Share Posted January 4, 2021 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 Quote Link to comment Share on other sites More sharing options...
David Black Posted January 4, 2021 Report Share Posted January 4, 2021 sc_port's and their derivatives are not designed to be changed after elaboration. You could use multiports and simply change which index you are using. If needed you could create a wrapper to encapsulate the issue. Quote Link to comment Share on other sites More sharing options...
Xesium Posted January 4, 2021 Author Report Share Posted January 4, 2021 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. Quote Link to comment Share on other sites More sharing options...
David Black Posted January 5, 2021 Report Share Posted January 5, 2021 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). Quote Link to comment Share on other sites More sharing options...
Xesium Posted January 7, 2021 Author Report Share Posted January 7, 2021 hmm, sounds like I can't delete my previous response. Please see my following response: Quote Link to comment Share on other sites More sharing options...
Xesium Posted January 11, 2021 Author Report Share Posted January 11, 2021 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 Quote Link to comment Share on other sites More sharing options...
maehne Posted January 26, 2021 Report Share Posted January 26, 2021 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. Quote Link to comment Share on other sites More sharing options...
Xesium Posted February 12, 2021 Author Report Share Posted February 12, 2021 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. Quote Link to comment Share on other sites More sharing options...
maehne Posted February 13, 2021 Report Share Posted February 13, 2021 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. Quote Link to comment Share on other sites More sharing options...
Xesium Posted February 23, 2021 Author Report Share Posted February 23, 2021 Thanks a lot for that feedback. Appreciate it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.