SICP Exercise 3.29 or-gate in terms of and-gates and inverters

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?

SOLUTION

The code is here.

Note: I made an enhancement to all the function procedures such as and-gate, or-gate etc. to call the action procedure once as soon as the gate is constructed. This way we ensure that the output of the gate is correct right from the beginning.

(OR A B) = (NOT (AND (NOT A) (NOT B)))

Delay time of the compound-or-gate = (3 * inverter-delay) + (and-gate-delay)

Comments

Popular posts from this blog

SICP Exercise 2.56 differentiation rule

SICP Exercise 1.28 (Miller-Rabin Test)

SICP Exercise 4.18 a alternative strategy for interpreting internal definitions