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
710da1a6
Commit
710da1a6
authored
Mar 06, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix PackedArray ident prefix conditions
parent
15d85b46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
17 deletions
+16
-17
src/Convert/PackedArray.hs
+16
-17
No files found.
src/Convert/PackedArray.hs
View file @
710da1a6
...
...
@@ -19,9 +19,6 @@
- derive one from the other. The derivation direction is decided based on
- which version, if any, is exposed directly as a port.
-
- TODO FIXME XXX: The Parser/AST don't yet support indexing into an identifier
- twice, or indexing into an identifier, and then selecting a range.
-
- TODO: This assumes that the first range index is the upper bound. We could
- probably get around this with some cleverness in the generate block. I don't
- think it's urgent to have support for "backwards" ranges.
...
...
@@ -210,23 +207,25 @@ rewriteModuleItem info =
traverseStmts
rewriteStmt
.
traverseExprs
rewriteExpr
where
Info
typeDims
portDirs
idxUses
seqUses
=
info
Info
typeDims
_
idxUses
seqUses
=
info
duoUses
=
Set
.
intersection
idxUses
seqUses
rewriteIdent
::
Bool
->
Identifier
->
Identifier
rewriteIdent
isAsgn
x
=
if
isDuod
&&
(
isOutputPort
==
isAsgn
)
then
prefix
x
rewriteIdent
isSeqUsage
x
=
if
Set
.
member
x
duoUses
then
-- if an array is used both ways, then the original name is
-- the flattened version
if
isSeqUsage
then
x
else
prefix
x
else
x
where
isDuod
=
Set
.
member
x
duoUses
isOutputPort
=
Map
.
lookup
x
portDirs
==
Just
Output
rewriteReadIdent
=
rewriteIdent
False
rewriteAsgnIdent
=
rewriteIdent
True
rewriteSeqIdent
=
rewriteIdent
True
rewriteIdxIdent
=
rewriteIdent
False
rewriteExpr
::
Expr
->
Expr
rewriteExpr
(
Ident
i
)
=
Ident
i
rewriteExpr
(
Bit
(
Ident
i
)
e
)
=
Bit
(
Ident
$
rewrite
Read
Ident
i
)
e
rewriteExpr
(
Ident
i
)
=
Ident
$
rewriteSeqIdent
i
rewriteExpr
(
Bit
(
Ident
i
)
e
)
=
Bit
(
Ident
$
rewrite
Idx
Ident
i
)
e
rewriteExpr
(
Range
(
Ident
i
)
(
r
@
(
s
,
e
)))
=
if
Map
.
member
i
typeDims
then
Range
(
Ident
i
)
r'
...
...
@@ -240,9 +239,9 @@ rewriteModuleItem info =
rewriteExpr
other
=
other
rewriteLHS
::
LHS
->
LHS
rewriteLHS
(
LHSIdent
x
)
=
LHSIdent
(
rewrite
Asgn
Ident
x
)
rewriteLHS
(
LHSBit
(
LHS
Bit
(
LHSIdent
x
)
a
)
b
)
=
LHSBit
(
LHS
Bit
(
LHSIdent
$
rewriteReadIdent
x
)
a
)
b
rewriteLHS
(
LHSIdent
x
)
=
LHSIdent
(
rewrite
Seq
Ident
x
)
rewriteLHS
(
LHSBit
(
LHS
Ident
x
)
e
)
=
LHSBit
(
LHS
Ident
$
rewriteIdxIdent
x
)
e
rewriteLHS
(
LHSBit
l
e
)
=
LHSBit
(
rewriteLHS
l
)
e
rewriteLHS
(
LHSRange
l
r
)
=
LHSRange
(
rewriteLHS
l
)
r
rewriteLHS
(
LHSDot
l
x
)
=
LHSDot
(
rewriteLHS
l
)
x
...
...
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