acc_sysC Posted June 16, 2022 Report Share Posted June 16, 2022 For example, #include <cmath> template<int N, int M> class xyz: public sc_module { public: sc_in<sc_int<pow(2,N)*M> > IN; .. .. }; Is this possible? Quote Link to comment Share on other sites More sharing options...
karthickg Posted June 17, 2022 Report Share Posted June 17, 2022 This question has nothing to do with SystemC. If you have a C++ class templatized on a numeric, can you pass a non-const parameter to it? // Given: template<int N> class Foo { ... }; int bar() { ... }; int i; // Is this legal? Foo<bar()> f0; // Or even: Foo<i> f1; For what you are trying to do, `pow(2, N)` can be replaced with `1<<N` Quote Link to comment Share on other sites More sharing options...
acc_sysC Posted June 22, 2022 Author Report Share Posted June 22, 2022 @karthickg Thanks! that makes sense. It works! 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.