mohitnegi Posted August 1, 2013 Report Share Posted August 1, 2013 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 Quote Link to comment Share on other sites More sharing options...
apfitch Posted August 1, 2013 Report Share Posted August 1, 2013 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 Quote Link to comment Share on other sites More sharing options...
mohitnegi Posted August 2, 2013 Author Report Share Posted August 2, 2013 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 Quote Link to comment Share on other sites More sharing options...
apfitch Posted August 2, 2013 Report Share Posted August 2, 2013 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 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.