Jump to content
Sign in to follow this  
mohitnegi

dynamic variable size ???

Recommended Posts

Hello all,

 

i wish to have a variable whose size i can decide on the fly or dynamically ....

 

could anyone help me this using systemC ...

 

could anyone help me understand "sc_fxval " ??
 

Thanks

Mohit

Share this post


Link to post
Share on other sites

You can declare variables from the base classes of the templated SystemC types. These can be sized at run-time.

 

For instance, sc_lv<N> has a base class sc_lv_base, so you can write

 

sc_lv_base lv(size);

 

i.e. use a constructor argument to set the size.

 

regards

Alan

Share this post


Link to post
Share on other sites

hello Alan,

 

in sc_lv_base  we are setting the size in the constructor argument which cannot be changed later....

 

but i wish to set different(depends on the conditions) size at run time ...

 

Thanks

Mohit

Share this post


Link to post
Share on other sites

The constructor is called at runtime.

 

If you mean that you want to change the length of a vector during runtime, then you'll have to write your own code to do it. For instance to make a vector smaller, you could create a smaller vector, then copy the bits you want to keep across.

 

Of course you don't have to use SystemC data types, you could just use std::vector if it meets your requirements,

Alan

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...