```let node xor (a, b) = o where
rec o = (a && (not b)) || (b && (not a))

(************************* cyclic_encoding *******************************)

(* Circuit of the divison by X^3 + X + 1.
(cf. Wesley Peterson. Error-Correcting Codes. The M.I.T. Press, 1961.)

-----------------------------------
|                       |           |
v     --          --    v     --    |
--->+--->|  |------->|  |---+--->|  |---/
--          --          --
*)
let node div_X3_X_1 i = (reg0,reg1,reg2) where
rec reg0 = false fby (xor(i, back))
and reg1 = false fby (xor(reg0, back))
and reg2 = false fby reg1
and back = reg2

(* Circuit of the divison by X^3 + X + 1 with a rest every 50 bits *)
let node div_X3_X_1 i = (reg0,reg1,reg2) where
rec reg0 = false fby merge (1^50 0) (xor(i, back)) false
and reg1 = false fby merge (1^50 0) (xor(reg0 when (1^50 0), back)) false
and reg2 = false fby merge (1^50 0) (reg1 when (1^50 0)) false
and back = reg2 when (1^50 0)

(* reminder of the division by X^3 + X + 1 *)
let node redundancy i = (bit0,bit1,bit2) where
rec (reg0,reg1,reg2) = div_X3_X_1 i
and bit0 = reg0  when (0^50 1)
and bit1 = reg1  when (0^50 1)
and bit2 = reg2  when (0^50 1)

(* cyclic encoder: x^3 + x + 1 *)
let node cyclic_encoding i = o3 where
rec (bit0, bit1, bit2) = redundancy i
and o1 = merge (1^50 0) i  (buffer bit0)
and o2 = merge (1^51 0) o1 (buffer bit1)
and o3 = merge (1^52 0) o2 (buffer bit2)

```