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
10feedb1
Commit
10feedb1
authored
Sep 11, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use the Unique package in a few places
parent
a14d0782
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
16 deletions
+12
-16
src/Convert/ParamType.hs
+4
-8
src/Convert/Stream.hs
+2
-6
stack.yaml
+4
-1
sv2v.cabal
+2
-1
No files found.
src/Convert/ParamType.hs
View file @
10feedb1
...
...
@@ -8,6 +8,7 @@ module Convert.ParamType (convert) where
import
Control.Monad.Writer
import
Data.Either
(
isLeft
)
import
Data.List.Unique
(
complex
)
import
Data.Maybe
(
isJust
,
isNothing
,
fromJust
)
import
qualified
Data.Map.Strict
as
Map
import
qualified
Data.Set
as
Set
...
...
@@ -32,13 +33,8 @@ convert files =
mapM
(
collectDescriptionsM
collectDescriptionM
)
files
(
files'
,
instancesRaw
)
=
runWriter
$
mapM
(
mapM
$
traverseModuleItemsM
$
convertModuleItemM
info
)
files
instances
=
reverse
$
uniq
[]
instancesRaw
-- TODO: use the unique package
uniq
curr
[]
=
curr
uniq
curr
(
x
:
xs
)
=
if
elem
x
curr
then
uniq
curr
xs
else
uniq
(
x
:
curr
)
xs
instances
=
uniq
instancesRaw
uniq
l
=
l'
where
(
l'
,
_
,
_
)
=
complex
l
-- add type parameter instantiations
files''
=
map
(
concatMap
explodeDescription
)
files'
...
...
@@ -61,7 +57,7 @@ convert files =
explodeDescription
other
=
[
other
]
-- remove or rewrite source modules that are no longer needed
files'''
=
map
(
reverse
.
uniq
[]
.
concatMap
replaceDefault
)
files''
files'''
=
map
(
uniq
.
concatMap
replaceDefault
)
files''
(
usageMapRaw
,
usedTypedModulesRaw
)
=
execWriter
$
mapM
(
mapM
collectUsageInfoM
)
files''
usageMap
=
Map
.
unionsWith
Set
.
union
$
map
(
uncurry
Map
.
singleton
)
...
...
src/Convert/Stream.hs
View file @
10feedb1
...
...
@@ -7,6 +7,7 @@
module
Convert.Stream
(
convert
)
where
import
Control.Monad.Writer
import
Data.List.Unique
(
complex
)
import
Convert.Traverse
import
Language.SystemVerilog.AST
...
...
@@ -23,12 +24,7 @@ convertDescription (description @ (Part _ _ _ _ _ _)) =
(
description'
,
funcSet
)
=
runWriter
$
traverseModuleItemsM
(
traverseStmtsM
traverseStmtM
)
description
Part
extern
kw
lifetime
name
ports
items
=
description'
funcs
=
reverse
$
uniq
[]
funcSet
uniq
curr
[]
=
curr
uniq
curr
(
x
:
xs
)
=
if
elem
x
curr
then
uniq
curr
xs
else
uniq
(
x
:
curr
)
xs
(
funcs
,
_
,
_
)
=
complex
funcSet
convertDescription
other
=
other
streamerBlock
::
Expr
->
Expr
->
(
LHS
->
Expr
->
Stmt
)
->
LHS
->
Expr
->
Stmt
...
...
stack.yaml
View file @
10feedb1
resolver
:
lts-13.17
extra-deps
:
-
Unique-0.4.7.6
packages
:
-
.
-
.
sv2v.cabal
View file @
10feedb1
...
...
@@ -30,7 +30,8 @@ executable sv2v
directory,
filepath,
hashable,
mtl
mtl,
Unique
other-modules:
-- SystemVerilog modules
Language.SystemVerilog
...
...
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