mirror of https://github.com/zachjs/sv2v.git
added support for package imports in module headers
This commit is contained in:
parent
35ac09aa75
commit
9c160c3d20
|
|
@ -336,8 +336,8 @@ Packing :: { Packing }
|
|||
| {- empty -} { Unpacked }
|
||||
|
||||
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) }
|
||||
| "extern" begin opt(Lifetime) Identifier Params PortDecls ";" { Part True $2 $3 $4 (fst $6) ($5 ++ (snd $6) ) }
|
||||
: 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 PackageImportDeclarations Params PortDecls ";" { Part True $2 $3 $4 (fst $7) ($5 ++ $6 ++ (snd $7) ) }
|
||||
|
||||
ModuleKW :: { PartKW }
|
||||
: "module" { Module }
|
||||
|
|
@ -350,6 +350,13 @@ PackageDeclaration :: { Description }
|
|||
Tag :: { Identifier }
|
||||
: ":" Identifier { $2 }
|
||||
|
||||
PackageImportDeclarations :: { [ModuleItem] }
|
||||
: PackageImportDeclaration PackageImportDeclarations { $1 ++ $2 }
|
||||
| {- empty -} { [] }
|
||||
|
||||
PackageImportDeclaration :: { [ModuleItem] }
|
||||
: "import" PackageImportItems ";" { map (MIPackageItem . uncurry Import) $2 }
|
||||
|
||||
Params :: { [ModuleItem] }
|
||||
: {- empty -} { [] }
|
||||
| "#" "(" ParamDecls { $3 }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
package P;
|
||||
localparam FOO = 10;
|
||||
endpackage
|
||||
module top
|
||||
import P::FOO;
|
||||
;
|
||||
initial begin
|
||||
$display(FOO);
|
||||
end
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
module top;
|
||||
localparam P_FOO = 10;
|
||||
initial begin
|
||||
$display(P_FOO);
|
||||
end
|
||||
endmodule
|
||||
Loading…
Reference in New Issue