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
20dc92f6
Commit
20dc92f6
authored
Feb 16, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix typeof integer slices
parent
ad21277e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
4 deletions
+64
-4
src/Convert/TypeOf.hs
+8
-4
test/basic/dimensions.sv
+6
-0
test/basic/dimensions.v
+50
-0
No files found.
src/Convert/TypeOf.hs
View file @
20dc92f6
...
@@ -104,14 +104,18 @@ injectRanges t unpacked = UnpackedType t unpacked
...
@@ -104,14 +104,18 @@ injectRanges t unpacked = UnpackedType t unpacked
-- removes the most significant range of the given type
-- removes the most significant range of the given type
popRange
::
Type
->
Type
popRange
::
Type
->
Type
popRange
(
UnpackedType
t
[
_
])
=
t
popRange
(
UnpackedType
t
[
_
])
=
t
popRange
(
IntegerAtom
TInteger
sg
)
=
IntegerVector
TLogic
sg
[]
popRange
t
=
popRange
t
=
tf
$
tail
rs
tf
rs
where
(
tf
,
rs
)
=
typeRanges
t
where
(
tf
,
_
:
rs
)
=
typeRanges
t
-- replaces the most significant range of the given type
-- replaces the most significant range of the given type
replaceRange
::
Range
->
Type
->
Type
replaceRange
::
Range
->
Type
->
Type
replaceRange
r
(
UnpackedType
t
(
_
:
rs
))
=
replaceRange
r
(
UnpackedType
t
(
_
:
rs
))
=
UnpackedType
t
(
r
:
rs
)
UnpackedType
t
(
r
:
rs
)
replaceRange
r
(
IntegerAtom
TInteger
sg
)
=
IntegerVector
TLogic
sg
[
r
]
replaceRange
r
t
=
replaceRange
r
t
=
tf
$
r
:
tail
rs
tf
(
r
:
rs
)
where
(
tf
,
rs
)
=
typeRanges
t
where
(
tf
,
_
:
rs
)
=
typeRanges
t
test/basic/dimensions.sv
View file @
20dc92f6
...
@@ -14,6 +14,7 @@ module top;
...
@@ -14,6 +14,7 @@ module top;
Word
Ram
[
0
:
9
]
;
Word
Ram
[
0
:
9
]
;
type
(
Ram
)
RamPair
[
2
]
;
type
(
Ram
)
RamPair
[
2
]
;
integer
ints
[
3
:
0
]
;
integer
ints
[
3
:
0
]
;
integer
ints_rev
[
0
:
3
]
;
typedef
struct
packed
{
logic
x
,
y
,
z
;
}
T
;
typedef
struct
packed
{
logic
x
,
y
,
z
;
}
T
;
logic
[$
size
(
T
)
-
1
:
0
]
foo
;
logic
[$
size
(
T
)
-
1
:
0
]
foo
;
typedef
byte
unpacked_t
[
3
]
;
typedef
byte
unpacked_t
[
3
]
;
...
@@ -35,7 +36,12 @@ module top;
...
@@ -35,7 +36,12 @@ module top;
`EXHAUST
(
bit
)
;
`EXHAUST
(
bit
)
;
`EXHAUST
(
byte
)
;
`EXHAUST
(
byte
)
;
`EXHAUST
(
ints
)
;
`EXHAUST
(
ints
)
;
`EXHAUST
(
ints_rev
)
;
`EXHAUST
(
unpacked_t
)
;
`EXHAUST
(
unpacked_t
)
;
`EXHAUST
(
unpacked
)
;
`EXHAUST
(
unpacked
)
;
`EXHAUST
(
type
(
foo
[
3
:
0
]))
;
`EXHAUST
(
type
(
ints
[
2
][
3
:
0
]))
;
`EXHAUST
(
type
(
ints
[
1
:
0
]))
;
`EXHAUST
(
type
(
ints_rev
[
0
:
1
]))
;
end
end
endmodule
endmodule
test/basic/dimensions.v
View file @
20dc92f6
...
@@ -115,6 +115,16 @@ module top;
...
@@ -115,6 +115,16 @@ module top;
$
display
(
1
)
;
$
display
(
1
)
;
$
display
(
128
)
;
$
display
(
128
)
;
$
display
(
4
,
4
,
32
)
;
$
display
(
0
,
0
,
31
)
;
$
display
(
3
,
3
,
0
)
;
$
display
(
3
,
3
,
31
)
;
$
display
(
0
,
0
,
0
)
;
$
display
(
-
1
,
-
1
,
1
)
;
$
display
(
2
)
;
$
display
(
1
)
;
$
display
(
128
)
;
$
display
(
3
,
3
,
8
)
;
$
display
(
3
,
3
,
8
)
;
$
display
(
0
,
0
,
7
)
;
$
display
(
0
,
0
,
7
)
;
$
display
(
2
,
2
,
0
)
;
$
display
(
2
,
2
,
0
)
;
...
@@ -135,5 +145,45 @@ module top;
...
@@ -135,5 +145,45 @@ module top;
$
display
(
1
)
;
$
display
(
1
)
;
$
display
(
24
)
;
$
display
(
24
)
;
$
display
(
4
,
4
,
1'bx
)
;
$
display
(
3
,
3
,
1'bx
)
;
$
display
(
0
,
0
,
1'bx
)
;
$
display
(
3
,
3
,
1'bx
)
;
$
display
(
0
,
0
,
1'bx
)
;
$
display
(
1
,
1
,
1'bx
)
;
$
display
(
1
)
;
$
display
(
0
)
;
$
display
(
4
)
;
$
display
(
4
,
4
,
1'bx
)
;
$
display
(
3
,
3
,
1'bx
)
;
$
display
(
0
,
0
,
1'bx
)
;
$
display
(
3
,
3
,
1'bx
)
;
$
display
(
0
,
0
,
1'bx
)
;
$
display
(
1
,
1
,
1'bx
)
;
$
display
(
1
)
;
$
display
(
0
)
;
$
display
(
4
)
;
$
display
(
2
,
2
,
32
)
;
$
display
(
1
,
1
,
31
)
;
$
display
(
0
,
0
,
0
)
;
$
display
(
1
,
1
,
31
)
;
$
display
(
0
,
0
,
0
)
;
$
display
(
1
,
1
,
1
)
;
$
display
(
2
)
;
$
display
(
1
)
;
$
display
(
64
)
;
$
display
(
2
,
2
,
32
)
;
$
display
(
0
,
0
,
31
)
;
$
display
(
1
,
1
,
0
)
;
$
display
(
1
,
1
,
31
)
;
$
display
(
0
,
0
,
0
)
;
$
display
(
-
1
,
-
1
,
1
)
;
$
display
(
2
)
;
$
display
(
1
)
;
$
display
(
64
)
;
end
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