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
bbb46946
Commit
bbb46946
authored
Jul 23, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix typing bit and part selects
parent
359a3de9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
5 deletions
+41
-5
src/Convert/Struct.hs
+16
-5
test/basic/integer_array.sv
+12
-0
test/basic/integer_array.v
+13
-0
No files found.
src/Convert/Struct.hs
View file @
bbb46946
...
@@ -163,6 +163,17 @@ dropInnerTypeRange t =
...
@@ -163,6 +163,17 @@ dropInnerTypeRange t =
(
_
,
[]
)
->
unknownType
(
_
,
[]
)
->
unknownType
(
tf
,
rs
)
->
tf
$
tail
rs
(
tf
,
rs
)
->
tf
$
tail
rs
-- produces the type of the given part select, if possible
replaceInnerTypeRange
::
PartSelectMode
->
Range
->
Type
->
Type
replaceInnerTypeRange
NonIndexed
r
t
=
case
typeRanges
t
of
(
_
,
[]
)
->
unknownType
(
tf
,
rs
)
->
tf
$
r
:
tail
rs
replaceInnerTypeRange
IndexedPlus
r
t
=
replaceInnerTypeRange
NonIndexed
(
snd
r
,
RawNum
1
)
t
replaceInnerTypeRange
IndexedMinus
r
t
=
replaceInnerTypeRange
NonIndexed
(
snd
r
,
RawNum
1
)
t
unknownType
::
Type
unknownType
::
Type
unknownType
=
Implicit
Unspecified
[]
unknownType
=
Implicit
Unspecified
[]
...
@@ -341,9 +352,9 @@ convertSubExpr scopes (Range (Dot e x) NonIndexed rOuter) =
...
@@ -341,9 +352,9 @@ convertSubExpr scopes (Range (Dot e x) NonIndexed rOuter) =
if
isntStruct
subExprType
then
if
isntStruct
subExprType
then
fallbackType
scopes
orig'
fallbackType
scopes
orig'
else
if
structIsntReady
subExprType
then
else
if
structIsntReady
subExprType
then
(
dropInnerTypeRange
fieldType
,
orig'
)
(
replaceInnerTypeRange
NonIndexed
rOuter
fieldType
,
orig'
)
else
else
(
dropInnerTypeRange
fieldType
,
undotted
)
(
replaceInnerTypeRange
NonIndexed
rOuter
fieldType
,
undotted
)
where
where
(
subExprType
,
e'
)
=
convertSubExpr
scopes
e
(
subExprType
,
e'
)
=
convertSubExpr
scopes
e
orig'
=
Range
(
Dot
e'
x
)
NonIndexed
rOuter
orig'
=
Range
(
Dot
e'
x
)
NonIndexed
rOuter
...
@@ -359,9 +370,9 @@ convertSubExpr scopes (Range (Dot e x) mode (baseO, lenO)) =
...
@@ -359,9 +370,9 @@ convertSubExpr scopes (Range (Dot e x) mode (baseO, lenO)) =
if
isntStruct
subExprType
then
if
isntStruct
subExprType
then
fallbackType
scopes
orig'
fallbackType
scopes
orig'
else
if
structIsntReady
subExprType
then
else
if
structIsntReady
subExprType
then
(
dropInnerTypeRange
fieldType
,
orig'
)
(
replaceInnerTypeRange
mode
(
baseO
,
lenO
)
fieldType
,
orig'
)
else
else
(
dropInnerTypeRange
fieldType
,
undotted
)
(
replaceInnerTypeRange
mode
(
baseO
,
lenO
)
fieldType
,
undotted
)
where
where
(
subExprType
,
e'
)
=
convertSubExpr
scopes
e
(
subExprType
,
e'
)
=
convertSubExpr
scopes
e
orig'
=
Range
(
Dot
e'
x
)
mode
(
baseO
,
lenO
)
orig'
=
Range
(
Dot
e'
x
)
mode
(
baseO
,
lenO
)
...
@@ -378,7 +389,7 @@ convertSubExpr scopes (Range (Dot e x) mode (baseO, lenO)) =
...
@@ -378,7 +389,7 @@ convertSubExpr scopes (Range (Dot e x) mode (baseO, lenO)) =
undotted
=
Range
e'
mode
(
base
,
lenO
)
undotted
=
Range
e'
mode
(
base
,
lenO
)
one
=
RawNum
1
one
=
RawNum
1
convertSubExpr
scopes
(
Range
e
mode
r
)
=
convertSubExpr
scopes
(
Range
e
mode
r
)
=
(
dropInnerTypeRange
t
,
Range
e'
mode
r
)
(
replaceInnerTypeRange
mode
r
t
,
Range
e'
mode
r
)
where
(
t
,
e'
)
=
convertSubExpr
scopes
e
where
(
t
,
e'
)
=
convertSubExpr
scopes
e
convertSubExpr
scopes
(
Bit
(
Dot
e
x
)
i
)
=
convertSubExpr
scopes
(
Bit
(
Dot
e
x
)
i
)
=
if
isntStruct
subExprType
then
if
isntStruct
subExprType
then
...
...
test/basic/integer_array.sv
View file @
bbb46946
...
@@ -28,4 +28,16 @@ module top;
...
@@ -28,4 +28,16 @@ module top;
$
display
(
"%b %b %b"
,
P
,
P
[
0
]
,
P
[
1
])
;
$
display
(
"%b %b %b"
,
P
,
P
[
0
]
,
P
[
1
])
;
$
display
(
"%b %b %b"
,
Q
,
Q
[
0
]
,
Q
[
1
])
;
$
display
(
"%b %b %b"
,
Q
,
Q
[
0
]
,
Q
[
1
])
;
end
end
initial
begin
logic
[
1
:
0
][
0
:
1
][
7
:
0
]
a
;
a
[
0
][
0
:
1
]
=
'
{
default
:
1
};
$
display
(
"a: %b"
,
a
)
;
a
[
1
][
0
+:
1
]
=
'
{
default
:
2
};
$
display
(
"a: %b"
,
a
)
;
a
[
1
][
1
-:
1
]
=
'
{
default
:
3
};
$
display
(
"a: %b"
,
a
)
;
a
[
1
][
1
][
3
+:
4
]
=
'
{
default
:
'1
};
$
display
(
"a: %b"
,
a
)
;
end
endmodule
endmodule
test/basic/integer_array.v
View file @
bbb46946
...
@@ -26,4 +26,17 @@ module top;
...
@@ -26,4 +26,17 @@ module top;
$
display
(
"%b %b %b"
,
P
,
P
[
1
:
0
]
,
P
[
3
:
2
])
;
$
display
(
"%b %b %b"
,
P
,
P
[
1
:
0
]
,
P
[
3
:
2
])
;
$
display
(
"%b %b %b"
,
Q
,
Q
[
1
:
0
]
,
Q
[
3
:
2
])
;
$
display
(
"%b %b %b"
,
Q
,
Q
[
1
:
0
]
,
Q
[
3
:
2
])
;
end
end
initial
begin
:
block
reg
[
31
:
0
]
a
;
a
[
7
:
0
]
=
1
;
a
[
15
:
8
]
=
1
;
$
display
(
"a: %b"
,
a
)
;
a
[
31
:
24
]
=
2
;
$
display
(
"a: %b"
,
a
)
;
a
[
23
:
16
]
=
3
;
$
display
(
"a: %b"
,
a
)
;
a
[
23
:
19
]
=
4'b1111
;
$
display
(
"a: %b"
,
a
)
;
end
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