(FILECREATED " 3-Feb-87 15:03:45" {ERIS}<TAMARIN>TSIM>MAKETESTVECTORS.;26 12540  

      changes to:  (FNS MakeStatements EvalEltSimList SetWireStateList MakeWireStateList 
			FindNodeValue SetVectorEntry)
		   (VARS MAKETESTVECTORSCOMS)

      previous date: "23-Dec-86 09:43:10" {ERIS}<TAMARIN>TSIM>MAKETESTVECTORS.;15)


(* Copyright (c) 1986, 1987 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT MAKETESTVECTORSCOMS)

(RPAQQ MAKETESTVECTORSCOMS ((FNS EvalEltSimList MakeWireStateList SetWireStateList AddWireState 
				   SetVectorEntry FindNodeValue)
			      (* * Fns to Create Cedar Rosmarry Code)
			      (FNS MakeStatements)
			      (* * obsolete fns)
			      (FNS SetWireState AddStatement AddValue)))
(DEFINEQ

(EvalEltSimList
  [LAMBDA (elt exprtype)                                     (* edited: "20-Jan-87 16:23")
    (if (LISTP elt)
	then [SELECTQ (CAR elt)
			  [OR (LOGOR (EvalEltSimList (CADR elt))
					 (EvalEltSimList (CDDR elt)
							   (QUOTE OR]
			  [AND (LOGAND (EvalEltSimList (CADR elt))
					   (EvalEltSimList (CDDR elt)
							     (QUOTE AND]
			  [NOT (LNOT (EvalEltSimList (CADR elt]
			  (if (LISTP (CDR elt))
			      then (SELECTQ exprtype
						(OR (LOGOR (EvalEltSimList (CAR elt))
							       (EvalEltSimList (CDR elt)
										 exprtype)))
						(AND (LOGAND (EvalEltSimList (CAR elt))
								 (EvalEltSimList (CDR elt)
										   exprtype)))
						(HELP))
			    else (EvalEltSimList (CAR elt]
      else (EvalEltSim elt])

(MakeWireStateList
  [LAMBDA NIL                                                (* edited: "20-Jan-87 14:18")

          (* * Wire List of form: (name (x check set)))



          (* * Name can be: (name start# end#))



          (* SETQ WireDefinitions (QUOTE (XPRE XCLOCK XCLOCKD10 XCLOCKD35 XHOLD XINTERRUPT XREFRESH XRESET 
	  (XHOLDA (RESET (NOT RPADENB~))) (XOUTPUTINTERRUPT (RESET (NOT RPADENB~))) (XWE~ (RESET (NOT RPADENB~))) 
	  (XCAS~ (RESET (NOT RPADENB~))) ((LPN.PADRNG156.XRAS~ 0 3) (RESET (NOT RPADENB~))) ((RD 8 39) 
	  (RESET (NOT DPADENB~) DPADENB~)) ((XRADDR 0 9) ((OR RESET (AND LPN.PADRNG156.XRAS~-0 LPN.PADRNG156.XRAS~-1 
	  LPN.PADRNG156.XRAS~-2 LPN.PADRNG156.XRAS~-3)) (NOT RPADENB~))))))



          (* * Make List of Signal Names)



          (* LET ((NewWires (LIST (QUOTE STATELIST)))) (for i in WireDefinitions do (if (LISTP i) then 
	  (AddWireState (CAR i)) else (AddWireState i))) (SETQ WireStateList (LIST (CDR NewWires))))



          (* * New wire setup)


    (SETQ WireStateList (LIST (QUOTE Start)))
    (SETQ vectorcount 11)
    (SETQ vectorentry (ARRAY (ADD1 vectorcount)
				 (QUOTE POINTER)
				 (QUOTE x)
				 0))
    (for i in (QUOTE (V-Hold V-Interrupt V-Refresh V-Reset V-HoldA V-OutputInterrupt V-WE~ 
				   V-CAS~ V-RAS~ V-DataBus V-RasAddr V-CasAddr))
       as j from 0 do (SET i j])

(SetWireStateList
  [LAMBDA NIL                                                (* edited: "20-Jan-87 17:41")
    (COND
      [[TF (LAND *Clock (LNOT (LOR pPre pClock]

          (* * Clocks 0 0 0 0)


	[if (GREATERP Cycles 0)
	    then (LET (NewWires)
		        (for i from 0 to vectorcount do (AddWireState (ELT vectorentry i))
			       )
		        (SETQ WireStateList (NCONC WireStateList (LIST NewWires]
	(for i from 0 to vectorcount do (SETA vectorentry i (QUOTE x]
      [(TF pPre)

          (* * Clocks 1 0 0 0)


	(if [TF (EvalEltSimList (QUOTE (AND WE~ DPADENB~ (NOT XRESET)
						      (NOT (AND LPN.PADRNG156.XRAS~-0 
								    LPN.PADRNG156.XRAS~-1 
								    LPN.PADRNG156.XRAS~-2 
								    LPN.PADRNG156.XRAS~-3]
	    then 

          (* * Set: DataBus In)


		   (SetVectorEntry V-DataBus (QUOTE RD)
				     (QUOTE set)))

          (* * Check: CAS~)


	(SetVectorEntry V-CAS~ (QUOTE XCAS~)
			  (QUOTE (XRESET (NOT RPADENB~]
      ([TF (LAND *Pre (LNOT (LOR pPre pClock]

          (* * Clocks 0 0 0 0)



          (* * Set ctl in: Interrupt, Reset, Refresh, Hold)


	(SetVectorEntry V-Interrupt (QUOTE XINTERRUPT)
			  (QUOTE set))
	(SetVectorEntry V-Hold (QUOTE XHOLD)
			  (QUOTE set))
	(SetVectorEntry V-Refresh (QUOTE XREFRESH)
			  (QUOTE set))
	(SetVectorEntry V-Reset (QUOTE XRESET)
			  (QUOTE set)))
      [[TF (LAND pClock (LNOT (LOR ClkD10 ClkD35]

          (* * Clocks 0 1 0 0)



          (* * Check: WE~ RAS~ HOLDA OUTPUTINTERRUPT CAS~ RAS-Addr DataBus-Out)


	[SetVectorEntry V-WE~ (QUOTE WE~)
			  (QUOTE (XRESET (NOT RPADENB~]
	[SetVectorEntry V-OutputInterrupt (QUOTE XOUTPUTINTERRUPT)
			  (QUOTE (XRESET (NOT RPADENB~]
	[SetVectorEntry V-HoldA (QUOTE XHOLDA)
			  (QUOTE (XRESET (NOT RPADENB~]
	[SetVectorEntry V-RAS~ (QUOTE (LPN.PADRNG156.XRAS~ 0 3))
			  (QUOTE (XRESET (NOT RPADENB~]
	[SetVectorEntry V-RasAddr (QUOTE (XRADDR 0 9))
			  (QUOTE ((OR XRESET (AND LPN.PADRNG156.XRAS~-0 LPN.PADRNG156.XRAS~-1 
							LPN.PADRNG156.XRAS~-2 LPN.PADRNG156.XRAS~-3))
				     (NOT RPADENB~]
	(if [TF (EvalEltSimList (QUOTE (AND (NOT XRESET)
						      (NOT DPADENB~)
						      (NOT WE~)
						      (NOT (AND LPN.PADRNG156.XRAS~-0 
								    LPN.PADRNG156.XRAS~-1 
								    LPN.PADRNG156.XRAS~-2 
								    LPN.PADRNG156.XRAS~-3]
	    then (SetVectorEntry V-DataBus (QUOTE RD)
				     (QUOTE check]
      [[TF (LAND pClock (LAND ClkD10 (LNOT ClkD35]

          (* * Clocks 0 1 1 0)


	(SetVectorEntry V-CasAddr (QUOTE (XRADDR 0 9))
			  (QUOTE ((OR XRESET (AND LPN.PADRNG156.XRAS~-0 LPN.PADRNG156.XRAS~-1 
							LPN.PADRNG156.XRAS~-2 LPN.PADRNG156.XRAS~-3))
				     (NOT RPADENB~]
      ((TF (LAND pClock (LAND ClkD10 ClkD35)))

          (* * Clocks 0 1 1 1)


	NIL])

(AddWireState
  [LAMBDA (nameorstate)                                      (* rtk "19-Dec-86 13:56")
                                                             (* PRINTOUT T "Wire: " name " = " state T)
    (SETQ NewWires (NCONC NewWires (CONS nameorstate NIL])

(SetVectorEntry
  [LAMBDA (index nodename choicelist)                        (* edited: "16-Jan-87 14:15")
    (LET (found vallist (nodevalue (FindNodeValue nodename)))
         (if (LISTP choicelist)
	     then (SETQ vallist (QUOTE x))
		    (for i in choicelist as j in (QUOTE (x check set)) until found
		       do (SETQ found (TF (EvalEltSimList i)))
			    (SETQ vallist j))
	   else (SETQ vallist choicelist))
         (SETA vectorentry index (SELECTQ vallist
					      (x (QUOTE x))
					      (check nodevalue)
					      (set (PACK (LIST (QUOTE S)
								   nodevalue)))
					      (HELP])

(FindNodeValue
  [LAMBDA (nodename)                                         (* edited: "16-Jan-87 14:15")
    (if (LISTP nodename)
	then (LET ((nodevalue 0))
		    [for k from (CADR nodename) to (CADDR nodename)
		       do (SETQ nodevalue (LOGOR nodevalue
						       (LSH (EvalEltSim
								(PACK (LIST (CAR nodename)
										(QUOTE -)
										k)))
							      (DIFFERENCE k (CADR nodename]
		nodevalue)
      else (EvalEltSim nodename])
)
(* * Fns to Create Cedar Rosmarry Code)

(DEFINEQ

(MakeStatements
  [LAMBDA (filename)                                         (* edited: " 3-Feb-87 07:19")

          (* * LET (names oldvalues proglist hadchange (stream (if filename then (OPENSTREAM filename 
	  (QUOTE OUTPUT)) else T))) (SETQ names (CAR WireStateList)) (SETQ oldvalues (CAR WireStateList)) 
	  (for newvalues in (CDR WireStateList) do (SETQ hadchange NIL) (for name in names as newval in newvalues as oldval 
	  in oldvalues when (NEQ newval oldval) do (if (LISTP name) then (AddValue (CAR name) newval oldval) else 
	  (AddValue name newval oldval))) (IF hadchange then (PRINTOUT stream "Eval[];" T)) (SETQ oldvalues newvalues)) 
	  (if filename then (CLOSEF stream)))



          (* * new output)


    (LET [(firsttime T)
	  (stream (if filename
		      then (OPENSTREAM filename (QUOTE OUTPUT))
		    else (OPENSTREAM (QUOTE {Eris}<Tamarin>TSim>Vectors.txt)
					 (QUOTE OUTPUT]
         [for newvalues in (CDR WireStateList) do (if (NEQ (CAR newvalues)
								       (QUOTE x))
							      then (PRINTOUT stream newvalues T)
								     (if firsttime
									 then (PRINTOUT stream 
											newvalues T)
										(SETQ firsttime NIL]
         (PRINTOUT stream (QUOTE END)
		   T)
         (PRINTOUT stream (QUOTE END)
		   T)
         (CLOSEF stream])
)
(* * obsolete fns)

(DEFINEQ

(SetWireState
  [LAMBDA (descriptorlist)                                   (* rtk "22-Dec-86 17:50")
    (if (OR (TF (LOR pPre pClock))
		(EQ descriptorlist (QUOTE XPRE))
		(EQ descriptorlist (QUOTE XCLOCK)))
	then (if (LISTP descriptorlist)
		   then [if (LISTP (CAR descriptorlist))
			      then [LET (found (nodevalue 0)
						 (vallist (QUOTE x))
						 (choicelist (CADR descriptorlist)))
				          [for k from (CADAR descriptorlist)
					     to (CADDAR descriptorlist)
					     do (SETQ nodevalue
						    (LOGOR
						      nodevalue
						      (LSH (EvalEltSim
							       (PACK (LIST (CAAR descriptorlist)
									       (QUOTE -)
									       k)))
							     (DIFFERENCE k (CADAR descriptorlist]
				          (for i in choicelist as j
					     in (QUOTE (x check set)) until found
					     do (SETQ found (TF (EvalEltSimList i)))
						  (SETQ vallist j))
				          (AddWireState (SELECTQ
							    vallist
							    (x (QUOTE x))
							    (check nodevalue)
							    (set (PACK (LIST (QUOTE S)
										 nodevalue)))
							    (HELP]
			    else (LET [found (vallist (QUOTE (x x)))
					       (choicelist (CADR descriptorlist))
					       (nodevalue (EvalEltSim (CAR descriptorlist]
				        (for i in choicelist as j in (QUOTE ((x x)
											(0 1)
											(S0 S1)))
					   until found
					   do (SETQ found (TF (EvalEltSimList i)))
						(SETQ vallist j))
				        (AddWireState (if (TF nodevalue)
							    then (CADR vallist)
							  else (CAR vallist]
		 else (AddWireState (if (EQ 0 (EvalEltSim descriptorlist))
					    then (QUOTE S0)
					  else (QUOTE S1])

(AddStatement
  [LAMBDA (name field value)                                 (* rtk "23-Dec-86 09:42")
    (SETQ hadchange T)
    (PRINTOUT stream (QUOTE p)
	      (QUOTE %[)
	      name
	      (QUOTE %])
	      (QUOTE %.)
	      field
	      (QUOTE ←)
	      value
	      (QUOTE ;)
	      T])

(AddValue
  [LAMBDA (name newval oldval)                               (* rtk "22-Dec-86 17:58")
    (COND
      ((EQ newval (QUOTE x))
	(AddStatement name (QUOTE d)
			(QUOTE none)))
      ((NUMBERP newval)
	(if (NOT (NUMBERP oldval))
	    then (AddStatement name (QUOTE d)
				   (QUOTE expect)))
	(AddStatement name (QUOTE c)
			newval))
      ((EQ 1 (STRPOS (QUOTE S)
			 newval))
	(if (NEQ 1 (STRPOS (QUOTE S)
				 oldval))
	    then (AddStatement name (QUOTE d)
				   (QUOTE force)))
	(AddStatement name (QUOTE c)
			(SUBATOM newval 2)))
      (T (BREAK1 NIL T (Illegal Pin Value)
		   NIL])
)
(PUTPROPS MAKETESTVECTORS COPYRIGHT ("Xerox Corporation" 1986 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (738 7910 (EvalEltSimList 748 . 1698) (MakeWireStateList 1700 . 3154) (SetWireStateList 
3156 . 6365) (AddWireState 6367 . 6654) (SetVectorEntry 6656 . 7368) (FindNodeValue 7370 . 7908)) (
7957 9382 (MakeStatements 7967 . 9380)) (9408 12449 (SetWireState 9418 . 11386) (AddStatement 11388 . 
11715) (AddValue 11717 . 12447)))))
STOP