Commit 9c160c3d by Zachary Snow

added support for package imports in module headers

parent 35ac09aa
...@@ -336,8 +336,8 @@ Packing :: { Packing } ...@@ -336,8 +336,8 @@ Packing :: { Packing }
| {- empty -} { Unpacked } | {- empty -} { Unpacked }
Part(begin, end) :: { Description } Part(begin, end) :: { Description }
: begin opt(Lifetime) Identifier Params PortDecls ";" ModuleItems end opt(Tag) { Part False $1 $2 $3 (fst $5) ($4 ++ (snd $5) ++ $7) } : begin opt(Lifetime) Identifier PackageImportDeclarations Params PortDecls ";" ModuleItems end opt(Tag) { Part False $1 $2 $3 (fst $6) ($4 ++ $5 ++ (snd $6) ++ $8) }
| "extern" begin opt(Lifetime) Identifier Params PortDecls ";" { Part True $2 $3 $4 (fst $6) ($5 ++ (snd $6) ) } | "extern" begin opt(Lifetime) Identifier PackageImportDeclarations Params PortDecls ";" { Part True $2 $3 $4 (fst $7) ($5 ++ $6 ++ (snd $7) ) }
ModuleKW :: { PartKW } ModuleKW :: { PartKW }
: "module" { Module } : "module" { Module }
...@@ -350,6 +350,13 @@ PackageDeclaration :: { Description } ...@@ -350,6 +350,13 @@ PackageDeclaration :: { Description }
Tag :: { Identifier } Tag :: { Identifier }
: ":" Identifier { $2 } : ":" Identifier { $2 }
PackageImportDeclarations :: { [ModuleItem] }
: PackageImportDeclaration PackageImportDeclarations { $1 ++ $2 }
| {- empty -} { [] }
PackageImportDeclaration :: { [ModuleItem] }
: "import" PackageImportItems ";" { map (MIPackageItem . uncurry Import) $2 }
Params :: { [ModuleItem] } Params :: { [ModuleItem] }
: {- empty -} { [] } : {- empty -} { [] }
| "#" "(" ParamDecls { $3 } | "#" "(" ParamDecls { $3 }
......
package P;
localparam FOO = 10;
endpackage
module top
import P::FOO;
;
initial begin
$display(FOO);
end
endmodule
module top;
localparam P_FOO = 10;
initial begin
$display(P_FOO);
end
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