Khushi Posted December 11, 2018 Report Share Posted December 11, 2018 Hi Guys I have a scenario where I have to connect sc_in<uint32_t> in_port to an sc_out<bool> out[32] out_ports. i.e. the xth bit in in_port need to be connected to out[x] Is there a way to connect these ? Thanks Khushi Quote Link to comment Share on other sites More sharing options...
Eyck Posted December 11, 2018 Report Share Posted December 11, 2018 Hi, there is no way to do this easily. Actually you have 32 output ports and 1 input port. So you need to connect the output ports to 32 bool signals and the input port to a uint32_t signal as well and make a SC_METHOD sensitive to all of the 32 bool signals. Within that method you iterate over the 32 bool signals and collect them into a 32bit value. BTW, having a POD array of ports is not preferable, I would use 'sc_core::sc_vector<sc_core::sc_out<bool>> out;'. This way you gain several things: the ports are initialized with a name based on the sc_vector instance name and you can bind a vector of ports to a vector of signals with a single line statement. Best regards Quote Link to comment Share on other sites More sharing options...
Khushi Posted December 11, 2018 Author Report Share Posted December 11, 2018 Thanks Eyck. Appreciated your quick help. Thanks again, Khushi Quote Link to comment Share on other sites More sharing options...
David Black Posted December 12, 2018 Report Share Posted December 12, 2018 @Eyck With one input, you only need to be sensitive to the single input port. @Khushi Since it's an sc_signal<>, you might even consider embedding the signal vector inside the module and then providing an sc_vector<sc_export<sc_signal_in_if<bool>>,16> to make it easier for your subscribers. Quote Link to comment Share on other sites More sharing options...
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.