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
5345a72c
Commit
5345a72c
authored
Jul 25, 2021
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
elaborate `wire integer` to `wire signed [31:0]`
parent
121fea5a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
9 deletions
+40
-9
src/Convert/IntTypes.hs
+15
-9
test/core/net_base_type.sv
+23
-0
test/core/net_base_type.v
+2
-0
No files found.
src/Convert/IntTypes.hs
View file @
5345a72c
...
@@ -16,12 +16,18 @@ convertModuleItem :: ModuleItem -> ModuleItem
...
@@ -16,12 +16,18 @@ convertModuleItem :: ModuleItem -> ModuleItem
convertModuleItem
=
traverseNodes
convertModuleItem
=
traverseNodes
traverseExpr
traverseDecl
traverseType
traverseLHS
traverseStmt
traverseExpr
traverseDecl
traverseType
traverseLHS
traverseStmt
where
where
traverseDecl
=
traverseDeclNodes
traverseType
traverseExpr
traverseLHS
=
traverseNestedLHSs
$
traverseLHSExprs
traverseExpr
traverseLHS
=
traverseNestedLHSs
$
traverseLHSExprs
traverseExpr
traverseStmt
=
traverseNestedStmts
$
traverseStmt
=
traverseNestedStmts
$
traverseStmtDecls
(
traverseDeclNodes
traverseType
id
)
.
traverseStmtDecls
(
traverseDeclNodes
traverseType
id
)
.
traverseStmtExprs
traverseExpr
traverseStmtExprs
traverseExpr
traverseDecl
::
Decl
->
Decl
traverseDecl
(
Net
d
n
s
t
x
a
e
)
=
traverseDeclNodes
traverseType
traverseExpr
$
Net
d
n
s
(
convertTypeForce
t
)
x
a
e
traverseDecl
decl
=
traverseDeclNodes
traverseType
traverseExpr
decl
traverseType
::
Type
->
Type
traverseType
::
Type
->
Type
traverseType
=
traverseType
=
traverseSinglyNestedTypes
traverseType
.
traverseSinglyNestedTypes
traverseType
.
...
@@ -47,20 +53,20 @@ convertType other = other
...
@@ -47,20 +53,20 @@ convertType other = other
convertStructFields
::
[(
Type
,
Identifier
)]
->
[(
Type
,
Identifier
)]
convertStructFields
::
[(
Type
,
Identifier
)]
->
[(
Type
,
Identifier
)]
convertStructFields
fields
=
convertStructFields
fields
=
zip
(
map
(
convert
StructFieldTyp
e
.
fst
)
fields
)
(
map
snd
fields
)
zip
(
map
(
convert
TypeForc
e
.
fst
)
fields
)
(
map
snd
fields
)
convert
StructFieldTyp
e
::
Type
->
Type
convert
TypeForc
e
::
Type
->
Type
convert
StructFieldTyp
e
(
IntegerAtom
TInteger
sg
)
=
IntegerAtom
TInt
sg
convert
TypeForc
e
(
IntegerAtom
TInteger
sg
)
=
IntegerAtom
TInt
sg
convert
StructFieldTyp
e
t
=
t
convert
TypeForc
e
t
=
t
convertExpr
::
Expr
->
Expr
convertExpr
::
Expr
->
Expr
convertExpr
(
Pattern
items
)
=
convertExpr
(
Pattern
items
)
=
Pattern
$
zip
names
exprs
Pattern
$
zip
names
exprs
where
where
names
=
map
(
convert
PatternTypeOrExpr
.
fst
)
items
names
=
map
(
convert
TypeOrExprForce
.
fst
)
items
exprs
=
map
snd
items
exprs
=
map
snd
items
convertExpr
other
=
other
convertExpr
other
=
other
convert
PatternTypeOrExpr
::
TypeOrExpr
->
TypeOrExpr
convert
TypeOrExprForce
::
TypeOrExpr
->
TypeOrExpr
convert
PatternTypeOrExpr
(
Left
t
)
=
Left
$
convertStructFieldTyp
e
t
convert
TypeOrExprForce
(
Left
t
)
=
Left
$
convertTypeForc
e
t
convert
PatternTypeOrExpr
(
Right
e
)
=
Right
e
convert
TypeOrExprForce
(
Right
e
)
=
Right
e
test/core/net_base_type.sv
0 → 100644
View file @
5345a72c
`ifdef
REF
`define
TEST
(
kw
,
name
,
conv
)
\
wire conv wire_
``
name
=
1
'
sb1
;
\
wire
[
63
:
0
]
wire_
``
name
``
_ext
=
wire_
``
name
;
`else
`define
TEST
(
kw
,
name
,
conv
)
\
wire kw wire_
``
name
=
1
'
sb1
;
\
wire
[
63
:
0
]
wire_
``
name
``
_ext
=
wire_
``
name
;
`endif
module
top
;
`TEST
(
reg
,
reg
,
)
`TEST
(
bit
,
bit
,
)
`TEST
(
logic
,
logic
,
)
`TEST
(
integer
,
integer
,
signed
[
31
:
0
])
`TEST
(
int
,
int
,
signed
[
31
:
0
])
`TEST
(
shortint
,
shortint
,
signed
[
15
:
0
])
`TEST
(
byte
,
byte
,
signed
[
7
:
0
])
`TEST
(
integer
unsigned
,
integer_unsigned
,
[
31
:
0
])
`TEST
(
int
unsigned
,
int_unsigned
,
[
31
:
0
])
`TEST
(
shortint
unsigned
,
shortint_unsigned
,
[
15
:
0
])
`TEST
(
byte
unsigned
,
byte_unsigned
,
[
7
:
0
])
endmodule
test/core/net_base_type.v
0 → 100644
View file @
5345a72c
`define
REF
`include
"net_base_type.sv"
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