nizam.ahmed Posted November 8, 2012 Report Share Posted November 8, 2012 Folks, In SystemC multi-ports, one could access the sc_interface methods of specific port instance using operator [] overloaded method. Was there any reason to not have had C++ method in sc_port to allow access to individual port instances? For example, Assume I have a port declaration like. sc_port<some_interface_type, 4> p; I have to ensure the bind order so that the ports are bound correctly. For example, p.bind(some_module.first_export); p.bind(some_module.second_export); p.bind(some_module.third_export); p.bind(some_module.fourth_export); Assume that we introduce a method named at(int index) in sc_port, that returns the sc_port instance for the index, then one could have performed bindings as follows (essentially, the order of binding is no more significant). p.at(2).bind(some_module.third_export); p.at(1).bind(some_module.second_export); p.at(0).bind(some_module.first_export); p.at(3).bind(some_module.fourth_export); I have some of the binds captured in meta-data format( IPXACT) and my parser would not always return the bind in the sequence that the current SystemC expects. Having a _at_ method would have helped. Any thoughts/suggestions/comments? BR/Nizam Quote Link to comment Share on other sites More sharing options...
apfitch Posted November 8, 2012 Report Share Posted November 8, 2012 I don't know if there was a fundamental reason, but as multi-ports can be bound to an unknown number of interfaces (if you set max number of bindings to zero) maybe that's why? When you refer to "port instances" that's not what happens. There's only one port, with bindings to multiple interfaces. If you want that feature, why not just use an array of ports, then you really will have multiple port instances? regards Alan Quote Link to comment Share on other sites More sharing options...
nizam.ahmed Posted November 8, 2012 Author Report Share Posted November 8, 2012 Hi Alan, Thanks for the response. Right. I can use array of ports. In such case, ( for a generic module -- like interconnect) i would have to fix a MAX_PORT_COUNT kind-of. sc_port multiport provides that flexibility though:) BR/Nizam Quote Link to comment Share on other sites More sharing options...
David Black Posted November 8, 2012 Report Share Posted November 8, 2012 Use the new sc_vector<> construct when creating that array of ports. See the pdf in the version 2.3 systemc/docs directory for some ideas. nizam.ahmed and Philipp A Hartmann 2 Quote Link to comment Share on other sites More sharing options...
nizam.ahmed Posted November 9, 2012 Author Report Share Posted November 9, 2012 Hi David, Thats is indeed neat. My questions is answered. BR/Nizam 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.