X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=Adders.hs;h=f35021c96fec00580168dc54c2ef4a2f7fe715a9;hb=ed6bb401ef9c3726084f9477e01228466d34e29c;hp=71d38dc4197293febaaca3917998fc8cf94841e2;hpb=1c8b70b006a44dfd4931ab726a0859b79029544d;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/Adders.hs b/Adders.hs index 71d38dc..f35021c 100644 --- a/Adders.hs +++ b/Adders.hs @@ -42,9 +42,9 @@ half_adder (a, b) = full_adder :: (Bit, Bit, Bit) -> (Bit, Bit) full_adder (a, b, cin) = (s, c) where - x = a `hwxor` b - s = x `hwxor` cin - c = a `hwand` b `hwor` (cin `hwand` x) + (s1, c1) = half_adder(a, b) + (s, c2) = half_adder(s1, cin) + c = c1 `hwor` c2 -- Four bit adder -- Explicit version