From 88c401e856371ebf048f3b59da846c8ad818a48f Mon Sep 17 00:00:00 2001 From: Zachary Snow Date: Fri, 7 Feb 2020 19:10:21 -0500 Subject: [PATCH] additional interface conversion error messages --- src/Convert/Interface.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Convert/Interface.hs b/src/Convert/Interface.hs index 65c8c7b..1bc0c1c 100644 --- a/src/Convert/Interface.hs +++ b/src/Convert/Interface.hs @@ -80,7 +80,10 @@ convertDescription interfaces modules (Part attrs extern Module lifetime name po Nothing -> orig where InterfaceT interfaceName (Just _) [] = t - interfaceItems = snd $ interfaces Map.! interfaceName + interfaceItems = + case Map.lookup interfaceName interfaces of + Just res -> snd res + Nothing -> error $ "could not find interface " ++ show interfaceName mapper (dir, port, expr) = Variable dir mpt (ident ++ "_" ++ port) mprs Nothing where (mpt, mprs) = lookupType interfaceItems (fromJust expr) @@ -133,7 +136,11 @@ convertDescription interfaces modules (Part attrs extern Module lifetime name po expandPortBinding moduleName (portName, Just newExpr) where InterfaceT _ (Just modportName) [] = - modules Map.! (moduleName, portName) + case Map.lookup (moduleName, portName) modules of + Just t -> t + Nothing -> error $ "could not find port " + ++ show portName ++ " in module " + ++ show moduleName newExpr = Dot (Ident ident) modportName (_, Just decls) -> -- modport directly bound to a modport