Khushi Posted August 1, 2019 Report Share Posted August 1, 2019 Hi I am trying to understand the max_num_extension() return value. When I create a payload object and use set_extension and then call max_num_extensions(), then it returns 2. I tried to debug and noticed that even if we didn't have any module, it still gives 2. The following piece of code prints 2. why it is so ? //#include "top.hpp" #include "tlm.h" #include "systemc.h" int sc_main(int argc, char** argv){ std::cout<<tlm::max_num_extensions()<<std::endl; sc_start(); return 0; } LRM@496 syas "The function max_num_extensions shall return the number of extension types, that is, the size of the extension array. As a consequence, the extension types shall be numbered from 0 to max_num_extensions()-1". Thanks Khushi Quote Link to comment Share on other sites More sharing options...
Eyck Posted August 2, 2019 Report Share Posted August 2, 2019 Each type of extension has an automatically assigned ordinal number which is available per extension as ID in the base class tlm_extension. So in your case you have 2 tlm_extensions defined somewhere. Under the hood this ID is used as an index into the m_extension array of the tlm::generic_payload. Best Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted August 2, 2019 Report Share Posted August 2, 2019 Hi Khushi, just adding to Eyck's answer, the "default" extensions in SystemC 2.3.3 are the following two implementation defined classes: tlm::tlm_endian_context tlm_utils::instance_specific_extension_carrier Greetings from Duisburg, Philipp 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.