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
a1705363
Commit
a1705363
authored
Aug 20, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unbased-unsized binding nested struct performance fix
parent
7f0c33ab
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
src/Convert/UnbasedUnsized.hs
+11
-3
No files found.
src/Convert/UnbasedUnsized.hs
View file @
a1705363
...
...
@@ -83,7 +83,7 @@ convertModuleItem _ other = convertModuleItem' other
determinePortSize
::
Identifier
->
[
ParamBinding
]
->
[
ModuleItem
]
->
Expr
determinePortSize
portName
instanceParams
moduleItems
=
step
initialMapping
moduleItems
step
(
reverse
initialMapping
)
moduleItems
where
moduleParams
=
parameterNames
moduleItems
initialMapping
=
catMaybes
$
...
...
@@ -99,10 +99,10 @@ determinePortSize portName instanceParams moduleItems =
step
::
[(
Identifier
,
Expr
)]
->
[
ModuleItem
]
->
Expr
step
mapping
(
MIPackageItem
(
Decl
(
Param
_
_
x
e
))
:
rest
)
=
step
(
mapping
++
[(
x
,
e
)]
)
rest
step
(
(
x
,
e
)
:
mapping
)
rest
step
mapping
(
MIPackageItem
(
Decl
(
Variable
_
t
x
a
_
))
:
rest
)
=
if
x
==
portName
then
substituteExpr
mapping
size
then
substituteExpr
(
reverse
mapping
)
size
else
step
mapping
rest
where
size
=
BinOp
Mul
(
dimensionsSize
a
)
(
DimsFn
FnBits
$
Left
t
)
step
mapping
(
_
:
rest
)
=
step
mapping
rest
...
...
@@ -111,6 +111,14 @@ determinePortSize portName instanceParams moduleItems =
substituteExpr
::
[(
Identifier
,
Expr
)]
->
Expr
->
Expr
substituteExpr
_
(
Ident
(
':'
:
x
))
=
Ident
x
substituteExpr
mapping
(
Dot
(
Ident
x
)
y
)
=
case
lookup
x
mapping
of
Nothing
->
Dot
(
Ident
x
)
y
Just
(
Pattern
items
)
->
case
lookup
y
items
of
Just
item
->
substituteExpr
mapping
item
Nothing
->
Dot
(
substituteExpr
mapping
(
Pattern
items
))
y
Just
expr
->
Dot
(
substituteExpr
mapping
expr
)
y
substituteExpr
mapping
(
Ident
x
)
=
case
lookup
x
mapping
of
Nothing
->
Ident
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