module: reg_double_retime
description: 
parameters:  
inputs:  double in, double_interp clk
outputs:  double out
classes:  EdgeDetect rising_edge()
static_variables:  double del_out, double prev_out, int edge_flag
init:  
prev_out = 0.0;
del_out = 0.0;
out = 0.0;
edge_flag = 0;

code:  

out = del_out;

if (rising_edge.inp(clk))
   {
    edge_flag = 1;
    del_out = (prev_out*(-clk + 1.0) + in*(clk + 1.0))/2.0;
    prev_out = in;
   }
else if (edge_flag == 1)
   {
    edge_flag = 0;
    del_out = prev_out;
   }
