Jump to content

Karthik Rao

  • Content Count

  • Joined

  • Last visited

Reputation Activity

  1. Like
    Karthik Rao reacted to David Black in Changing the width in sc_bv<W>   
    These questions have little to do with SystemC per se, and are really about C++. Templates are all about compile-time elaboration and template arguments must be compile-time computable. If you use C++11 or later, then various forms of constexpr functions may be available, but they are still compile-time issues. You could of course use sc_bv_base and its constructors, but keep in mind that modules, ports, and other "hardware" constructs are not allowed to be modified after end_of_elaboration.
    KEY POINT: To be an effective SystemC designer, you MUST be proficient at C++. Minimal C++ is NOT enough. Knowledge of C (even expert knowledge) is totally inadequate and in some cases downright harmful. Furthermore, really good SystemC often requires excellent C++ skills. Therefore, before you even consider learning much in SystemC, you really should invest in a solid C++ course. Expert SystemC practitioners take time to continually update their C++ skills. If this does not sound like fun to you, then I would advise choosing a different discipline.
  2. Like
    Karthik Rao reacted to TRANG in Changing the width in sc_bv<W>   
    In many cases , I cant use "const"
    I often use : 
    #define or enum{}; you can try :
    #define WDW_SIZE 2 or
    enum {WDW_SIZE=2}; Best regards
  3. Like
    Karthik Rao reacted to Eyck in Changing the width in sc_bv<W>   
    Hi Karthik,
    you need to provide a constant expression as template argument so that it can be evaluated at compilation time. See http://en.cppreference.com/w/cpp/language/constant_expression. and http://en.cppreference.com/w/cpp/language/template_parameters#Template_non-type_arguments. So it would need to be written as:
    const int WDW_SIZE = 2; Best regards
  • Create New...