/*
   Full Subtraction circuit

   Still working on the macro.....   xxxxx
*/

Define Full_Adder CarryIn a b | 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;


Define Full_Sub a b BorrowIn | BorrowOut Diff;
   Not        aa  b n_b;
   Nor        aa  BorrowIn  NorBorrowIn;
   Full_Adder aa  a n_b NorBorrowIn | nBorrowOut Diff;
   Not        aa  nBorrowOut BorrowOut;
Endef;


/* ------------------------- */
Switch aa Bin '0' ZERO;
Switch ca a   '1' ZERO;
Switch da b   '2' ZERO;
Full_Sub ab-ed Bin a b | Bout sum;
Probe ae Bout;
Probe de sum;
