
/* =====================================================================
 * Always include this header file when writing digital simulation !!!
 * ===================================================================== */
#include "Sim.h"

void simnet()
{
  Sig(c0,1); Sig(c1,1);                        // Control signals
  Sig(o0,1); Sig(o1,1); Sig(o2,1); Sig(o3,1);  // Output signals
  Sig(enable,1);

  Switch( "fa", c1, 'b', Zero );   
  Switch( "ga", c0, 'a', Zero );   
  Switch( "ia", enable, 'z', Zero );   

  /* ============================================================
          c1 c0            Output
         ----------------------------------------------------
           0  0             o0 = 1, all other outputs = 0
	   0  1             o1 = 1, all other outputs = 0
	   1  0             o2 = 1, all other outputs = 0
	   1  1             o3 = 1, all other outputs = 0
     ============================================================ */
  Decoder ( "ab-db", enable, (c1,c0), (o3,o2,o1,o0) );  // Decoder

  Probe ( "ac", o3 );              // Probe output
  Probe ( "bc", o2 );              // Probe output
  Probe ( "cc", o1 );              // Probe output
  Probe ( "dc", o0 );              // Probe output
}
