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
b48ca0bb
Commit
b48ca0bb
authored
Aug 28, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added package enum item name resolution (resolves #16)
parent
fabdc084
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletions
+33
-1
src/Convert/Package.hs
+16
-1
test/basic/package_enum.sv
+12
-0
test/basic/package_enum.v
+5
-0
No files found.
src/Convert/Package.hs
View file @
b48ca0bb
...
...
@@ -64,7 +64,18 @@ convertFile packages ast =
globalPackageItems
::
Identifier
->
PackageItems
->
[
PackageItem
]
globalPackageItems
name
items
=
map
(
prefixPackageItem
name
(
Map
.
keysSet
items
))
(
Map
.
elems
items
)
map
(
prefixPackageItem
name
(
packageItemIdents
items
))
(
Map
.
elems
items
)
packageItemIdents
::
PackageItems
->
Idents
packageItemIdents
items
=
Set
.
union
(
Map
.
keysSet
items
)
(
Set
.
unions
$
map
packageItemSubIdents
$
Map
.
elems
items
)
where
packageItemSubIdents
::
PackageItem
->
Idents
packageItemSubIdents
(
Typedef
(
Enum
_
enumItems
_
)
_
)
=
Set
.
fromList
$
map
fst
enumItems
packageItemSubIdents
_
=
Set
.
empty
prefixPackageItem
::
Identifier
->
Idents
->
PackageItem
->
PackageItem
prefixPackageItem
packageName
idents
item
=
...
...
@@ -84,6 +95,10 @@ prefixPackageItem packageName idents item =
Decl
(
Localparam
a
x
b
)
->
Decl
(
Localparam
a
(
prefix
x
)
b
)
other
->
other
convertType
(
Alias
Nothing
x
rs
)
=
Alias
Nothing
(
prefix
x
)
rs
convertType
(
Enum
mt
items
rs
)
=
Enum
mt
items'
rs
where
items'
=
map
prefixItem
items
prefixItem
(
x
,
me
)
=
(
prefix
x
,
me
)
convertType
other
=
other
convertExpr
(
Ident
x
)
=
Ident
$
prefix
x
convertExpr
other
=
other
...
...
test/basic/package_enum.sv
0 → 100644
View file @
b48ca0bb
package
foo_pkg
;
typedef
enum
logic
[
2
:
0
]
{
AccessAck
=
3'd0
,
AccessAckData
=
3'd1
}
inp_t
;
endpackage
module
top
;
foo_pkg
::
inp_t
test
;
assign
test
=
foo_pkg
::
AccessAck
;
initial
$
display
(
test
)
;
endmodule
test/basic/package_enum.v
0 → 100644
View file @
b48ca0bb
module
top
;
wire
[
2
:
0
]
test
;
assign
test
=
3'd0
;
initial
$
display
(
test
)
;
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