projects
/
matthijs
/
master-project
/
cλash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Let the Adders module export everything.
[matthijs/master-project/cλash.git]
/
Adders.hs
diff --git
a/Adders.hs
b/Adders.hs
index c49ba810ce1ae4768ac2bd7efd673d1c198a0a28..c39857898abaa856a1206107c861115a4b08bfa1 100644
(file)
--- a/
Adders.hs
+++ b/
Adders.hs
@@
-1,4
+1,4
@@
-module Adders
(main, no_carry_adder)
where
+module Adders where
import Bits
import Language.Haskell.Syntax
import Bits
import Language.Haskell.Syntax
@@
-15,6
+15,12
@@
show_add f = do print ("Sum: " ++ (displaysigs s)); print ("Carry: " ++ (displ
no_carry_adder :: (Bit, Bit) -> Bit
no_carry_adder (a, b) = a `hwxor` b
no_carry_adder :: (Bit, Bit) -> Bit
no_carry_adder (a, b) = a `hwxor` b
+-- Combinatoric half adder
+-- A -> B -> (S, C)
+half_adder :: (Bit, Bit) -> (Bit, Bit)
+half_adder (a, b) =
+ ( a `hwxor` b, a `hwand` b )
+
-- Combinatoric (one-bit) full adder
-- (A, B, C) -> (S, C)
full_adder :: (Bit, Bit, Bit) -> (Bit, Bit)
-- Combinatoric (one-bit) full adder
-- (A, B, C) -> (S, C)
full_adder :: (Bit, Bit, Bit) -> (Bit, Bit)