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:
70e7593
)
Add genCoreArgs wrapper to VHDL.Generate.
author
Matthijs Kooijman
<matthijs@stdin.nl>
Tue, 13 Apr 2010 12:38:23 +0000
(14:38 +0200)
committer
Matthijs Kooijman
<matthijs@stdin.nl>
Tue, 13 Apr 2010 12:38:23 +0000
(14:38 +0200)
cλash/CLasH/VHDL/Generate.hs
patch
|
blob
|
history
diff --git
a/cλash/CLasH/VHDL/Generate.hs
b/cλash/CLasH/VHDL/Generate.hs
index da5d2ea770a6632df98b05d183f0ab6c0cbdcffe..07cf0e89864022936af27fa5c9f0fd6cb6719ecc 100644
(file)
--- a/
cλash/CLasH/VHDL/Generate.hs
+++ b/
cλash/CLasH/VHDL/Generate.hs
@@
-342,13
+342,22
@@
genNoInsts wrap dst func args = do
genVarArgs ::
(dst -> func -> [Var.Var] -> res)
-> (dst -> func -> [Either CoreSyn.CoreExpr AST.Expr] -> res)
genVarArgs ::
(dst -> func -> [Var.Var] -> res)
-> (dst -> func -> [Either CoreSyn.CoreExpr AST.Expr] -> res)
-genVarArgs wrap dst func args = wrap dst func args'
+genVarArgs wrap = genCoreArgs $ \dst func args -> let
+ args' = map exprToVar args
+ in
+ wrap dst func args'
+
+-- | A function to wrap a builder-like function that expects its arguments to
+-- be core expressions.
+genCoreArgs ::
+ (dst -> func -> [CoreSyn.CoreExpr] -> res)
+ -> (dst -> func -> [Either CoreSyn.CoreExpr AST.Expr] -> res)
+genCoreArgs wrap dst func args = wrap dst func args'
where
where
- args' = map exprToVar args''
-- Check (rather crudely) that all arguments are CoreExprs
-- Check (rather crudely) that all arguments are CoreExprs
- args'
'
= case Either.partitionEithers args of
+ args' = case Either.partitionEithers args of
(exprargs, []) -> exprargs
(exprargs, []) -> exprargs
- (exprsargs, rest) -> error $ "\nGenerate.gen
VarArgs: expect vararg
s but found ast exprs:" ++ (show rest)
+ (exprsargs, rest) -> error $ "\nGenerate.gen
CoreArgs: expect core expression argument
s but found ast exprs:" ++ (show rest)
-- | A function to wrap a builder-like function that expects its arguments to
-- be Literals
-- | A function to wrap a builder-like function that expects its arguments to
-- be Literals