Quantcast
Channel: SystemC Language Forum RSS Feed
Viewing all articles
Browse latest Browse all 595

How to change the word length of "sc_fix" dynamically? Any examples?

$
0
0

Hello, 

please let me ask a trivial question.

 

How to change the integer bit length of "sc_fix" variable dynamically after its initialization?

As far as I know "sc_fix" variable can be configured dynamically, though "sc_fixed" is not.

 

Many thanks in advance.

 

 

int sc_main( int argv, char* argc[]) 

{

 

  sc_fix   var_1( 16, 4, SC_RND, SC_SAT);

  sc_fix   var_2( 16, 4, SC_RND, SC_SAT);

  sc_fix   var_3( 16, 4, SC_RND, SC_SAT);

 

  var_1 = 0.5;

  var_2 = 1.125;

  var_3 = 0.7;

 

  var_1 = var_2 + var_3;

 

   //  *** at this moment, I'd like to change var_1's integer bit length to 8. ***

  var_1 = sc_fix( 16, 8, SC_RND, SC_SAT);  // This does not work.

 

  // further processing,......

 

  return 0;


Viewing all articles
Browse latest Browse all 595

Trending Articles