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

void simnet()
{
  /* ==============================================
     ROM contains 8 words, each word has 16 bits
     ============================================== */
  unsigned char RomContent[] = {
				 0xAA, 0xAA,    // Word 0
				 0xF0, 0xF0,    // Word 1
				 0x33, 0x33,    // Word 2
				 0xCC, 0xCC,    // Word 3
				 0x0F, 0x0F,    // Word 4
				 0xFF, 0xFF,    // Word 5
				 0x00, 0x01,    // Word 6
				 0x80, 0x00};   // Word 7

  Sig(addr,3);           // Address signals
  Sig(out,16);            // Output signals

  Switch( "fa", addr[2], '2', Zero );   
  Switch( "fb", addr[1], '1', Zero );   
  Switch( "fc", addr[0], '0', Zero );   

  /* ============================================================
     Rom with 3 address bits and 8 data bits

     Requirement:
          1. # words = 2^(size of addr)
          2. # bits  = size of out
     ============================================================ */
  Rom ( "bb-db", addr, out, 8 /* # words */, 16 /* # bits in a word */,
	 RomContent );
                                   // Rom

  ProbeH( "aa-ad", out);           // Probe output
}
