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
f3814761
Commit
f3814761
authored
Apr 13, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support nested interfaces
parent
c5ef5ea9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
4 deletions
+44
-4
src/Convert/Interface.hs
+16
-4
test/basic/interface_nested.sv
+15
-0
test/basic/interface_nested.v
+13
-0
No files found.
src/Convert/Interface.hs
View file @
f3814761
...
@@ -22,11 +22,19 @@ type Modules = Map.Map Identifier [(Identifier, Type)]
...
@@ -22,11 +22,19 @@ type Modules = Map.Map Identifier [(Identifier, Type)]
convert
::
[
AST
]
->
[
AST
]
convert
::
[
AST
]
->
[
AST
]
convert
=
convert
=
traverseFiles
(
collectDescriptionsM
collectDesc
)
converter
map
(
filter
$
not
.
isInterface
)
.
repeatedConverter
where
where
converter
(
interfaces
,
modules
)
=
repeatedConverter
::
[
AST
]
->
[
AST
]
filter
(
not
.
isInterface
)
.
repeatedConverter
files
=
map
(
convertDescription
interfaces
modules
)
if
files
==
files'
then
files
else
repeatedConverter
files'
where
files'
=
traverseFiles
(
collectDescriptionsM
collectDesc
)
(
map
.
uncurry
convertDescription
)
files
-- we can only collect/map non-extern interfaces
-- we can only collect/map non-extern interfaces
collectDesc
::
Description
->
Writer
(
Interfaces
,
Modules
)
()
collectDesc
::
Description
->
Writer
(
Interfaces
,
Modules
)
()
collectDesc
(
orig
@
(
Part
_
False
kw
_
name
ports
items
))
=
do
collectDesc
(
orig
@
(
Part
_
False
kw
_
name
ports
items
))
=
do
...
@@ -216,8 +224,11 @@ prefixModuleItems prefix =
...
@@ -216,8 +224,11 @@ prefixModuleItems prefix =
prefixLHS
::
LHS
->
LHS
prefixLHS
::
LHS
->
LHS
prefixLHS
(
LHSIdent
x
)
=
LHSIdent
(
prefix
x
)
prefixLHS
(
LHSIdent
x
)
=
LHSIdent
(
prefix
x
)
prefixLHS
other
=
other
prefixLHS
other
=
other
prefixOtherItem
::
ModuleItem
->
ModuleItem
prefixOtherItem
(
MIPackageItem
item
)
=
prefixOtherItem
(
MIPackageItem
item
)
=
MIPackageItem
$
prefixPackageItem
prefix
item
MIPackageItem
$
prefixPackageItem
prefix
item
prefixOtherItem
(
Instance
m
params
name
rs
ports
)
=
Instance
m
params
(
prefix
name
)
rs
ports
prefixOtherItem
(
Genvar
x
)
=
Genvar
$
prefix
x
prefixOtherItem
(
Genvar
x
)
=
Genvar
$
prefix
x
prefixOtherItem
other
=
other
prefixOtherItem
other
=
other
...
@@ -235,6 +246,7 @@ prefixPackageItem _ other = other
...
@@ -235,6 +246,7 @@ prefixPackageItem _ other = other
collectIdentsM
::
ModuleItem
->
Writer
(
Set
.
Set
Identifier
)
()
collectIdentsM
::
ModuleItem
->
Writer
(
Set
.
Set
Identifier
)
()
collectIdentsM
(
MIPackageItem
(
Function
_
_
x
_
_
))
=
tell
$
Set
.
singleton
x
collectIdentsM
(
MIPackageItem
(
Function
_
_
x
_
_
))
=
tell
$
Set
.
singleton
x
collectIdentsM
(
MIPackageItem
(
Task
_
x
_
_
))
=
tell
$
Set
.
singleton
x
collectIdentsM
(
MIPackageItem
(
Task
_
x
_
_
))
=
tell
$
Set
.
singleton
x
collectIdentsM
(
Instance
_
_
x
_
_
)
=
tell
$
Set
.
singleton
x
collectIdentsM
(
Genvar
x
)
=
tell
$
Set
.
singleton
x
collectIdentsM
(
Genvar
x
)
=
tell
$
Set
.
singleton
x
collectIdentsM
item
=
collectDeclsM
collectDecl
item
collectIdentsM
item
=
collectDeclsM
collectDecl
item
where
where
...
...
test/basic/interface_nested.sv
0 → 100644
View file @
f3814761
module
top
;
logic
x
=
1
;
foo
f
(
x
)
;
endmodule
interface
foo
(
input
logic
x
)
;
bar
a
(
x
)
;
bar
b
(
~
x
)
;
endinterface
interface
bar
(
input
logic
x
)
;
initial
begin
$
display
(
"bar got %b"
,
x
)
;
end
endinterface
test/basic/interface_nested.v
0 → 100644
View file @
f3814761
module
top
;
wire
x
,
f_x
;
wire
f_a_x
,
f_b_x
;
assign
x
=
1
;
assign
f_x
=
x
;
assign
f_a_x
=
x
;
assign
f_b_x
=
~
x
;
initial
begin
$
display
(
"bar got %b"
,
f_a_x
)
;
$
display
(
"bar got %b"
,
f_b_x
)
;
end
endmodule
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