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
8537a9ef
Commit
8537a9ef
authored
Jul 22, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix scoping of single-item generate conditionals
parent
5ad8de9e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
8 deletions
+35
-8
src/Convert/Scoper.hs
+17
-8
test/basic/generate_if_scope.sv
+9
-0
test/basic/generate_if_scope.v
+9
-0
No files found.
src/Convert/Scoper.hs
View file @
8537a9ef
...
...
@@ -361,16 +361,13 @@ evalScoperT declMapper moduleItemMapper genItemMapper stmtMapper topName items =
let
genItems
=
map
GenModuleItem
injected'
++
[
genItem''
]
return
$
GenBlock
""
genItems
scopeGenItemMapper
::
GenItem
->
ScoperT
a
m
GenItem
scopeGenItemMapper
(
GenFor
(
index
,
a
)
b
c
(
GenBlock
name
genItems
))
=
do
enterScope
name
index
genItems'
<-
mapM
fullGenItemMapper
genItems
exitScope
name
index
return
$
GenFor
(
index
,
a
)
b
c
(
GenBlock
name
genItems'
)
scopeGenItemMapper
(
GenFor
(
index
,
a
)
b
c
genItem
)
=
do
enterScope
""
index
genItem'
<-
fullGenItemMapper
genItem
exitScope
""
index
genItem'
<-
scopeGenItemBranchMapper
index
genItem
return
$
GenFor
(
index
,
a
)
b
c
genItem'
scopeGenItemMapper
(
GenIf
cond
thenItem
elseItem
)
=
do
thenItem'
<-
scopeGenItemBranchMapper
""
thenItem
elseItem'
<-
scopeGenItemBranchMapper
""
elseItem
return
$
GenIf
cond
thenItem'
elseItem'
scopeGenItemMapper
(
GenBlock
name
genItems
)
=
do
enterScope
name
""
genItems'
<-
mapM
fullGenItemMapper
genItems
...
...
@@ -381,6 +378,18 @@ evalScoperT declMapper moduleItemMapper genItemMapper stmtMapper topName items =
scopeGenItemMapper
genItem
=
traverseSinglyNestedGenItemsM
fullGenItemMapper
genItem
scopeGenItemBranchMapper
::
Identifier
->
GenItem
->
ScoperT
a
m
GenItem
scopeGenItemBranchMapper
index
(
GenBlock
name
genItems
)
=
do
enterScope
name
index
genItems'
<-
mapM
fullGenItemMapper
genItems
exitScope
name
index
return
$
GenBlock
name
genItems'
scopeGenItemBranchMapper
index
genItem
=
do
enterScope
""
index
genItem'
<-
fullGenItemMapper
genItem
exitScope
""
index
return
genItem'
partScoper
::
MapperM
(
Scoper
a
)
Decl
->
MapperM
(
Scoper
a
)
ModuleItem
...
...
test/basic/generate_if_scope.sv
0 → 100644
View file @
8537a9ef
module
top
;
parameter
WIDTH
=
5
;
logic
[
WIDTH
-
1
:
0
]
x
,
y
;
if
(
WIDTH
>
0
)
initial
x
=
WIDTH
'
(
0
)
;
initial
y
=
WIDTH
'
(
0
)
;
endmodule
test/basic/generate_if_scope.v
0 → 100644
View file @
8537a9ef
module
top
;
parameter
WIDTH
=
5
;
reg
[
WIDTH
-
1
:
0
]
x
,
y
;
if
(
WIDTH
>
0
)
initial
x
=
0
;
initial
y
=
0
;
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