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
355b62da
Commit
355b62da
authored
Jun 06, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pack arrays in ternary expressions assigned to other arrays
parent
5b4fdfe7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
4 deletions
+32
-4
src/Convert/UnpackedArray.hs
+18
-4
test/basic/array.sv
+7
-0
test/basic/array.v
+7
-0
No files found.
src/Convert/UnpackedArray.hs
View file @
355b62da
...
@@ -3,12 +3,13 @@
...
@@ -3,12 +3,13 @@
-
-
- Conversion for any unpacked array which must be packed because it is: A) a
- Conversion for any unpacked array which must be packed because it is: A) a
- port; B) is bound to a port; C) is assigned a value in a single assignment;
- port; B) is bound to a port; C) is assigned a value in a single assignment;
- or D) is assigned to an unpacked array which itself mus be packed.
- or D) is assigned to an unpacked array which itself mus
t
be packed.
-
-
- The scoped nature of declarations makes this challenging. While scoping is
- The scoped nature of declarations makes this challenging. While scoping is
- obeyed in general, any of a set of *equivalent* declarations within a module
- obeyed in general, if any of a set of *equivalent* declarations within a
- is packed, all of the declarations are packed. This is because we only record
- module is packed, all of the declarations are packed. This is because we only
- the declaration that needs to be packed when a relevant usage is encountered.
- record the declaration that needs to be packed when a relevant usage is
- encountered.
-}
-}
module
Convert.UnpackedArray
(
convert
)
where
module
Convert.UnpackedArray
(
convert
)
where
...
@@ -97,6 +98,19 @@ traverseLHSM (LHSIdent x) = do
...
@@ -97,6 +98,19 @@ traverseLHSM (LHSIdent x) = do
traverseLHSM
other
=
return
other
traverseLHSM
other
=
return
other
traverseAsgnM
::
(
LHS
,
Expr
)
->
ST
(
LHS
,
Expr
)
traverseAsgnM
::
(
LHS
,
Expr
)
->
ST
(
LHS
,
Expr
)
traverseAsgnM
(
LHSIdent
x
,
Mux
cond
(
Ident
y
)
(
Ident
z
))
=
do
flatUsageM
x
flatUsageM
y
flatUsageM
z
return
(
LHSIdent
x
,
Mux
cond
(
Ident
y
)
(
Ident
z
))
traverseAsgnM
(
LHSIdent
x
,
Mux
cond
y
(
Ident
z
))
=
do
flatUsageM
x
flatUsageM
z
return
(
LHSIdent
x
,
Mux
cond
y
(
Ident
z
))
traverseAsgnM
(
LHSIdent
x
,
Mux
cond
(
Ident
y
)
z
)
=
do
flatUsageM
x
flatUsageM
y
return
(
LHSIdent
x
,
Mux
cond
(
Ident
y
)
z
)
traverseAsgnM
(
LHSIdent
x
,
Ident
y
)
=
do
traverseAsgnM
(
LHSIdent
x
,
Ident
y
)
=
do
flatUsageM
x
flatUsageM
x
flatUsageM
y
flatUsageM
y
...
...
test/basic/array.sv
View file @
355b62da
...
@@ -2,4 +2,11 @@ module top;
...
@@ -2,4 +2,11 @@ module top;
logic
[
1
:
0
]
a
[
3
]
;
logic
[
1
:
0
]
a
[
3
]
;
logic
[
1
:
0
]
b
[
3
]
;
logic
[
1
:
0
]
b
[
3
]
;
always_comb
a
=
b
;
always_comb
a
=
b
;
logic
x
;
logic
[
1
:
0
]
c
[
3
]
;
logic
[
1
:
0
]
d
[
3
]
;
logic
[
1
:
0
]
e
[
3
]
;
initial
x
=
0
;
assign
c
=
x
?
d
:
e
;
endmodule
endmodule
test/basic/array.v
View file @
355b62da
...
@@ -2,4 +2,11 @@ module top;
...
@@ -2,4 +2,11 @@ module top;
reg
[
5
:
0
]
a
;
reg
[
5
:
0
]
a
;
wire
[
5
:
0
]
b
;
wire
[
5
:
0
]
b
;
always
@
(
*
)
a
=
b
;
always
@
(
*
)
a
=
b
;
reg
x
;
wire
[
5
:
0
]
c
;
wire
[
5
:
0
]
d
;
wire
[
5
:
0
]
e
;
initial
x
=
0
;
assign
c
=
x
?
d
:
e
;
endmodule
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