sumit_tuwien Posted April 13, 2017 Report Share Posted April 13, 2017 Hello All, I wrote a class as follows: # ifndef ALLESGUTE_H_ # define ALLESGUTE_H_ # include <cstdint> # include <systemc> template < typename T > class allesGute final : public sc_core::sc_object { private : T vData ; T someOtherVData ; public : explicit allesGute(const char* name_) : sc_core::sc_object { name_ } , vData { 0 } {} const char* kind() const override { return "allesGute" ; } // Helpers : T read() const { return vData ; } void write(const T& var_) { vData = var_ ; } ~allesGute() final = default ; allesGute(const allesGute& other) = delete ; allesGute& operator=(const allesGute& other) = delete ; allesGute(allesGute&& other) = delete ; allesGute&& operator=(allesGute&& other) = delete ; }; # endif How shall I register vData with tracing system ? Thanks in advance, Regards, Sumit Quote Link to comment Share on other sites More sharing options...
AmeyaVS Posted April 13, 2017 Report Share Posted April 13, 2017 Hello @sumit_tuwien, You can declare the sc_trace method as a friend function. Here is a small sample of what it might look like: # ifndef ALLESGUTE_H_ # define ALLESGUTE_H_ # include <cstdint> # include <systemc> template < typename T > class allesGute final : public sc_core::sc_object { private : T vData ; T someOtherVData ; public : explicit allesGute(const char* name_) : sc_core::sc_object { name_ } , vData { 0 } {} const char* kind() const override { return "allesGute" ; } // Helpers : T read() const { return vData ; } void write(const T& var_) { vData = var_ ; } ~allesGute() final = default ; allesGute(const allesGute& other) = delete ; allesGute& operator=(const allesGute& other) = delete ; allesGute(allesGute&& other) = delete ; allesGute&& operator=(allesGute&& other) = delete ; // Friend function declaration. // Don't inline the definition since you might face issues later due to aggressive compiler optimizations. friend void sc_trace(sc_core::sc_trace_file *tf, const allesGute<T>& tObj, const std::string& name); }; // Friend function definition. template<typename T> void sc_trace(sc_core::sc_trace_file *tf, const allesGute<T>& tObj, const std::string& name) { // Assuming the type T is traceable type. // If not then you'll have to implement the sc_trace friend function for type T. sc_trace(tf, tObj.vData, name + "_vData"); sc_trace(tf, tObj.someOtherVData, name + "_someOtherVData"); } # endif Let me know if this helps. Regards, Ameya Vikram Singh Quote Link to comment Share on other sites More sharing options...
sumit_tuwien Posted April 13, 2017 Author Report Share Posted April 13, 2017 Hello Ameya, I tried earlier this way and it did not work. In fact I need to register this with any kind of tracing (for EDA vendor specific too). With your solution it does not work too. Quote Link to comment Share on other sites More sharing options...
AmeyaVS Posted April 13, 2017 Report Share Posted April 13, 2017 Hello @sumit_tuwien, If you can elaborate the use-case more, it would be better. It seems you are trying to implement your own channel interface, if my assumptions are right. If you are just looking for custom datatype which you need to push through the sc_in/out interface then this might not be required at all. Let us know. Regards, Ameya Vikram Singh Quote Link to comment Share on other sites More sharing options...
sumit_tuwien Posted April 13, 2017 Author Report Share Posted April 13, 2017 Actually not. I am trying to create my own custom data types which can be used in a module (for some particular reason) or channel or anywhere else. I want to benefit maximally from these data types by making them visible to tracing mechanism. The detail implementation of these datatypes has not been shown for confidentiality reasons. Regards, Sumit Quote Link to comment Share on other sites More sharing options...
maehne Posted April 13, 2017 Report Share Posted April 13, 2017 Dear Sumit, I fear that there's no universal solution to register your datatype for any kind of tracing mechanism. You will have to implement the interfaces of each tracing mechanism separately (i.e., SystemC's sc_trace() and SystemC AMS's sca_trace() + all the vendor tools, which don't use the standard mechanism) for your datatype. Be aware that the semantics of tracing may differ from the context, where you use your data type. Regards, Torsten 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.