/* First attempt to make our own component */

#include "Sim.h"


/* ------------------------------------------------
   New component

   input:  a, b, c, d
   output: z
   ------------------------------------------------ */
void NewComp( const Signal &a, const Signal &b, const Signal &c, 
              const Signal &d, const Signal &z)
{
   Sig(x,1);
   Sig(y,1);

   And( "bb", (a,b), x );
   And( "bb", (c,d), y );

   Or ( "bb", (x,y), z);
}


/* -----
   Set up circuit that uses "NewComp"
   ----- */
void simnet()
{
   Sig(in0,1);
   Sig(in1,1);
   Sig(in2,1);
   Sig(in3,1);
   Sig(out,1);

   /* The input bits to the mux */
   Switch ( "aa", in0, '0', Zero );
   Switch ( "ba", in1, '1', Zero );
   Switch ( "ca", in2, '2', Zero );
   Switch ( "da", in3, '3', Zero );
   
   NewComp( in0, in1, in2, in3, out );
   
   Probe ( "ce", out );
}



