tmp_sc Posted February 23, 2023 Report Share Posted February 23, 2023 Hi all, I am trying to write some template test function, to compare read sc_in value vs expected one. Something like template<typename T> bool expect(const sc_in<T>&input, const uint32_t& expectedVal) { return (input.read() == expectedVal); } instead of const uint32_t& (and needing to overload for e.g. bool), how can I get "underlying" data type of sc_in ? I am using C++14 compiler. Thank you Quote Link to comment Share on other sites More sharing options...
maehne Posted March 7, 2023 Report Share Posted March 7, 2023 Why don't you simply use the template parameter T instead of uint32_t? Quote Link to comment Share on other sites More sharing options...
tmp_sc Posted March 15, 2023 Author Report Share Posted March 15, 2023 On 3/7/2023 at 11:09 AM, maehne said: Why don't you simply use the template parameter T instead of uint32_t? How exactly did you mean? template<typename T> bool expect(const sc_in<T>&input, const T& expectedVal) This would work for bool, but not for sc_uint<> data types 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.