Jump to content
katang

How to ground bus access port?

Recommended Posts

I have some modules of the same class, and only part of the instances needs access to a certain bus, the others should not be linked to the bus. Of course I know during the setup phase, which ones should and which ones should not.  The ones that should connect, I can connect, it works fine. At the same time, for the others, I would like to tell the ports they should not be connected. Is there some method to do so (i.e. I want to avoid 'complete binding failed', not more) . Or, shall I subclass a new module class for those modules, with the only difference that they have an extra port? Or, shall I give those modules a very low priority (they surely will not use the bus), and connect them formally to the bus? (maybe it causes unneeded wiring)

I.e.

Share this post


Link to post
Share on other sites

Other option is to pass some flag to constructor

struct my_module : sc_module 
{
    std::unique_ptr< bus_port  >  bus_slave;
  
    my_module(sc_module_name, bool has_slave_port) 
    {
        if (has_slave_port) 
        {
            bus_slave = std::make_unique<bus_port>("bus_slave");
        }
    }

 

For SystemC 2.4 there is a sc_optional<T> class proposal that will allow to create ports "on demand" at any time during elaboration.

 

Share this post


Link to post
Share on other sites

Sorry, I forgot to mention: I have a master port, like this

 sc_port<scBus_blocking_if> bus_port;

If I understand the point correctly, I shall use pointer, that (still within the constructor) I can change from the default null.

 

 

Share this post


Link to post
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...