From 5f26e755c984a2b3b1c76c0c7fc6687f70290600 Mon Sep 17 00:00:00 2001 From: Zachary Snow Date: Sat, 10 Apr 2021 20:45:40 -0400 Subject: [PATCH] preserve implicitness of task and function ports --- src/Language/SystemVerilog/Parser/Parse.y | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Language/SystemVerilog/Parser/Parse.y b/src/Language/SystemVerilog/Parser/Parse.y index c0be9ea..a95a509 100644 --- a/src/Language/SystemVerilog/Parser/Parse.y +++ b/src/Language/SystemVerilog/Parser/Parse.y @@ -848,9 +848,9 @@ PackageItem :: { [PackageItem] } NonDeclPackageItem :: { [PackageItem] } : "typedef" Type Identifier ";" { [Decl $ ParamType Localparam $3 $2] } | "typedef" Type Identifier DimensionsNonEmpty ";" { [Decl $ ParamType Localparam $3 (UnpackedType $2 $4)] } - | "function" Lifetime FuncRetAndName TFItems DeclsAndStmts endfunction opt(Tag) { [Function $2 (fst $3) (snd $3) (map defaultFuncInput $ (map makeInput $4) ++ fst $5) (snd $5)] } - | "function" Lifetime "void" Identifier TFItems DeclsAndStmts endfunction opt(Tag) { [Task $2 $4 (map defaultFuncInput $ $5 ++ fst $6) (snd $6)] } - | "task" Lifetime Identifier TFItems DeclsAndStmts endtask opt(Tag) { [Task $2 $3 (map defaultFuncInput $ $4 ++ fst $5) (snd $5)] } + | "function" Lifetime FuncRetAndName TFItems DeclsAndStmts endfunction opt(Tag) { [Function $2 (fst $3) (snd $3) (map makeInput $4 ++ fst $5) (snd $5)] } + | "function" Lifetime "void" Identifier TFItems DeclsAndStmts endfunction opt(Tag) { [Task $2 $4 ($5 ++ fst $6) (snd $6)] } + | "task" Lifetime Identifier TFItems DeclsAndStmts endtask opt(Tag) { [Task $2 $3 ($4 ++ fst $5) (snd $5)] } | "import" PackageImportItems ";" { map (uncurry Import) $2 } | "export" PackageImportItems ";" { map (uncurry Export) $2 } | "export" "*" "::" "*" ";" { [Export "" ""] } @@ -1433,15 +1433,6 @@ makeInput (CommentDecl c) = CommentDecl c makeInput other = error $ "unexpected non-var or non-input decl: " ++ (show other) -defaultFuncInput :: Decl -> Decl -defaultFuncInput (Variable dir (Implicit sg rs) x a e) = - Variable dir t x a e - where - t = if dir == Input || dir == Inout - then IntegerVector TLogic sg rs - else Implicit sg rs -defaultFuncInput other = other - combineTags :: Identifier -> Identifier -> Identifier combineTags a "" = a combineTags "" b = b