+-- | Translate a top level function declaration to a HsFunction. i.e., which
+-- interface will be provided by this function. This function essentially
+-- defines the "calling convention" for hardware models.
+mkHsFunction ::
+ Var.Var -- ^ The function defined
+ -> Type -- ^ The function type (including arguments!)
+ -> HsFunction -- ^ The resulting HsFunction
+
+mkHsFunction f ty =
+ HsFunction hsname hsargs hsres
+ where
+ (arg_tys, res_ty) = Type.splitFunTys ty
+ mkPort = \x -> Single Port
+ hsargs = map (mkHsValueMap mkPort) arg_tys
+ hsres = mkHsValueMap mkPort res_ty
+ hsname = getOccString f
+