João Paulo Posted August 31, 2021 Report Share Posted August 31, 2021 I'm creating a parametrized Network on Chip on SystemC, and i need to pass the position of each router by parameters, so i tried templates but they don't accept variables, only const values, for now, i'm using the sc_in port, but i'm trying to not use this, anyone now's other ways? Quote Link to comment Share on other sites More sharing options...
Eyck Posted September 1, 2021 Report Share Posted September 1, 2021 Why not use constructor prameters? Another option would be cci_params. Via the broker they can be given a value before they are created. So you can use them in contructor bodies.... David Black, João Paulo and swami-cdsi 3 Quote Link to comment Share on other sites More sharing options...
maehne Posted September 1, 2021 Report Share Posted September 1, 2021 As @Eyck suggested, constructor parameters should fit best your needs. You can even give them default values if it is sensible. If the number of parameters grows, grouping them in a struct may become handy. Its members can be default-initialised and you can override them with assignments before passing the whole struct to the module constructor. Personally, I like to first check for consistency and legal range for these parameters in the constructor / member function to which I pass this struct, e.g., by using assertions before actually using them for describing any behaviour/internal structure. João Paulo and swami-cdsi 2 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.