projects
/
matthijs
/
master-project
/
cλash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1c8b70b
)
Implement full_adder in terms of half_adder.
author
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Fri, 30 Jan 2009 08:55:44 +0000
(09:55 +0100)
committer
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Fri, 30 Jan 2009 08:55:44 +0000
(09:55 +0100)
Adders.hs
patch
|
blob
|
history
diff --git
a/Adders.hs
b/Adders.hs
index 71d38dc4197293febaaca3917998fc8cf94841e2..f35021c96fec00580168dc54c2ef4a2f7fe715a9 100644
(file)
--- 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