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

void simnet()
{
  Sig(d,8);              // Input (data) signals for register
  Sig(o,8);              // Output signals of register
  Sig(enable,1);         // Enable signal
  Sig(wr,1);             // Write signal

  Switch( "aa", d[7], '7', Zero );   
  Switch( "ba", d[6], '6', One );   
  Switch( "ca", d[5], '5', Zero );   
  Switch( "da", d[4], '4', Zero );   
  Switch( "ea", d[3], '3', One );   
  Switch( "fa", d[2], '2', Zero );   
  Switch( "ga", d[1], '1', Zero );   
  Switch( "ha", d[0], '0', One );   

  Switch( "jb", enable, 'a', Zero );   
  Switch( "jc", wr, 'b', Zero );   

  /* ============================================================
     Register
        Write with wr = 1
        Write only happens when enable = 1
     ============================================================ */
  Register ( "ab-hb", enable, wr, 
             (d[7]-d[0]), 
             (o[7]-o[0])
           ); 

  Probe( "ad-hd", o);           // Probe output
}
