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
07b64bd1
Commit
07b64bd1
authored
Apr 17, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clearer messaging surrounding unsupported interface conversion features
parent
8b8d62c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
src/Convert/Interface.hs
+11
-6
No files found.
src/Convert/Interface.hs
View file @
07b64bd1
...
@@ -70,7 +70,6 @@ convertDescription interfaces modules (Part extern Module lifetime name ports it
...
@@ -70,7 +70,6 @@ convertDescription interfaces modules (Part extern Module lifetime name ports it
else
return
()
else
return
()
collectInterface
_
=
return
()
collectInterface
_
=
return
()
-- TODO: We don't yet handle interfaces with parameter bindings.
mapInterface
::
ModuleItem
->
ModuleItem
mapInterface
::
ModuleItem
->
ModuleItem
mapInterface
(
orig
@
(
MIDecl
(
Variable
Local
t
ident
_
_
)))
=
mapInterface
(
orig
@
(
MIDecl
(
Variable
Local
t
ident
_
_
)))
=
case
Map
.
lookup
ident
modports
of
case
Map
.
lookup
ident
modports
of
...
@@ -86,8 +85,13 @@ convertDescription interfaces modules (Part extern Module lifetime name ports it
...
@@ -86,8 +85,13 @@ convertDescription interfaces modules (Part extern Module lifetime name ports it
mapInterface
(
Instance
part
params
ident
Nothing
instancePorts
)
=
mapInterface
(
Instance
part
params
ident
Nothing
instancePorts
)
=
case
Map
.
lookup
part
interfaces
of
case
Map
.
lookup
part
interfaces
of
Just
interface
->
Just
interface
->
Generate
$
map
GenModuleItem
$
-- TODO: Add support for interfaces with parameter bindings.
inlineInterface
interface
(
ident
,
expandedPorts
)
if
not
$
null
params
then
error
$
"interface instantiations with parameter "
++
"bindings are not yet supported: "
++
show
(
part
,
params
,
ident
)
else
Generate
$
map
GenModuleItem
$
inlineInterface
interface
(
ident
,
expandedPorts
)
Nothing
->
Instance
part
params
ident
Nothing
expandedPorts
Nothing
->
Instance
part
params
ident
Nothing
expandedPorts
where
expandedPorts
=
concatMap
(
expandPortBinding
part
)
instancePorts
where
expandedPorts
=
concatMap
(
expandPortBinding
part
)
instancePorts
mapInterface
(
orig
@
(
MIPackageItem
(
Function
_
_
_
decls
_
)))
=
mapInterface
(
orig
@
(
MIPackageItem
(
Function
_
_
_
decls
_
)))
=
...
@@ -197,8 +201,6 @@ prefixModuleItems prefix =
...
@@ -197,8 +201,6 @@ prefixModuleItems prefix =
prefixLHS
(
LHSIdent
x
)
=
LHSIdent
(
prefix
++
x
)
prefixLHS
(
LHSIdent
x
)
=
LHSIdent
(
prefix
++
x
)
prefixLHS
other
=
other
prefixLHS
other
=
other
-- TODO: this is an incomplete attempt at looking up the type of an expression;
-- there is definitely some overlap here with the Struct conversion
lookupType
::
[
ModuleItem
]
->
Expr
->
Type
lookupType
::
[
ModuleItem
]
->
Expr
->
Type
lookupType
items
(
Ident
ident
)
=
lookupType
items
(
Ident
ident
)
=
head
$
mapMaybe
findType
items
head
$
mapMaybe
findType
items
...
@@ -207,7 +209,10 @@ lookupType items (Ident ident) =
...
@@ -207,7 +209,10 @@ lookupType items (Ident ident) =
findType
(
MIDecl
(
Variable
_
t
x
[]
Nothing
))
=
findType
(
MIDecl
(
Variable
_
t
x
[]
Nothing
))
=
if
x
==
ident
then
Just
t
else
Nothing
if
x
==
ident
then
Just
t
else
Nothing
findType
_
=
Nothing
findType
_
=
Nothing
lookupType
_
expr
=
error
$
"lookupType on fancy expr: "
++
show
expr
lookupType
_
expr
=
-- TODO: Add support for non-Ident modport expressions.
error
$
"interface conversion does not support modport expressions that "
++
" are not identifiers: "
++
show
expr
-- convert an interface instantiation into a series of equivalent module items
-- convert an interface instantiation into a series of equivalent module items
inlineInterface
::
Interface
->
(
Identifier
,
[
PortBinding
])
->
[
ModuleItem
]
inlineInterface
::
Interface
->
(
Identifier
,
[
PortBinding
])
->
[
ModuleItem
]
...
...
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