module: ascii_store_clocked
description: 
parameters: int x
inputs: double in, bool clk
outputs:
timing_sensitivity: posedge clk
classes: Vector vec_buffer(); 
static_variables: FILE *fp, int cur_vec_length
init:
char filename[100];
sprintf(filename,"sig_%d.dat",x);
if ((fp = fopen(filename,"w")) == NULL)
   {
    printf("error in 'ascii_store': can't open file '%s'\n",filename);
    exit(1);
   }
vec_buffer.set_length(1000);
cur_vec_length = 0;
code:
int i;

vec_buffer.set_elem(cur_vec_length,in);
cur_vec_length++;

if (cur_vec_length == 1000)
   {
    for (i = 0; i < cur_vec_length; i++)
       fprintf(fp,"%14.12e\n",vec_buffer.get_elem(i));
    cur_vec_length = 0;
   }

end:
int i;
for (i = 0; i < cur_vec_length; i++)
   fprintf(fp,"%14.12e\n",vec_buffer.get_elem(i));
fclose(fp);
