// @(#) $Header: /home/abrown/public_html/first/first2003chs/software/simulator/RCS/pbtest1.c,v 2.2 2006/12/14 19:40:16 abrown Exp $

/***********************************************************************
  * Copyright (C) 2002, 2003  Allen Brown
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the
  *   Free Software Foundation, Inc.
  *   59 Temple Place, Suite 330
  *   Boston, MA  02111-1307  USA
  * 
  * To contact the author of this software:
  *   Allen Brown
  *   PO Box J
  *   Corvallis, OR
  * 
  *   http://brown.armoredpenguin.com/~abrown/contact.html
  ***********************************************************************/
#include "pb.h"
#include <stdio.h>
int main()
{
  // Test pb_math functions outside of the simulator.
  int errors=0;

  // Declarations
  struct pbnumber nwrd1={&nwrd1.value,0,16,0,"nwrd1"};
  struct pbnumber nwrd1b0={&nwrd1.value,0,8,0,"nwrd1b0"};	// nwrd1b0 VAR nwrd1.byte0
  struct pbnumber nwrd1b1={&nwrd1.value,0,8,8,"nwrd1b1"};	// nwrd1b1 VAR nwrd1.byte1
  struct pbnumber nwrd2={&nwrd2.value,0,16,0,"nwrd2"};
  struct pbnumber nwrd2b0={&nwrd2.value,0,8,0,"nwrd2b0"};	// nwrd2b0 VAR nwrd2.byte0
  struct pbnumber nwrd2b1={&nwrd2.value,0,8,8,"nwrd2b1"};	// nwrd2b1 VAR nwrd2.byte1
  struct pbnumber nwrd3={&nwrd3.value,0,16,0,"nwrd3"};
  struct pbnumber nwrd3b0={&nwrd3.value,0,8,0,"nwrd3b0"};	// nwrd3b0 VAR nwrd3.byte0
  struct pbnumber nwrd3b1={&nwrd3.value,0,8,8,"nwrd3b1"};	// nwrd3b1 VAR nwrd3.byte1
  struct pbnumber nwrd4={&nwrd4.value,0,16,0,"nwrd4"};
  struct pbnumber nwrd4b0={&nwrd4.value,0,8,0,"nwrd4b0"};	// nwrd4b0 VAR nwrd4.byte0
  struct pbnumber nwrd4b1={&nwrd4.value,0,8,8,"nwrd4b1"};	// nwrd4b1 VAR nwrd4.byte1
  struct pbnumber nwrd5={&nwrd5.value,0,16,0,"nwrd5"};
  struct pbnumber nwrd5b0={&nwrd5.value,0,8,0,"nwrd5b0"};	// nwrd5b0 VAR nwrd5.byte0
  struct pbnumber nwrd5b1={&nwrd5.value,0,8,8,"nwrd5b1"};	// nwrd5b1 VAR nwrd5.byte1
  struct pbnumber nwrd6={&nwrd6.value,0,16,0,"nwrd6"};
  struct pbnumber nwrd6b0={&nwrd6.value,0,8,0,"nwrd6b0"};	// nwrd6b0 VAR nwrd6.byte0
  struct pbnumber nwrd6b1={&nwrd6.value,0,8,8,"nwrd6b1"};	// nwrd6b1 VAR nwrd6.byte1
  struct pbnumber nwrd7={&nwrd7.value,0,16,0,"nwrd7"};
  struct pbnumber nwrd7b0={&nwrd7.value,0,8,0,"nwrd7b0"};	// nwrd7b0 VAR nwrd7.byte0
  struct pbnumber nwrd7b1={&nwrd7.value,0,8,8,"nwrd7b1"};	// nwrd7b1 VAR nwrd7.byte1
  struct pbnumber nwrd8={&nwrd8.value,0,16,0,"nwrd8"};
  struct pbnumber nwrd8b0={&nwrd8.value,0,8,0,"nwrd8b0"};	// nwrd8b0 VAR nwrd8.byte0
  struct pbnumber nwrd8b1={&nwrd8.value,0,8,8,"nwrd8b1"};	// nwrd8b1 VAR nwrd8.byte1
  struct pbnumber nwrd9={&nwrd9.value,0,16,0,"nwrd9"};
  struct pbnumber nwrd9b0={&nwrd9.value,0,8,0,"nwrd9b0"};	// nwrd9b0 VAR nwrd9.byte0
  struct pbnumber nwrd9b1={&nwrd9.value,0,8,8,"nwrd9b1"};	// nwrd9b1 VAR nwrd9.byte1
  struct pbnumber nwrd10={&nwrd10.value,0,16,0,"nwrd10"};
  struct pbnumber nwrd10b0={&nwrd10.value,0,8,0,"nwrd10b0"}; // nwrd10b0 VAR nwrd10.byte0
  struct pbnumber nwrd10b1={&nwrd10.value,0,8,8,"nwrd10b1"}; // nwrd10b1 VAR nwrd10.byte1

  struct pbnumber nwrd11={&nwrd11.value,0,16,0,"nwrd11"};
  struct pbnumber nwrd11b0={&nwrd11.value,0,8,0,"nwrd11b0"}; // nwrd11b0 VAR nwrd11.byte0
  struct pbnumber nwrd11b1={&nwrd11.value,0,8,8,"nwrd11b1"}; // nwrd11b1 VAR nwrd11.byte1
  struct pbnumber nwrd12={&nwrd12.value,0,16,0,"nwrd12"};
  struct pbnumber nwrd12b0={&nwrd12.value,0,8,0,"nwrd12b0"}; // nwrd12b0 VAR nwrd12.byte0
  struct pbnumber nwrd12b1={&nwrd12.value,0,8,8,"nwrd12b1"}; // nwrd12b1 VAR nwrd12.byte1
  struct pbnumber nwrd13={&nwrd13.value,0,16,0,"nwrd13"};
  struct pbnumber nwrd13b0={&nwrd13.value,0,8,0,"nwrd13b0"}; // nwrd13b0 VAR nwrd13.byte0
  struct pbnumber nwrd13b1={&nwrd13.value,0,8,8,"nwrd13b1"}; // nwrd13b1 VAR nwrd13.byte1
  struct pbnumber nwrd14={&nwrd14.value,0,16,0,"nwrd14"};
  struct pbnumber nwrd14b0={&nwrd14.value,0,8,0,"nwrd14b0"}; // nwrd14b0 VAR nwrd14.byte0
  struct pbnumber nwrd14b1={&nwrd14.value,0,8,8,"nwrd14b1"}; // nwrd14b1 VAR nwrd14.byte1
  struct pbnumber nwrd15={&nwrd15.value,0,16,0,"nwrd15"};
  struct pbnumber nwrd15b0={&nwrd15.value,0,8,0,"nwrd15b0"};	// nwrd15b0 VAR nwrd15.byte0
  struct pbnumber nwrd15b1={&nwrd15.value,0,8,8,"nwrd15b1"};	// nwrd15b1 VAR nwrd15.byte1
  struct pbnumber nwrd16={&nwrd16.value,0,16,0,"nwrd16"};
  struct pbnumber nwrd16b0={&nwrd16.value,0,8,0,"nwrd16b0"};	// nwrd16b0 VAR nwrd16.byte0
  struct pbnumber nwrd16b1={&nwrd16.value,0,8,8,"nwrd16b1"};	// nwrd16b1 VAR nwrd16.byte1
  struct pbnumber nwrd17={&nwrd17.value,0,16,0,"nwrd17"};
  struct pbnumber nwrd17b0={&nwrd17.value,0,8,0,"nwrd17b0"};	// nwrd17b0 VAR nwrd17.byte0
  struct pbnumber nwrd17b1={&nwrd17.value,0,8,8,"nwrd17b1"};	// nwrd17b1 VAR nwrd17.byte1
  struct pbnumber nwrd18={&nwrd18.value,0,16,0,"nwrd18"};
  struct pbnumber nwrd18b0={&nwrd18.value,0,8,0,"nwrd18b0"};	// nwrd18b0 VAR nwrd18.byte0
  struct pbnumber nwrd18b1={&nwrd18.value,0,8,8,"nwrd18b1"};	// nwrd18b1 VAR nwrd18.byte1
  struct pbnumber nwrd19={&nwrd19.value,0,16,0,"nwrd19"};
  struct pbnumber nwrd19b0={&nwrd19.value,0,8,0,"nwrd19b0"};	// nwrd19b0 VAR nwrd19.byte0
  struct pbnumber nwrd19b1={&nwrd19.value,0,8,8,"nwrd19b1"};	// nwrd19b1 VAR nwrd19.byte1
  struct pbnumber nwrd20={&nwrd20.value,0,16,0,"nwrd20"};
  struct pbnumber nwrd20b0={&nwrd20.value,0,8,0,"nwrd20b0"}; // nwrd20b0 VAR nwrd20.byte0
  struct pbnumber nwrd20b1={&nwrd20.value,0,8,8,"nwrd20b1"}; // nwrd20b1 VAR nwrd20.byte1

  // Action

  // pbhigh(), pbinput(), pblow(), pboutput()
  pbhigh(nwrd1);
  pbinput(nwrd1);
  pblow(nwrd1);
  pboutput(nwrd1);

  // pbserin()
  pbserin(nwrd1b0, nwrd2b0, nwrd3b0, nwrd4b0, nwrd5b0, nwrd6b0, nwrd7b0, nwrd8b0,
	  nwrd9b0, nwrd10b0,
	  nwrd1b1, nwrd2b1, nwrd3b1, nwrd4b1, nwrd5b1, nwrd6b1, nwrd7b1, nwrd8b1,
	  nwrd9b1, nwrd10b1,
	  nwrd11b0, nwrd12b0, nwrd13b0, nwrd14b0, nwrd15b0, nwrd16b0, nwrd17b0, nwrd18b0,
	  nwrd19b0, nwrd20b0,
	  nwrd11b1, nwrd12b1 //, nwrd13b1, nwrd14b1, nwrd15b1, nwrd16b1, nwrd17b1, nwrd18b1,
	  //	  nwrd19b1, nwrd20b1,
	  );

  // pbserout()
  pbserout(nwrd1b0, nwrd2b0, nwrd3b0, nwrd4b0, nwrd5b0, nwrd6b0, nwrd7b0, nwrd8b0,
	   nwrd9b0, nwrd10b0,
	   nwrd1b1, nwrd2b1, nwrd3b1, nwrd4b1, nwrd5b1, nwrd6b1, nwrd7b1, nwrd8b1,
	   nwrd9b1, nwrd10b1,
	   nwrd11b0, nwrd12b0 //, nwrd13b0, nwrd14b0, nwrd15b0, nwrd16b0, nwrd17b0, nwrd18b0,
	   //	   nwrd19b0, nwrd20b0,
	   //	   nwrd11b1, nwrd12b1, nwrd13b1, nwrd14b1, nwrd15b1, nwrd16b1, nwrd17b1, nwrd18b1,
	   //	   nwrd19b1, nwrd20b1
	   );

  // pbshiftout(), pbstop(), pbtoggle()
  pbshiftout(nwrd1b0, nwrd2b0, nwrd3b0, nwrd4b0, nwrd5b0);
  pbtoggle(nwrd1);
  pbstop();

  exit(errors);
} // main
