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
4178751b
Commit
4178751b
authored
Apr 23, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interface conversion handles decls with unpacked dimensions
parent
4e342174
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
src/Convert/Interface.hs
+11
-9
No files found.
src/Convert/Interface.hs
View file @
4178751b
...
...
@@ -6,7 +6,7 @@
module
Convert.Interface
(
convert
)
where
import
Data.Maybe
(
mapMaybe
)
import
Data.Maybe
(
fromJust
,
mapMaybe
)
import
Control.Monad.Writer
import
qualified
Data.Map.Strict
as
Map
import
qualified
Data.Set
as
Set
...
...
@@ -79,9 +79,9 @@ convertDescription interfaces modules (Part extern Module lifetime name ports it
where
InterfaceT
interfaceName
(
Just
_
)
[]
=
t
interfaceItems
=
snd
$
interfaces
Map
.!
interfaceName
mapper
=
\
(
dir
,
port
,
Just
expr
)
->
Variable
dir
(
lookupType
interfaceItems
expr
)
(
ident
++
"_"
++
port
)
[]
Nothing
mapper
(
dir
,
port
,
expr
)
=
Variable
dir
mpt
(
ident
++
"_"
++
port
)
mprs
Nothing
where
(
mpt
,
mprs
)
=
lookupType
interfaceItems
(
fromJust
expr
)
mapInterface
(
Instance
part
params
ident
Nothing
instancePorts
)
=
case
Map
.
lookup
part
interfaces
of
Just
interface
->
...
...
@@ -201,13 +201,15 @@ prefixModuleItems prefix =
prefixLHS
(
LHSIdent
x
)
=
LHSIdent
(
prefix
++
x
)
prefixLHS
other
=
other
lookupType
::
[
ModuleItem
]
->
Expr
->
Type
lookupType
::
[
ModuleItem
]
->
Expr
->
(
Type
,
[
Range
])
lookupType
items
(
Ident
ident
)
=
head
$
mapMaybe
findType
items
case
mapMaybe
findType
items
of
[]
->
error
$
"unable to locate type of "
++
ident
ts
->
head
ts
where
findType
::
ModuleItem
->
Maybe
Type
findType
(
MIDecl
(
Variable
_
t
x
[]
Nothing
))
=
if
x
==
ident
then
Just
t
else
Nothing
findType
::
ModuleItem
->
Maybe
(
Type
,
[
Range
])
findType
(
MIDecl
(
Variable
_
t
x
rs
Nothing
))
=
if
x
==
ident
then
Just
(
t
,
rs
)
else
Nothing
findType
_
=
Nothing
lookupType
_
expr
=
-- TODO: Add support for non-Ident modport expressions.
...
...
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