Commit 512d4b1a by Zachary Snow

support module "list of param assignments" shorthand

parent bdafb60d
......@@ -528,8 +528,14 @@ Params :: { [ModuleItem] }
: {- empty -} { [] }
| "#" "(" ParamsFollow { map (MIPackageItem . Decl) $3 }
ParamsFollow :: { [Decl] }
: ParameterDecl(")") { $1 }
| ParameterDecl(",") ParamsFollow { $1 ++ $2 }
: ParamAsgn ")" { [$1] }
| ParamAsgn "," ParamsFollow { $1 : $3 }
| ParamsDecl { $1 }
ParamsDecl :: { [Decl] }
: ParameterDecl(")") { $1 }
| ParameterDecl(",") ParamsDecl { $1 ++ $2 }
ParamAsgn :: { Decl }
: Identifier "=" Expr { Param Parameter (Implicit Unspecified []) $1 $3 }
PortDecls :: { ([Identifier], [ModuleItem]) }
: "(" DeclTokens(")") { parseDTsAsPortDecls $2 }
......
module top #(FOO = 10);
initial $display(FOO);
endmodule
module top2 #(FOO = 10, BAR = 11);
initial $display(FOO, BAR);
endmodule
module top3 #(FOO = 10, BAR = 11, parameter BAZ = 12);
initial $display(FOO, BAR, BAZ);
endmodule
module top #(parameter FOO = 10);
initial $display(FOO);
endmodule
module top2 #(parameter FOO = 10, parameter BAR = 11);
initial $display(FOO, BAR);
endmodule
module top3 #(parameter FOO = 10, parameter BAR = 11, parameter BAZ = 12);
initial $display(FOO, BAR, BAZ);
endmodule
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment