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
0a3e9f4f
Commit
0a3e9f4f
authored
Mar 31, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more range-bit edge cases in Struct conversion
parent
650c602b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
src/Convert/Struct.hs
+16
-7
No files found.
src/Convert/Struct.hs
View file @
0a3e9f4f
...
...
@@ -147,14 +147,20 @@ convertAsgn structs types (lhs, expr) =
where
(
t
,
l'
)
=
convertLHS
l
(
tf
,
rs
)
=
typeRanges
t
convertLHS
(
LHSRange
l
r
)
=
if
null
rs
then
(
Implicit
Unspecified
[]
,
LHSRange
l'
r
)
else
(
tf
rs'
,
LHSRange
l'
r
)
convertLHS
(
LHSRange
l
(
rOuter
@
(
hiO
,
loO
)))
=
case
l'
of
LHSRange
lInner
(
hiI
,
loI
)
->
(
t
,
LHSRange
lInner
(
simplify
hi
,
simplify
lo
))
where
hi
=
BinOp
Add
(
BinOp
Sub
hiI
loI
)
hiO
lo
=
BinOp
Add
loI
loO
_
->
if
null
rs
then
(
Implicit
Unspecified
[]
,
LHSRange
l'
rOuter
)
else
(
tf
rs'
,
LHSRange
l'
rOuter
)
where
(
t
,
l'
)
=
convertLHS
l
(
tf
,
rs
)
=
typeRanges
t
rs'
=
r
:
tail
rs
rs'
=
r
Outer
:
tail
rs
convertLHS
(
LHSDot
l
x
)
=
case
t
of
InterfaceT
_
_
_
->
(
Implicit
Unspecified
[]
,
LHSDot
l'
x
)
...
...
@@ -229,7 +235,7 @@ convertAsgn structs types (lhs, expr) =
convertSubExpr
(
Range
eOuter
(
rOuter
@
(
hiO
,
loO
)))
=
-- VCS doesn't allow ranges to be cascaded, so we need to combine
-- nested Ranges into a single range. My understanding of the
-- semantics are that a range return a new, zero-indexed sub-range.
-- semantics are that a range return
s
a new, zero-indexed sub-range.
case
eOuter'
of
Range
eInner
(
hiI
,
loI
)
->
(
t
,
Range
eInner
(
simplify
hi
,
simplify
lo
))
...
...
@@ -246,7 +252,10 @@ convertAsgn structs types (lhs, expr) =
(
_
,
e1'
)
=
convertSubExpr
e1
(
_
,
e2'
)
=
convertSubExpr
e2
convertSubExpr
(
Bit
e
i
)
=
(
t'
,
Bit
e'
i'
)
case
e'
of
Range
eInner
(
_
,
loI
)
->
(
t'
,
Bit
eInner
(
simplify
$
BinOp
Add
loI
i'
))
_
->
(
t'
,
Bit
e'
i'
)
where
(
t
,
e'
)
=
convertSubExpr
e
t'
=
case
typeRanges
t
of
...
...
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