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
90421456
Commit
90421456
authored
May 31, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
substitute localparams into type params
parent
ea81d55c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
0 deletions
+27
-0
src/Convert/Simplify.hs
+11
-0
src/Convert/Traverse.hs
+13
-0
test/basic/paramtype.sv
+1
-0
test/basic/paramtype.v
+2
-0
No files found.
src/Convert/Simplify.hs
View file @
90421456
...
...
@@ -42,6 +42,14 @@ traverseDeclM decl = do
return
decl'
traverseModuleItemM
::
ModuleItem
->
State
Info
ModuleItem
traverseModuleItemM
(
Instance
m
p
x
r
l
)
=
do
p'
<-
mapM
paramBindingMapper
p
traverseExprsM
traverseExprM
$
Instance
m
p'
x
r
l
where
paramBindingMapper
(
param
,
Left
t
)
=
do
t'
<-
traverseTypeExprsM
substituteExprM
t
return
(
param
,
Left
t'
)
paramBindingMapper
(
param
,
Right
e
)
=
return
(
param
,
Right
e
)
traverseModuleItemM
item
=
traverseExprsM
traverseExprM
item
traverseStmtM
::
Stmt
->
State
Info
Stmt
...
...
@@ -50,6 +58,9 @@ traverseStmtM stmt = traverseStmtExprsM traverseExprM stmt
traverseExprM
::
Expr
->
State
Info
Expr
traverseExprM
=
traverseNestedExprsM
$
stately
convertExpr
substituteExprM
::
Expr
->
State
Info
Expr
substituteExprM
=
traverseNestedExprsM
$
stately
substitute
convertExpr
::
Info
->
Expr
->
Expr
convertExpr
info
(
Cast
(
Right
c
)
e
)
=
Cast
(
Right
c'
)
e
...
...
src/Convert/Traverse.hs
View file @
90421456
...
...
@@ -54,6 +54,9 @@ module Convert.Traverse
,
traverseExprTypesM
,
traverseExprTypes
,
collectExprTypesM
,
traverseTypeExprsM
,
traverseTypeExprs
,
collectTypeExprsM
,
traverseTypesM'
,
traverseTypes'
,
collectTypesM'
...
...
@@ -896,6 +899,16 @@ traverseExprTypes = unmonad traverseExprTypesM
collectExprTypesM
::
Monad
m
=>
CollectorM
m
Type
->
CollectorM
m
Expr
collectExprTypesM
=
collectify
traverseExprTypesM
traverseTypeExprsM
::
Monad
m
=>
MapperM
m
Expr
->
MapperM
m
Type
traverseTypeExprsM
mapper
=
typeMapper
where
(
_
,
_
,
_
,
_
,
typeMapper
)
=
exprMapperHelpers
mapper
traverseTypeExprs
::
Mapper
Expr
->
Mapper
Type
traverseTypeExprs
=
unmonad
traverseTypeExprsM
collectTypeExprsM
::
Monad
m
=>
CollectorM
m
Expr
->
CollectorM
m
Type
collectTypeExprsM
=
collectify
traverseTypeExprsM
traverseTypesM'
::
Monad
m
=>
TypeStrategy
->
MapperM
m
Type
->
MapperM
m
ModuleItem
traverseTypesM'
strategy
mapper
item
=
miMapper
item
>>=
...
...
test/basic/paramtype.sv
View file @
90421456
...
...
@@ -112,3 +112,4 @@ 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
module
p_3
;
localparam
W
=
2
;
p
#(
logic
[
W
:
0
]
,
logic
[
W
:
0
])
x
()
;
endmodule
test/basic/paramtype.v
View file @
90421456
...
...
@@ -40,5 +40,7 @@ module top;
$
display
(
"p 001 00000000000000000000000000000010 3"
)
;
$
display
(
"p 0 00000000000000000000000000000001 1"
)
;
$
display
(
"p 1 00000000000000000000000000000010 1"
)
;
$
display
(
"p 000 00000000000000000000000000000001 3"
)
;
$
display
(
"p 001 00000000000000000000000000000010 3"
)
;
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