- FApp UnnamedSignal -- | The application to look at.
- -> AST.CompInsSm -- | The corresponding VHDL component instantiation.
-
-mkCompInsSm app =
- AST.CompInsSm label (AST.IUEntity (AST.NSimple entity_id)) (AST.PMapAspect portmaps)
+ FApp UnnamedSignal -- | The application to look at.
+ -> VHDLState AST.CompInsSm -- | The corresponding VHDL component instantiation.
+
+mkCompInsSm app = do
+ let hsfunc = appFunc app
+ fdata_maybe <- getFunc hsfunc
+ let fdata = Maybe.fromMaybe
+ (error $ "Using function '" ++ (prettyShow hsfunc) ++ "' that is not in the session? This should not happen!")
+ fdata_maybe
+ let entity = Maybe.fromMaybe
+ (error $ "Using function '" ++ (prettyShow hsfunc) ++ "' without entity declaration? This should not happen!")
+ (funcEntity fdata)
+ let entity_id = ent_id entity
+ label <- uniqueName (AST.fromVHDLId entity_id)
+ return $ AST.CompInsSm (mkVHDLId label) (AST.IUEntity (AST.NSimple entity_id)) (AST.PMapAspect portmaps)