Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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

 

 

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