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
682620b2
Commit
682620b2
authored
Jun 13, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
struct conversion includes exprs in decls
parent
3baa9cba
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
src/Convert/Struct.hs
+7
-1
test/basic/package_typedef.sv
+10
-0
test/basic/package_typedef.v
+6
-1
No files found.
src/Convert/Struct.hs
View file @
682620b2
...
...
@@ -31,7 +31,7 @@ convertDescription (description @ Part{}) =
Part
attrs
extern
kw
lifetime
name
ports
(
items
++
funcs
)
where
description'
@
(
Part
attrs
extern
kw
lifetime
name
ports
items
)
=
scopedConversion
(
traverseDeclM
structs
)
traverseModuleItemM
scopedConversion
traverseDeclM'
traverseModuleItemM
traverseStmtM
tfArgTypes
description
-- collect information about this description
structs
=
execWriter
$
collectModuleItemsM
...
...
@@ -45,6 +45,12 @@ convertDescription (description @ Part{}) =
funcs
=
map
packerFn
$
filter
isNeeded
$
Map
.
keys
structs
isNeeded
tf
=
Set
.
member
(
packerFnName
tf
)
calledPackedFuncs
-- helpers for the scoped traversal
traverseDeclM'
::
Decl
->
State
Types
Decl
traverseDeclM'
decl
=
do
decl'
<-
traverseDeclM
structs
decl
res
<-
traverseModuleItemM
$
MIPackageItem
$
Decl
decl'
let
MIPackageItem
(
Decl
decl''
)
=
res
return
decl''
traverseModuleItemM
::
ModuleItem
->
State
Types
ModuleItem
traverseModuleItemM
item
=
traverseLHSsM
traverseLHSM
item
>>=
...
...
test/basic/package_typedef.sv
View file @
682620b2
...
...
@@ -5,10 +5,20 @@ endpackage
package
foo_pkg
;
typedef
struct
packed
{
logic
valid
;
logic
value
;
}
mask_t
;
typedef
struct
packed
{
logic
valid
;
logic
[
top_pkg
::
AW
-
1
:
0
]
user
;
mask_t
mask
;
}
boo_t
;
endpackage
module
top
;
foo_pkg
::
boo_t
foo
;
assign
foo
=
19'b110_01001000_01110100
;
wire
[
7
:
0
]
bar
;
parameter
FLAG
=
1
;
assign
bar
=
FLAG
?
foo
.
user
[
0
+:
8
]
:
'1
;
endmodule
test/basic/package_typedef.v
View file @
682620b2
module
top
;
localparam
AW
=
16
;
wire
[
16
:
0
]
foo
;
wire
[
AW
+
2
:
0
]
foo
;
assign
foo
=
19'b110_01001000_01110100
;
wire
[
7
:
0
]
bar
;
parameter
FLAG
=
1
;
assign
bar
=
FLAG
?
foo
[
2
+:
8
]
:
8'hFF
;
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