module: double_to_bus24
description: 
parameters:  
inputs:  double in
outputs:  bool out[23:0]
classes:  
static_variables: double scale_factor  
init:  
scale_factor = pow(2.0,16.0);
end:  
code:  
int in_int,i,bit_val;

in_int = (int) floor(in*scale_factor);

for(i = 0; i < 24; i++)
  {
   bit_val = ((in_int & (1<<i)) == 0) ? 0 : 1;
   if (i == 4)
      out.set_elem(i,1);
   else     
      out.set_elem(i,bit_val);
  }