let node ip_A x = x
let node ip_B x = x
let node relay x = x

(* Figure 2a.
   cf. figure 1a of M. Casu and L. Macchiarulo, 
   "A New Approach to Latency Insensitive Design," DAC 04 *)

let node figure_2a (init_A0, init_B0) = 
  (out_A, out_B) where
  rec out_A = ip_A in_A
  and out_B = ip_B in_B
  and in_A = merge 1(0) init_B0 (delay out_B)
  and in_B = merge 1(0) init_A0 (delay out_A)


(* Figure 2b.
   cf. figure 1b of M. Casu and L. Macchiarulo, 
   "A New Approach to Latency Insensitive Design," DAC 04 *)

let node figure_2b (init_A0, init_B0) =
  (out_A, out_B) where
  rec out_A = ip_A (buffer in_A)
  and out_B = ip_B (buffer in_B)
  and out_R = relay in_R
  and in_A = delay out_R
  and in_B = merge 1(0) init_A0 (delay out_A)
  and in_R = merge 1(0) init_B0 (delay out_B)