my attempt to do the exercises in sicp.

Saturday, March 13, 2010

sicp exercise 3.29

; Exercise 3.29.  Another way to construct an or-gate is as a compound digital logic device, built from and-gates and inverters. Define a procedure or-gate that accomplishes this. What is the delay time of the or-gate in terms of and-gate-delay and inverter-delay?

;A+B = (A'.B')'

(define (or-gate a b out)
  (let ((x (make-wire))
        (y (make-wire))
        (z (make-wire)))
    (inverter a x)
    (inverter b y)
    (and-gate x y z)
    (inverter z out)))

;; The delay = 3*inverter-delay + and-gate-delay

No comments: