Jump to content

DEFINING GLOBAL IN SYSTEMC and Member Function


wasim6691

Recommended Posts

2 hours ago, wasim6691 said:

In my code the code lines above the SC_MODULE are not synthesizeable ? I have to synthesize the code so which changes would You suggest me in the code. Thanks

Hard to say without processes source code. But if you use global variables like inp_image in your processes, this would not be synthesizable. 

Link to comment
Share on other sites

 

I am Using the inp_image in the Process as well as inside the member function. But I am also using the send_pixel member function inside another MODULE. That's why I was using it as global. What else can I do to make the inp_image array to be accessible inside another MODULE if I do not make it global?. Thanks

Link to comment
Share on other sites

Some comments to your code snippets:

  • Prefer to #include "systemc" instead of "systemc.h" to avoid namespace pollution. You'll then have to prefix SystemC symbols with the appropriate namespace prefix (recommended in most cases, especially headers). In the context of functions and implementation files, you can selectively import symbols from the SystemC namespaces with appropriate using statements.
  • Consider also to put your own classes, functions, typedefs and other declarations and definitions in a dedicated namespace to facilitate future code reuse!
  • #include "iomanip" -> #include <iomanip> (because it is a system header)
  • Initialization of global variables should not happen in the header file, but in the .cpp implementation file! To this end, you have to inp_image as extern.
  • Try to avoid using preprocessor macros as much as possible! They are only rarely needed in C++. Your NBITS*() macros could be replaced by inline functions, which are optionally templatized to an arbitrary argument type T. Starting from C++'11, you could even declare them as constexpr, so that a compiler may evaluate them already at compile time.
  • If your tool supports C++'11+, you may also declare your constants as constexpr.
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...