From 55afc58f73ffb41eff739daf57198d0b00184757 Mon Sep 17 00:00:00 2001 From: Zachary Snow Date: Mon, 20 Sep 2021 23:49:43 -0400 Subject: [PATCH] simplify interface parameter override logic --- src/Convert/Interface.hs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Convert/Interface.hs b/src/Convert/Interface.hs index b8c73b7..439b863 100644 --- a/src/Convert/Interface.hs +++ b/src/Convert/Interface.hs @@ -606,18 +606,15 @@ inlineInstance global ranges modportBindings items partName overrideParam :: Decl -> Decl overrideParam (Param Parameter t x e) = + Param Localparam t x $ case lookup x instanceParams of - Nothing -> Param Localparam t x e - Just (Right _) -> Param Localparam t x (Ident $ paramTmp ++ x) - Just (Left t') -> error $ inlineKind ++ " param " ++ x - ++ " expected expr, found type: " ++ show t' + Nothing -> e + Just _ -> Ident $ paramTmp ++ x overrideParam (ParamType Parameter x t) = + ParamType Localparam x $ case lookup x instanceParams of - Nothing -> ParamType Localparam x t - Just (Left _) -> - ParamType Localparam x $ Alias (paramTmp ++ x) [] - Just (Right e') -> error $ inlineKind ++ " param " ++ x - ++ " expected type, found expr: " ++ show e' + Nothing -> t + Just _ -> Alias (paramTmp ++ x) [] overrideParam other = other portBindingItem :: PortBinding -> ModuleItem