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
650c602b
Commit
650c602b
authored
Mar 31, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
struct conversion handles bit expressions and expressions outside of assignments
parent
b8d31d2a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
src/Convert/Struct.hs
+12
-0
No files found.
src/Convert/Struct.hs
View file @
650c602b
...
...
@@ -25,6 +25,7 @@ convert = traverseDescriptions convertDescription
convertDescription
::
Description
->
Description
convertDescription
description
=
traverseModuleItems
(
traverseExprs
$
traverseNestedExprs
$
convertOnlyExpr
structs
types
)
$
traverseModuleItems
(
traverseTypes
$
convertType
structs
)
$
traverseModuleItems
(
traverseAsgns
$
convertAsgn
structs
types
)
$
description
...
...
@@ -122,6 +123,9 @@ collectFunction :: ModuleItem -> Writer Types ()
collectFunction
(
MIPackageItem
(
Function
_
t
f
_
_
))
=
tell
$
Map
.
singleton
f
t
collectFunction
_
=
return
()
convertOnlyExpr
::
Structs
->
Types
->
Expr
->
Expr
convertOnlyExpr
structs
types
expr
=
snd
$
convertAsgn
structs
types
(
LHSIdent
""
,
expr
)
convertAsgn
::
Structs
->
Types
->
(
LHS
,
Expr
)
->
(
LHS
,
Expr
)
convertAsgn
structs
types
(
lhs
,
expr
)
=
...
...
@@ -241,6 +245,14 @@ convertAsgn structs types (lhs, expr) =
where
(
_
,
e1'
)
=
convertSubExpr
e1
(
_
,
e2'
)
=
convertSubExpr
e2
convertSubExpr
(
Bit
e
i
)
=
(
t'
,
Bit
e'
i'
)
where
(
t
,
e'
)
=
convertSubExpr
e
t'
=
case
typeRanges
t
of
(
_
,
[]
)
->
Implicit
Unspecified
[]
(
tf
,
rs
)
->
tf
$
tail
rs
(
_
,
i'
)
=
convertSubExpr
i
-- TODO: There are other expression cases that we probably need to
-- recurse into. That said, it's not clear to me how much we really
-- expect to see things like concatenated packed structs, for example.
...
...
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