File tree Expand file tree Collapse file tree 3 files changed +34
-3
lines changed
src/Language/SystemVerilog/Parser Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import Language.SystemVerilog.Parser.Tokens
3333% tokentype { Token }
3434% error { parseErrorTok }
3535
36- % expect 0
36+ % expect 4
3737
3838% token
3939
@@ -947,9 +947,17 @@ ImportOrExport :: { [PackageItem] }
947947 : " import" PackageImportItems " ;" { map (uncurry Import ) $ 2 }
948948 | " export" PackageImportItems " ;" { map (uncurry Export ) $ 2 }
949949 | " export" " *" " ::" " *" " ;" { [Export " " " " ] }
950+ BlockItemDecls :: { [Decl ] }
951+ : {- empty -} { [] }
952+ | " ;" BlockItemDecls { $ 2 }
953+ | BlockItemDecl BlockItemDecls { $ 1 ++ $ 2 }
954+ BlockItemDecl :: { [Decl ] }
955+ : DataDecl { $ 1 }
956+ DataDecl :: { [Decl ] }
957+ : Typedef { [$ 1 ] }
950958TaskOrFunction :: { PackageItem }
951- : " function" Lifetime FuncRetAndName TFItems DeclsAndStmts endfunction StrTag {% checkTag (snd $ 3 ) $ 7 $ Function $ 2 (fst $ 3 ) (snd $ 3 ) (map makeInput $ 4 ++ fst $ 5 ) (snd $ 5 ) }
952- | " task" Lifetime Identifier TFItems DeclsAndStmts endtask StrTag {% checkTag $ 3 $ 7 $ Task $ 2 $ 3 ($ 4 ++ fst $ 5 ) (snd $ 5 ) }
959+ : " function" Lifetime FuncRetAndName TFItems BlockItemDecls DeclsAndStmts endfunction StrTag {% checkTag (snd $ 3 ) $ 8 $ Function $ 2 (fst $ 3 ) (snd $ 3 ) (map makeInput $ 4 ++ $ 5 ++ fst $ 6 ) (snd $ 6 ) }
960+ | " task" Lifetime Identifier TFItems BlockItemDecls DeclsAndStmts endtask StrTag {% checkTag $ 3 $ 8 $ Task $ 2 $ 3 ($ 4 ++ $ 5 ++ fst $ 6 ) (snd $ 6 ) }
953961Typedef :: { Decl }
954962 : " typedef" Type Identifier " ;" { ParamType Localparam $ 3 $ 2 }
955963 | " typedef" Type Identifier DimensionsNonEmpty " ;" { ParamType Localparam $ 3 (UnpackedType $ 2 $ 4 ) }
Original file line number Diff line number Diff line change 1+ module top ;
2+ task t ;
3+ typedef bit u ;
4+ $display (" t = %d " , u ' (0 ));
5+ endtask
6+ function f ;
7+ typedef bit u ;
8+ return u ' (1 );
9+ endfunction
10+ initial t ();
11+ initial $display (" f = %d " , f ());
12+ endmodule
Original file line number Diff line number Diff line change 1+ module top ;
2+ task t;
3+ $display ("t = %d" , 1'd0 );
4+ endtask
5+ function f;
6+ input reg _sv2v_unused;
7+ f = 1'd1 ;
8+ endfunction
9+ initial t;
10+ initial $display ("f = %d" , f(0 ));
11+ endmodule
You can’t perform that action at this time.
0 commit comments