Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv2v
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
sv2v
Commits
e82537fa
Commit
e82537fa
authored
Aug 06, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for localparams in module parameter list (resolves #7)
parent
90bc30d4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
18 deletions
+14
-18
src/Language/SystemVerilog/Parser/Parse.y
+12
-16
test/resolve/module.sv
+1
-1
test/resolve/reference.v
+1
-1
No files found.
src/Language/SystemVerilog/Parser/Parse.y
View file @
e82537fa
...
...
@@ -359,14 +359,10 @@ PackageImportDeclaration :: { [ModuleItem] }
Params :: { [ModuleItem] }
: {- empty -} { [] }
| "#" "(" ParamDecls { $3 }
ParamDecls :: { [ModuleItem] }
: ParamDecl(")") { $1 }
| ParamDecl(",") ParamDecls { $1 ++ $2 }
ParamDecl(delim) :: { [ModuleItem] }
: ParameterDecl(OnlyParamKW, delim) { map (MIPackageItem . Decl) $1 }
OnlyParamKW :: { Type -> Identifier -> Expr -> Decl }
: "parameter" { Parameter }
| "#" "(" ParamsFollow { map (MIPackageItem . Decl) $3 }
ParamsFollow :: { [Decl] }
: ParameterDecl(")") { $1 }
| ParameterDecl(",") ParamsFollow { $1 ++ $2 }
PortDecls :: { ([Identifier], [ModuleItem]) }
: "(" DeclTokens(")") { parseDTsAsPortDecls $2 }
...
...
@@ -456,7 +452,7 @@ ModuleItem :: { [ModuleItem] }
NonGenerateModuleItem :: { [ModuleItem] }
-- This item covers module instantiations and all declarations
: DeclTokens(";") { parseDTsAsModuleItems $1 }
| ParameterDecl(
ParameterDeclKW, ";")
{ map (MIPackageItem . Decl) $1 }
| ParameterDecl(
";")
{ map (MIPackageItem . Decl) $1 }
| "defparam" DefparamAsgns ";" { map (uncurry Defparam) $2 }
| "assign" opt(DelayControl) LHS "=" Expr ";" { [Assign $2 $3 $5] }
| AlwaysKW Stmt { [AlwaysC $1 $2] }
...
...
@@ -578,7 +574,7 @@ PackageItems :: { [PackageItem] }
| PackageItems PackageItem { $1 ++ $2 }
PackageItem :: { [PackageItem] }
: DeclTokens(";") { map Decl $ parseDTsAsDecls $1 }
| ParameterDecl(
ParameterDeclKW,
";") { map Decl $1 }
| ParameterDecl(";") { map Decl $1 }
| NonDeclPackageItem { $1 }
NonDeclPackageItem :: { [PackageItem] }
: "typedef" Type Identifier ";" { [Typedef $2 $3] }
...
...
@@ -728,13 +724,13 @@ DeclsAndStmts :: { ([Decl], [Stmt]) }
| {- empty -} { ([], []) }
DeclOrStmt :: { ([Decl], [Stmt]) }
: DeclOrStmtTokens(";") { parseDTsAsDeclOrAsgn $1 }
| ParameterDecl(
ParameterDeclKW, ";")
{ ($1, []) }
| ParameterDecl(
";")
{ ($1, []) }
ParameterDecl(
kw,
delim) :: { [Decl] }
:
kw
DeclAsgns delim { map (uncurry $ $1 (Implicit Unspecified [])) $2 }
|
kw
ParamType DeclAsgns delim { map (uncurry $ $1 ($2 )) $3 }
|
kw
Identifier DeclAsgns delim { map (uncurry $ $1 (Alias (Nothing) $2 [])) $3 }
|
kw
Identifier "::" Identifier DeclAsgns delim { map (uncurry $ $1 (Alias (Just $2) $4 [])) $5 }
ParameterDecl(delim) :: { [Decl] }
:
ParameterDeclKW
DeclAsgns delim { map (uncurry $ $1 (Implicit Unspecified [])) $2 }
|
ParameterDeclKW
ParamType DeclAsgns delim { map (uncurry $ $1 ($2 )) $3 }
|
ParameterDeclKW
Identifier DeclAsgns delim { map (uncurry $ $1 (Alias (Nothing) $2 [])) $3 }
|
ParameterDeclKW
Identifier "::" Identifier DeclAsgns delim { map (uncurry $ $1 (Alias (Just $2) $4 [])) $5 }
ParameterDeclKW :: { Type -> Identifier -> Expr -> Decl }
: "parameter" { Parameter }
| "localparam" { Localparam }
...
...
test/resolve/module.sv
View file @
e82537fa
module
top
import
pkg
::*;
#(
parameter
width
=
width_calc
(
2
))
#(
localparam
width
=
width_calc
(
2
))
(
input
[
width
-
1
:
0
]
i
,
output
[
width
-
1
:
0
]
o
)
;
assign
o
=
i
+
1'b1
;
initial
begin
...
...
test/resolve/reference.v
View file @
e82537fa
`define
FANCY_SEEING_YOU
1337
module
top
;
parameter
width
=
5
;
localparam
width
=
5
;
input
[
width
-
1
:
0
]
i
;
output
[
width
-
1
:
0
]
o
;
assign
o
=
i
+
1'b1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment