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
5b063ec9
Commit
5b063ec9
authored
Jul 10, 2021
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pack task and function arguments
parent
2f712842
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
6 deletions
+64
-6
src/Convert/UnpackedArray.hs
+19
-6
test/core/tf_unpacked_input.sv
+23
-0
test/core/tf_unpacked_input.v
+22
-0
No files found.
src/Convert/UnpackedArray.hs
View file @
5b063ec9
...
...
@@ -37,13 +37,14 @@ convertDescription other = other
-- tracks multi-dimensional unpacked array declarations
traverseDeclM
::
[
Identifier
]
->
Decl
->
ST
Decl
traverseDeclM
_
(
decl
@
(
Variable
_
_
_
[]
_
))
=
return
decl
traverseDeclM
ports
(
decl
@
(
Variable
_
_
x
_
e
))
=
do
traverseDeclM
_
(
decl
@
(
Variable
_
_
_
[]
e
))
=
traverseExprArgsM
e
>>
return
decl
traverseDeclM
ports
(
decl
@
(
Variable
dir
_
x
_
e
))
=
do
insertElem
x
decl
if
elem
x
ports
||
e
/=
Nil
if
dir
/=
Local
||
elem
x
ports
||
e
/=
Nil
then
flatUsageM
x
else
return
()
return
decl
traverseExprArgsM
e
>>
return
decl
traverseDeclM
ports
decl
@
Net
{}
=
traverseNetAsVarM
(
traverseDeclM
ports
)
decl
traverseDeclM
_
other
=
return
other
...
...
@@ -89,12 +90,24 @@ traverseStmtM :: Stmt -> ST Stmt
traverseStmtM
=
traverseStmtLHSsM
traverseLHSM
>=>
traverseStmtExprsM
traverseExprM
>=>
traverseStmtAsgnsM
traverseAsgnM
traverseStmtAsgnsM
traverseAsgnM
>=>
traverseStmtArgsM
traverseStmtArgsM
::
Stmt
->
ST
Stmt
traverseStmtArgsM
stmt
@
(
Subroutine
_
(
Args
args
[]
))
=
mapM_
flatUsageM
args
>>
return
stmt
traverseStmtArgsM
stmt
=
return
stmt
traverseExprM
::
Expr
->
ST
Expr
traverseExprM
(
Range
x
mode
i
)
=
flatUsageM
x
>>
return
(
Range
x
mode
i
)
traverseExprM
other
=
return
other
traverseExprM
expr
=
traverseExprArgsM
expr
traverseExprArgsM
::
Expr
->
ST
Expr
traverseExprArgsM
expr
@
(
Call
_
(
Args
args
[]
))
=
mapM_
(
traverseExprArgsM
>>
flatUsageM
)
args
>>
return
expr
traverseExprArgsM
expr
=
traverseSinglyNestedExprsM
traverseExprArgsM
expr
traverseLHSM
::
LHS
->
ST
LHS
traverseLHSM
x
=
flatUsageM
x
>>
return
x
...
...
test/core/tf_unpacked_input.sv
0 → 100644
View file @
5b063ec9
module
top
;
function
automatic
[
31
:
0
]
flatten
;
input
byte
inp
[
4
]
;
return
{
inp
[
0
]
,
inp
[
1
]
,
inp
[
2
]
,
inp
[
3
]
};
endfunction
task
dump
;
input
byte
inp
[
4
]
;
$
display
(
"t(%b)"
,
{
inp
[
0
]
,
inp
[
1
]
,
inp
[
2
]
,
inp
[
3
]
}
)
;
endtask
byte
arr1
[
4
]
;
byte
arr2
[
4
]
;
wire
integer
unsigned
flat
=
flatten
(
arr1
)
|
1'b1
;
initial
begin
#
1
arr1
[
0
]
=
1
;
#
1
arr1
[
1
]
=
3
;
#
1
arr1
[
2
]
=
9
;
#
1
arr1
[
3
]
=
7
;
#
1
arr2
[
0
]
=
1
;
dump
(
arr2
)
;
#
1
arr2
[
1
]
=
3
;
dump
(
arr2
)
;
#
1
arr2
[
2
]
=
9
;
dump
(
arr2
)
;
#
1
arr2
[
3
]
=
7
;
dump
(
arr2
)
;
end
endmodule
test/core/tf_unpacked_input.v
0 → 100644
View file @
5b063ec9
module
top
;
function
automatic
[
31
:
0
]
flatten
;
input
[
0
:
3
][
7
:
0
]
inp
;
flatten
=
{
inp
[
0
]
,
inp
[
1
]
,
inp
[
2
]
,
inp
[
3
]
};
endfunction
task
dump
;
input
[
0
:
3
][
7
:
0
]
inp
;
$
display
(
"t(%b)"
,
{
inp
[
0
]
,
inp
[
1
]
,
inp
[
2
]
,
inp
[
3
]
}
)
;
endtask
reg
[
0
:
3
][
7
:
0
]
arr1
,
arr2
;
wire
[
31
:
0
]
flat
=
flatten
(
arr1
)
|
1'b1
;
initial
begin
#
1
arr1
[
0
]
=
1
;
#
1
arr1
[
1
]
=
3
;
#
1
arr1
[
2
]
=
9
;
#
1
arr1
[
3
]
=
7
;
#
1
arr2
[
0
]
=
1
;
dump
(
arr2
)
;
#
1
arr2
[
1
]
=
3
;
dump
(
arr2
)
;
#
1
arr2
[
2
]
=
9
;
dump
(
arr2
)
;
#
1
arr2
[
3
]
=
7
;
dump
(
arr2
)
;
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