X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=c%CE%BBash%2FCLasH%2FVHDL%2FGenerate.hs;h=07cf0e89864022936af27fa5c9f0fd6cb6719ecc;hb=07a6394442d0d83a754af8f0d90f3702bb1821c6;hp=da5d2ea770a6632df98b05d183f0ab6c0cbdcffe;hpb=ab02b890f1921992e1b6b9e19bcaeb57cdd97b78;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git "a/c\316\273ash/CLasH/VHDL/Generate.hs" "b/c\316\273ash/CLasH/VHDL/Generate.hs" index da5d2ea..07cf0e8 100644 --- "a/c\316\273ash/CLasH/VHDL/Generate.hs" +++ "b/c\316\273ash/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 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 - args' = map exprToVar args'' -- Check (rather crudely) that all arguments are CoreExprs - args'' = case Either.partitionEithers args of + args' = case Either.partitionEithers args of (exprargs, []) -> exprargs - (exprsargs, rest) -> error $ "\nGenerate.genVarArgs: expect varargs but found ast exprs:" ++ (show rest) + (exprsargs, rest) -> error $ "\nGenerate.genCoreArgs: expect core expression arguments but found ast exprs:" ++ (show rest) -- | A function to wrap a builder-like function that expects its arguments to -- be Literals