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
eb93ba67
Commit
eb93ba67
authored
Jun 06, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integer atom explicit sign cast support
parent
a8346f2f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
5 deletions
+32
-5
src/Convert/SizeCast.hs
+5
-0
src/Language/SystemVerilog/AST/Type.hs
+4
-4
test/basic/cast.sv
+8
-0
test/basic/cast.v
+14
-0
test/lib/functions.sh
+1
-1
No files found.
src/Convert/SizeCast.hs
View file @
eb93ba67
...
...
@@ -162,4 +162,9 @@ typeSigning :: Type -> Maybe Signing
typeSigning
(
Net
_
sg
_
)
=
Just
sg
typeSigning
(
Implicit
sg
_
)
=
Just
sg
typeSigning
(
IntegerVector
_
sg
_
)
=
Just
sg
typeSigning
(
IntegerAtom
t
sg
)
=
Just
$
case
(
sg
,
t
)
of
(
Unspecified
,
TTime
)
->
Unsigned
(
Unspecified
,
_
)
->
Signed
(
_
,
_
)
->
sg
typeSigning
_
=
Nothing
src/Language/SystemVerilog/AST/Type.hs
View file @
eb93ba67
...
...
@@ -120,10 +120,10 @@ nullRange t rs1 =
(
tf
,
rs2
)
=
typeRanges
t'
elaborateIntegerAtom
::
Type
->
Type
elaborateIntegerAtom
(
IntegerAtom
TInt
sg
)
=
baseIntType
sg
Signed
32
elaborateIntegerAtom
(
IntegerAtom
TShortint
sg
)
=
baseIntType
sg
Signed
16
elaborateIntegerAtom
(
IntegerAtom
TLongint
sg
)
=
baseIntType
sg
Signed
64
elaborateIntegerAtom
(
IntegerAtom
TByte
sg
)
=
baseIntType
sg
Unspecifi
ed
8
elaborateIntegerAtom
(
IntegerAtom
TInt
sg
)
=
baseIntType
sg
Signed
32
elaborateIntegerAtom
(
IntegerAtom
TShortint
sg
)
=
baseIntType
sg
Signed
16
elaborateIntegerAtom
(
IntegerAtom
TLongint
sg
)
=
baseIntType
sg
Signed
64
elaborateIntegerAtom
(
IntegerAtom
TByte
sg
)
=
baseIntType
sg
Sign
ed
8
elaborateIntegerAtom
other
=
other
-- makes a integer "compatible" type with the given signing, base signing and
...
...
test/basic/cast.sv
View file @
eb93ba67
...
...
@@ -33,4 +33,12 @@ module top;
$
display
(
"%b"
,
5
'
(
1
'
sb1
))
;
end
parameter
W
=
9
;
initial
begin
byte
i
=
-
1
;
byte
unsigned
j
=
-
1
;
$
display
(
"%b"
,
W
'
(
i
))
;
$
display
(
"%b"
,
W
'
(
j
))
;
end
endmodule
test/basic/cast.v
View file @
eb93ba67
...
...
@@ -36,4 +36,18 @@ module top;
$
display
(
"%b"
,
5
'
sb11111
)
;
end
parameter
W
=
9
;
initial
begin
:
block
reg
signed
[
7
:
0
]
i
;
reg
[
7
:
0
]
j
;
reg
[
8
:
0
]
i_extended
;
reg
[
8
:
0
]
j_extended
;
i
=
-
1
;
j
=
-
1
;
i_extended
=
i
;
j_extended
=
j
;
$
display
(
"%b"
,
i_extended
)
;
$
display
(
"%b"
,
j_extended
)
;
end
endmodule
test/lib/functions.sh
View file @
eb93ba67
...
...
@@ -66,7 +66,7 @@ assertConverts() {
assertFalse
"conversion of
$ac_file
still contains dimension queries"
$?
echo
"
$filtered
"
| egrep
"
\s
(int
\|
bit
\|
logic
\|
byte
\|
struct
\|
enum
\|
longint
\|
shortint)
\s
"
assertFalse
"conversion of
$ac_file
still contains SV types"
$?
echo
"
$filtered
"
|
grep
"[^
$
]
unsigned"
>
/dev/null
echo
"
$filtered
"
|
grep
"[^
\$
a-zA-Z_
]unsigned"
>
/dev/null
assertFalse
"conversion of
$ac_file
still contains unsigned keyword"
$?
}
...
...
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