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
Add infrastructure for running core to core transformations.
[matthijs/master-project/cλash.git]
/
Adders.hs
diff --git
a/Adders.hs
b/Adders.hs
index 249bb3a4ef983a84f7f3074f131934688b2974b3..2ee1de69534f144ab6f41d627fdfc7ce950e4f05 100644
(file)
--- a/
Adders.hs
+++ b/
Adders.hs
@@
-146,6
+146,25
@@
rec_adder ((a:as), (b:bs)) =
(rest, cin) = rec_adder (as, bs)
(s, cout) = full_adder (a, b, cin)
(rest, cin) = rec_adder (as, bs)
(s, cout) = full_adder (a, b, cin)
+foo = id
+add, sub :: Int -> Int -> Int
+add a b = a + b
+sub a b = a - b
+
+highordtest = \x ->
+ let s = foo x
+ in
+ case s of
+ (a, b) ->
+ case a of
+ High -> add
+ Low -> let
+ op' = case b of
+ High -> sub
+ Low -> \c d -> c
+ in
+ \c d -> op' d c
+
-- Four bit adder, using the continous adder below
-- [a] -> [b] -> ([s], cout)
--con_adder_4 as bs =
-- Four bit adder, using the continous adder below
-- [a] -> [b] -> ([s], cout)
--con_adder_4 as bs =