Subsumption Code for Compiler Test


;; Inputs, outputs and constants.
(definput bump SENSOR_1)
(definput light SENSOR_2)

(defoutput left OUT_A)
(defoutput right OUT_A)

(defconst integral_constant 4)
(defconst proportional_constant 6)

;; Modules.
(defmodule foo 
  :inputs (in1 in2)
  :outputs (out1 out2)
  :states 
  ((nil (conditional-dispatch (> in1 in2) 
                              one 
                              two))
   (one (output out1 (+ in1 in2)) 
        two)
   (two (output out2 (* integral_constant (+ in1 in2)))
        nil))) 

(defmodule bar
  :inputs (in1 in2)
  :outputs (out1)
  :instance-vars (biz)
  :states 
  ((nil (conditional-dispatch (> in1 in2) 
                              one 
                              two))
   (one (setf biz (* 3 (+ in1 in2))) 
        two)
   (two (output out1 (+ biz in1)) 
        one)))

;; Wires.
(defwire (foo out1) (bar in1))
(defwire (foo out2) (bar in2))