/* --------
   MACROS
   -------- */
/* Definition of the 4-bit-adder
*/
Define Four_Bit_Adder a[3..0] b[3..0] | Co t[3..0];
 Full_Adder H1 a[3] b[3] Cc | Co t[3];
 Full_Adder H2 a[2] b[2] Cb | Cc t[2];
 Full_Adder H3 a[1] b[1] Ca | Cb t[1];
 Full_Adder H4 a[0] b[0] ZERO | Ca t[0];
Endef;

/* Full adder.
   Syntax: Full_Adder a b c-in | c-out s;
   Effect: Adds binary numbers a + b with carry.
*/
Define Full_Adder a b CarryIn | CarryOut Sum;
  Xor aa a b x;
  Xor ab x CarryIn Sum;
  And bb a b y;
  And cb CarryIn x z;
  Or bc-cc y z CarryOut;
Endef;
