Jump to content

Concatenate in SystemC


Paul Riemer

Recommended Posts

Do you want to concatenate a group of sc_signal<bool> into sc_signal<sc_uint> ?

You need to create a SC_METHOD to do this, for example:

 

sc_signal<bool> bool_sig0{"bool_sig0"}; 
sc_signal<bool> bool_sig1{"bool_sig1"};
sc_signal<sc_uint<2>> uint_sig{"uint_sig"};

...

SC_METHOD(concat_method);
sensitive << bool_sig0 << bool_sig1;

...

void concat_method() {
  sc_uint<2> new_val;
  new_val[0] = bool_sig0;
  new_val[1] = bool_sig1;
  uint_sig = new_val;
}

 

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.

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