coderoo Posted January 27, 2021 Report Posted January 27, 2021 Hi, 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; //constructor //operator== //operator= //operator<< //sc_trace }; class Block0; // SC_MODULE class Block1; // SC_MODULE SC_MODULE(Top) { sc_in<Bundled> bundled_in; Block0 block0; Block1 block1; SC_CTOR(Top) : 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? Quote
maehne Posted January 27, 2021 Report Posted January 27, 2021 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. coderoo 1 Quote
Recommended Posts
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.