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:
55dbd3d
)
Make full_adder simpler.
author
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Thu, 29 Jan 2009 16:43:10 +0000
(17:43 +0100)
committer
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Thu, 29 Jan 2009 16:43:10 +0000
(17:43 +0100)
Adders.hs
patch
|
blob
|
history
diff --git
a/Adders.hs
b/Adders.hs
index 03f04101ff9c72612bea6e4ab5030bc8b9fc2eda..71d38dc4197293febaaca3917998fc8cf94841e2 100644
(file)
--- a/
Adders.hs
+++ b/
Adders.hs
@@
-42,8
+42,9
@@
half_adder (a, b) =
full_adder :: (Bit, Bit, Bit) -> (Bit, Bit)
full_adder (a, b, cin) = (s, c)
where
- s = a `hwxor` b `hwxor` cin
- c = a `hwand` b `hwor` (cin `hwand` (a `hwxor` b))
+ x = a `hwxor` b
+ s = x `hwxor` cin
+ c = a `hwand` b `hwor` (cin `hwand` x)
-- Four bit adder
-- Explicit version