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
9de4d443
Commit
9de4d443
authored
Dec 24, 2022
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify handles shadowing via vars and genvars
parent
72ab6396
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
src/Convert/Simplify.hs
+6
-2
test/basic/simplify_arg_shadow.sv
+8
-0
test/basic/simplify_genvar_shadow.sv
+8
-0
No files found.
src/Convert/Simplify.hs
View file @
9de4d443
...
@@ -42,6 +42,8 @@ traverseDeclM decl = do
...
@@ -42,6 +42,8 @@ traverseDeclM decl = do
where
t
=
IntegerVector
TLogic
sg
rs
where
t
=
IntegerVector
TLogic
sg
rs
Param
Localparam
t
x
e
->
Param
Localparam
t
x
e
->
insertExpr
x
$
Cast
(
Left
t
)
e
insertExpr
x
$
Cast
(
Left
t
)
e
Variable
_
_
x
_
_
->
insertElem
x
Nil
Net
_
_
_
_
x
_
_
->
insertElem
x
Nil
_
->
return
()
_
->
return
()
return
decl'
return
decl'
...
@@ -66,6 +68,8 @@ isSimpleExpr (Cast Left{} e) = isSimpleExpr e
...
@@ -66,6 +68,8 @@ isSimpleExpr (Cast Left{} e) = isSimpleExpr e
isSimpleExpr
_
=
False
isSimpleExpr
_
=
False
traverseModuleItemM
::
ModuleItem
->
Scoper
Expr
ModuleItem
traverseModuleItemM
::
ModuleItem
->
Scoper
Expr
ModuleItem
traverseModuleItemM
(
Genvar
x
)
=
insertElem
x
Nil
>>
return
(
Genvar
x
)
traverseModuleItemM
(
Instance
m
p
x
rs
l
)
=
do
traverseModuleItemM
(
Instance
m
p
x
rs
l
)
=
do
p'
<-
mapM
paramBindingMapper
p
p'
<-
mapM
paramBindingMapper
p
traverseExprsM
traverseExprM
$
Instance
m
p'
x
rs
l
traverseExprsM
traverseExprM
$
Instance
m
p'
x
rs
l
...
@@ -147,8 +151,8 @@ substitute scopes expr =
...
@@ -147,8 +151,8 @@ substitute scopes expr =
substitute'
::
Expr
->
Expr
substitute'
::
Expr
->
Expr
substitute'
(
Ident
x
)
=
substitute'
(
Ident
x
)
=
case
lookupElem
scopes
x
of
case
lookupElem
scopes
x
of
Nothing
->
Ident
x
Just
(
_
,
_
,
e
)
|
e
/=
Nil
->
e
Just
(
_
,
_
,
e
)
->
e
_
->
Ident
x
substitute'
other
=
substitute'
other
=
traverseSinglyNestedExprs
substitute'
other
traverseSinglyNestedExprs
substitute'
other
...
...
test/basic/simplify_arg_shadow.sv
0 → 100644
View file @
9de4d443
module
top
;
localparam
i
=
1234
;
function
automatic
integer
f
;
input
integer
i
;
f
=
i
+
1
;
endfunction
initial
$
display
(
i
,
f
(
0
)
,
f
(
i
+
1
))
;
endmodule
test/basic/simplify_genvar_shadow.sv
0 → 100644
View file @
9de4d443
module
top
;
localparam
i
=
1234
;
if
(
1
)
begin
genvar
i
;
for
(
i
=
0
;
i
<
10
;
i
=
i
+
1
)
initial
$
display
(
i
>
5
?
i
+
100
:
i
-
100
)
;
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