Jump to content

Module with variable number of ports


karandeep963

Recommended Posts

The easiest solution is to use an sc_vector of ports (new in SystemC 2.3).

Here is a simple example:

SC_MODULE( module )
{
  // vector of ports
  sc_core::sc_vector< sc_core::sc_in<int> > in_vec;

  module( sc_core::sc_module_name, unsigned n_in )
    : in_vec( "in_vec" ) // set name prefix
  {
    // delayed initialisation of port vector
    in_vec.init( n_in );
  }
};

 

For some more examples and features of  sc_vector, have a look at the SystemC 2011 New Features presentation (part of SystemC 2.3.0 download archive), and/or the IEEE 1666-2011 standard, section 8.5.

 

Greetings from Oldenburg,

  Philipp

 

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...