X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=VHDL.hs;h=920b83ed6be5de1f96c84f7d7fdf26ac8feeec20;hb=0c113a538aa9a891935665481782bdce8350e345;hp=76cb62f827d87c24faa2e48df4af4f7527566499;hpb=8c52b6cf13be6b0080ce3353bebfd04b18336036;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/VHDL.hs b/VHDL.hs index 76cb62f..920b83e 100644 --- a/VHDL.hs +++ b/VHDL.hs @@ -12,6 +12,7 @@ import qualified Control.Arrow as Arrow import qualified Control.Monad.Trans.State as State import qualified Data.Monoid as Monoid import Data.Accessor +import Debug.Trace -- ForSyDe import qualified ForSyDe.Backend.VHDL.AST as AST @@ -298,22 +299,7 @@ mkConcSm (bndr, app@(CoreSyn.App _ _))= do case (Map.lookup (varToString f) globalNameTable) of Just (arg_count, builder) -> if length valargs == arg_count then - case builder of - Left funBuilder -> do - let sigs = map (varToVHDLExpr.exprToVar) valargs - func <- funBuilder bndr sigs - let src_wform = AST.Wform [AST.WformElem func Nothing] - let dst_name = AST.NSimple (mkVHDLExtId (varToString bndr)) - let assign = dst_name AST.:<==: (AST.ConWforms [] src_wform Nothing) - return [AST.CSSASm assign] - Right genBuilder -> do - let sigs = map exprToVar valargs - let signature = Maybe.fromMaybe - (error $ "Using function '" ++ (varToString (head sigs)) ++ "' without signature? This should not happen!") - (Map.lookup (head sigs) signatures) - let arg = tail sigs - genSm <- genBuilder signature (arg ++ [bndr]) - return [AST.CSGSm genSm] + builder bndr f valargs else error $ "VHDL.mkConcSm Incorrect number of arguments to builtin function: " ++ pprString f ++ " Args: " ++ pprString valargs Nothing -> error $ "Using function from another module that is not a known builtin: " ++ pprString f