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
a47afa96
Commit
a47afa96
authored
Jun 05, 2021
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't force int types to be regs
parent
ecaaec9c
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
19 deletions
+49
-19
src/Language/SystemVerilog/AST/Type.hs
+1
-1
test/basic/input_int.sv
+6
-0
test/basic/input_int.v
+6
-0
test/basic/input_int_tb.v
+11
-0
test/basic/interface_based_typedef.sv
+6
-2
test/basic/interface_based_typedef.v
+2
-2
test/basic/typeof_signed.sv
+6
-3
test/basic/typeof_signed.v
+11
-11
No files found.
src/Language/SystemVerilog/AST/Type.hs
View file @
a47afa96
...
...
@@ -144,7 +144,7 @@ elaborateIntegerAtom other = other
-- size; if not unspecified, the first signing overrides the second
baseIntType
::
Signing
->
Signing
->
Int
->
Type
baseIntType
sgOverride
sgBase
size
=
IntegerVector
T
Reg
sg
[(
RawNum
hi
,
RawNum
0
)]
IntegerVector
T
Logic
sg
[(
RawNum
hi
,
RawNum
0
)]
where
hi
=
fromIntegral
$
size
-
1
sg
=
if
sgOverride
/=
Unspecified
...
...
test/basic/input_int.sv
0 → 100644
View file @
a47afa96
module
Example
(
input
int
inp
,
output
int
out
)
;
assign
out
=
inp
*
2
;
endmodule
test/basic/input_int.v
0 → 100644
View file @
a47afa96
module
Example
(
input
wire
signed
[
31
:
0
]
inp
,
output
wire
signed
[
31
:
0
]
out
)
;
assign
out
=
inp
*
2
;
endmodule
test/basic/input_int_tb.v
0 → 100644
View file @
a47afa96
module
top
;
reg
signed
[
31
:
0
]
inp
;
wire
signed
[
31
:
0
]
out
;
Example
e
(
inp
,
out
)
;
initial
begin
#
1
inp
=
1
;
#
1
inp
=
5
;
#
1
inp
=
10
;
#
1
inp
=
7
;
end
endmodule
test/basic/interface_based_typedef.sv
View file @
a47afa96
...
...
@@ -7,8 +7,12 @@ module sub(intf_i p, intf_i q [2]);
typedef
q
[
0
]
.
data_t
q_data_t
;
// interface based typedef
p_data_t
p_data
;
q_data_t
q_data
;
initial
$
display
(
"p %0d %b"
,
$
bits
(
p_data
)
,
p_data
)
;
initial
$
display
(
"q %0d %b"
,
$
bits
(
q_data
)
,
q_data
)
;
initial
begin
p_data
=
1
;
q_data
=
2
;
$
display
(
"p %0d %b"
,
$
bits
(
p_data
)
,
p_data
)
;
$
display
(
"q %0d %b"
,
$
bits
(
q_data
)
,
q_data
)
;
end
endmodule
module
top
;
...
...
test/basic/interface_based_typedef.v
View file @
a47afa96
module
top
;
initial
$
display
(
"p %0d %b"
,
32
,
32'
bx
)
;
initial
$
display
(
"q %0d %b"
,
32
,
32'
bx
)
;
initial
$
display
(
"p %0d %b"
,
32
,
32'
d1
)
;
initial
$
display
(
"q %0d %b"
,
32
,
32'
d2
)
;
endmodule
test/basic/typeof_signed.sv
View file @
a47afa96
...
...
@@ -14,9 +14,12 @@
`define
ASSERT_UNSIGNED
(
expr
)
`
ASSERT_SIGNEDNESS
(
expr
,
unsigned
,
0
)
`define
MAKE_PRIM
(
typ
)
\
typ typ
``
_unspecified
=
1
;
\
typ unsigned typ
``
_unsigned
=
1
;
\
typ signed typ
``
_signed
=
1
;
\
typ typ
``
_unspecified
;
\
typ unsigned typ
``
_unsigned
;
\
typ signed typ
``
_signed
;
\
initial typ
``
_unspecified
=
1
;
\
initial typ
``
_unsigned
=
1
;
\
initial typ
``
_signed
=
1
;
\
`
ASSERT_SIGNED
(
typ
``
_signed
)
\
`
ASSERT_UNSIGNED
(
typ
``
_unsigned
)
...
...
test/basic/typeof_signed.v
View file @
a47afa96
`define
MAKE_PRIM
(
typ
,
base
,
size
)
\
base
[
size
-
1
:
0
]
typ
`
`_unspecified
=
1
;
\
base
[
size
-
1
:
0
]
typ
`
`_unsigned
=
1
;
\
base
signed
[
size
-
1
:
0
]
typ
`
`_signed
=
1
;
`define
MAKE_PRIM
(
typ
,
size
)
\
reg
[
size
-
1
:
0
]
typ
`
`_unspecified
=
1
;
\
reg
[
size
-
1
:
0
]
typ
`
`_unsigned
=
1
;
\
reg
signed
[
size
-
1
:
0
]
typ
`
`_signed
=
1
;
module
top
;
wire
signed
x
;
...
...
@@ -14,17 +14,17 @@ module top;
assign
w
=
z
;
initial
#
1
$
display
(
"%b %b %b %b"
,
x
,
y
,
z
,
w
)
;
`MAKE_PRIM
(
byte
,
reg
,
8
)
`MAKE_PRIM
(
shortint
,
reg
,
16
)
`MAKE_PRIM
(
int
,
reg
,
32
)
`MAKE_PRIM
(
byte
,
8
)
`MAKE_PRIM
(
shortint
,
16
)
`MAKE_PRIM
(
int
,
32
)
integer
integer_unspecified
=
1
;
reg
[
31
:
0
]
integer_unsigned
=
1
;
integer
integer_signed
=
1
;
`MAKE_PRIM
(
longint
,
reg
,
64
)
`MAKE_PRIM
(
longint
,
64
)
`MAKE_PRIM
(
bit
,
wire
,
1
)
`MAKE_PRIM
(
reg
,
reg
,
1
)
`MAKE_PRIM
(
logic
,
wire
,
1
)
`MAKE_PRIM
(
bit
,
1
)
`MAKE_PRIM
(
reg
,
1
)
`MAKE_PRIM
(
logic
,
1
)
reg
signed
[
5
:
0
]
arr
;
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