module: accum_and_dump
parameters: 
inputs: double in, double_interp clk
outputs: double out
classes: EdgeDetect clkedge()
static_variables: double count, double accum_val
init: 
accum_val = 0.0;
count=0.0;
code:
double interpolate_val;

if (clkedge.inp(clk))
   {
    interpolate_val = (1.0 - clk)/2.0;
    count += interpolate_val;
    accum_val += interpolate_val*in;
    out = accum_val/count;
    count = (1.0 - interpolate_val);
    accum_val = (1.0 - interpolate_val)*in;
   }
else
   {
    count += 1.0;
    accum_val += in;
   }
