Jump to content

Trying to assign a sc_bv to a combined variable vector (x,y,z) of same width


Llama

Recommended Posts

Hi , I have some variable bit-length variables like, 

sc_uint<10> x;

sc_bit y;

sc_int<8> z;

and a bit vector sc_bv<19> a;

Note: Combined bit-length of x,y,z is equal to length of a.

I'm able to assign the combined vector to the bit_vector a like, a = (x,y,z);

However I'm unable to do the reverse assignment like, (x,y,z) = a;

Please provide suggestions to achieve the above.

 

Link to comment
Share on other sites

6 minutes ago, Llama said:

Hi , I have some variable bit-length variables like, 

sc_uint<10> x;

sc_bit y;

sc_int<8> z;

and a bit vector sc_bv<19> a;

Note: Combined bit-length of x,y,z is equal to length of a.

I'm able to assign the combined vector to the bit_vector a like, a = (x,y,z);

However I'm unable to do the reverse assignment like, (x,y,z) = a;

Please provide suggestions to achieve the above.

 

SystemC is C++. SystemC is neither Verilog nor VHDL. 

You could create a simple class with a constructor to take apart a vector. With some clever trickery you might even be able to coax a C++11 variadic template to do exactly what you want. 

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