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
2b84bdb7
Commit
2b84bdb7
authored
Oct 01, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for type param without parameter keyword
parent
3807ab67
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
src/Language/SystemVerilog/Parser/Parse.y
+5
-2
test/basic/paramtype.sv
+14
-0
test/basic/paramtype.v
+4
-0
No files found.
src/Language/SystemVerilog/Parser/Parse.y
View file @
2b84bdb7
...
...
@@ -538,8 +538,8 @@ ParamsFollow :: { [Decl] }
| ParamAsgn "," ParamsFollow { $1 : $3 }
| ParamsDecl { $1 }
ParamsDecl :: { [Decl] }
: ParameterDecl(")") { $1 }
| ParameterDecl(",") ParamsDecl { $1 ++ $2 }
:
Module
ParameterDecl(")") { $1 }
|
Module
ParameterDecl(",") ParamsDecl { $1 ++ $2 }
ParamAsgn :: { Decl }
: Identifier "=" Expr { Param Parameter (Implicit Unspecified []) $1 $3 }
...
...
@@ -966,6 +966,9 @@ DeclOrStmt :: { ([Decl], [Stmt]) }
: DeclOrStmtTokens(";") { parseDTsAsDeclOrAsgn $1 }
| ParameterDecl(";") { ($1, []) }
ModuleParameterDecl(delim) :: { [Decl] }
: ParameterDecl(delim) { $1 }
| "type" TypeAsgns delim { map (uncurry $ ParamType Parameter) $2 }
ParameterDecl(delim) :: { [Decl] }
: ParameterDeclKW DeclAsgns delim { makeParamDecls $1 (Implicit Unspecified []) $2 }
| ParameterDeclKW ParamType DeclAsgns delim { makeParamDecls $1 ($2 ) $3 }
...
...
test/basic/paramtype.sv
View file @
2b84bdb7
...
...
@@ -67,6 +67,17 @@ module o_nodef #(
end
endmodule
module
p
#(
type
T
=
logic
,
U
=
logic
)
;
T
x
=
0
;
U
y
=
1
;
initial
begin
$
display
(
"p %b %b %d"
,
x
,
x
+
1
,
$
bits
(
T
))
;
$
display
(
"p %b %b %d"
,
y
,
y
+
1
,
$
bits
(
U
))
;
end
endmodule
module
top
;
endmodule
// Top level modules appear to be generally instantiated in lexicographic order,
...
...
@@ -98,3 +109,6 @@ module f_1; o_nodef #(1, logic [1:0], logic [2:0], 0) x(); endmodule
module
f_2
;
o_nodef
#(
.
T
(
logic
[
1
:
0
])
,
.
U
(
logic
)
,
.
b
(
1
)
,
.
a
(
0
))
x
()
;
endmodule
module
f_3
;
o_nodef
#(
0
,
logic
[
1
:
0
]
,
logic
[
2
:
0
]
,
1
)
x
()
;
endmodule
module
f_4
;
o_nodef
#(
.
T
(
logic
[
1
:
0
])
,
.
U
(
logic
)
,
.
b
(
0
)
,
.
a
(
1
))
x
()
;
endmodule
module
p_1
;
p
#(
logic
[
1
:
0
]
,
logic
[
2
:
0
])
x
()
;
endmodule
module
p_2
;
p
x
()
;
endmodule
test/basic/paramtype.v
View file @
2b84bdb7
...
...
@@ -36,5 +36,9 @@ module top;
$
display
(
"n_nodef b= 1 001 00000000000000000000000000000010 3"
)
;
$
display
(
"n_nodef a= 1 01 00000000000000000000000000000010 2"
)
;
$
display
(
"n_nodef b= 0 0 00000000000000000000000000000001 1"
)
;
$
display
(
"p 00 00000000000000000000000000000001 2"
)
;
$
display
(
"p 001 00000000000000000000000000000010 3"
)
;
$
display
(
"p 0 00000000000000000000000000000001 1"
)
;
$
display
(
"p 1 00000000000000000000000000000010 1"
)
;
end
endmodule
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