Jump to content

SystemC data type deduction


tmp_sc

Recommended Posts

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

Link to comment
Share on other sites

  • tmp_sc changed the title to SystemC data type deduction
  • 2 weeks later...
  • 2 weeks later...
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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...