Next: five_bit_full_adder, Up: Some adders
The first block, one_bit_full_adder is a straightforward
implementation of the classic full-adder (see truth table).
;;; One-bit full-adder.
; a b c_in c_out sum
; 0 0 0 0 0
; 0 0 1 0 1
; 0 1 0 0 1
; 0 1 1 1 0
; 1 0 0 0 1
; 1 0 1 1 0
; 1 1 0 1 0
; 1 1 1 1 1
(blk one_bit_full_adder
(out c_out)
(out s)
(in a)
(in b)
(in c_in))
(a. s (^ a b c_in))
(a. c_out (| (& a c_in)
(& a b)
(& b c_in)))