Jump to content

Split custom bundled signals and connect to individual ports


Recommended Posts


I have a custom class that bundles a few primitive signals:

class Bundled {
    bool block0_en;
    bool block1_en;
    sc_int<3> block0_data_in;
    sc_int<4> block1_data_in;
class Block0; // SC_MODULE
class Block1; // SC_MODULE
    sc_in<Bundled> bundled_in;
    Block0 block0;
    Block1 block1;
      : bundled_in("bundled_in")
      block0.en(bundled_in.block0_en); // can't do this because block0_en is not a port!

How do I split this into the individual signals and connect to submodule ports?

Is there a convenient/standard way to accomplish this without reading "bundled_in" in an SC_CTHREAD/SC_METHOD, and then writing individual members to sc_signals?

Link to comment
Share on other sites

You'll have to create internal (i.e., private) signals for each member of the bundled class, which you need to connect to sub-blocks. Then, you have to register a SC_METHOD or SC_THREAD, which is sensitive to changes of the bundled input. The method/thread can then assign the correct new values to the internal signals based on the changed bundled input.

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.

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