- let
- sigs = map (varToVHDLExpr.varBndr) valargs
- func = builder sigs
- src_wform = AST.Wform [AST.WformElem func Nothing]
- dst_name = AST.NSimple (mkVHDLExtId (bndrToString bndr))
- assign = dst_name AST.:<==: (AST.ConWforms [] src_wform Nothing)
- in
- return [AST.CSSASm assign]
+ case builder of
+ Left funBuilder ->
+ let
+ sigs = map (varToVHDLExpr.varBndr) valargs
+ func = funBuilder sigs
+ src_wform = AST.Wform [AST.WformElem func Nothing]
+ dst_name = AST.NSimple (mkVHDLExtId (bndrToString bndr))
+ assign = dst_name AST.:<==: (AST.ConWforms [] src_wform Nothing)
+ in
+ return [AST.CSSASm assign]
+ Right genBuilder ->
+ let
+ sigs = map varBndr valargs
+ signature = Maybe.fromMaybe
+ (error $ "Using function '" ++ (bndrToString (head sigs)) ++ "' without signature? This should not happen!")
+ (Map.lookup (head sigs) signatures)
+ arg_names = map (mkVHDLExtId . bndrToString) (tail sigs)
+ dst_name = mkVHDLExtId (bndrToString bndr)
+ genSm = genBuilder 4 signature (arg_names ++ [dst_name])
+ in return [AST.CSGSm genSm]