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
3a507d5f
Commit
3a507d5f
authored
Feb 26, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conversion for splitting up port declaration variables
parent
cda40a13
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
9 deletions
+41
-9
Convert.hs
+2
-0
Convert/PackedArrayFlatten.hs
+0
-9
Convert/SplitPortDecl.hs
+28
-0
Language/SystemVerilog/AST.hs
+10
-0
sv2v.cabal
+1
-0
No files found.
Convert.hs
View file @
3a507d5f
...
...
@@ -13,6 +13,7 @@ import qualified Convert.CaseKW
import
qualified
Convert.Logic
import
qualified
Convert.Typedef
import
qualified
Convert.PackedArrayFlatten
import
qualified
Convert.SplitPortDecl
import
qualified
Convert.StarPort
type
Phase
=
AST
->
AST
...
...
@@ -24,6 +25,7 @@ phases =
,
Convert
.
Logic
.
convert
,
Convert
.
Typedef
.
convert
,
Convert
.
PackedArrayFlatten
.
convert
,
Convert
.
SplitPortDecl
.
convert
,
Convert
.
StarPort
.
convert
]
...
...
Convert/PackedArrayFlatten.hs
View file @
3a507d5f
...
...
@@ -115,15 +115,6 @@ unflattener outputs (arr, (t, (majorHi, majorLo))) =
(
BinOp
Sub
size
(
Number
"1"
)))
,
Ident
startBit
)
typeDims
::
Type
->
([
Range
]
->
Type
,
[
Range
])
typeDims
(
Reg
r
)
=
(
Reg
,
r
)
typeDims
(
Wire
r
)
=
(
Wire
,
r
)
typeDims
(
Logic
r
)
=
(
Logic
,
r
)
typeDims
(
Alias
t
r
)
=
(
Alias
t
,
r
)
typeDims
(
Implicit
r
)
=
(
Implicit
,
r
)
typeDims
(
IntegerT
)
=
(
error
"ranges cannot be applied to IntegerT"
,
[]
)
typeDims
(
Enum
t
v
r
)
=
(
Enum
t
v
,
r
)
prefix
::
Identifier
->
Identifier
prefix
ident
=
"_sv2v_"
++
ident
...
...
Convert/SplitPortDecl.hs
0 → 100644
View file @
3a507d5f
{- sv2v
- Author: Zachary Snow <zach@zachjs.com>
-
- Conversion for splitting up complex port declarations. VTR doesn't support:
- `input wire foo;` but does suport: `input foo; wire foo;`.
-}
module
Convert.SplitPortDecl
(
convert
)
where
import
Convert.Traverse
import
Language.SystemVerilog.AST
convert
::
AST
->
AST
convert
=
traverseDescriptions
convertDescription
convertDescription
::
Description
->
Description
convertDescription
(
Module
name
ports
items
)
=
Module
name
ports
(
concat
$
map
splitPortDecl
items
)
convertDescription
other
=
other
splitPortDecl
::
ModuleItem
->
[
ModuleItem
]
splitPortDecl
(
orig
@
(
MIDecl
(
Variable
Local
_
_
_
_
)))
=
[
orig
]
splitPortDecl
(
orig
@
(
MIDecl
(
Variable
_
(
Implicit
_
)
_
_
_
)))
=
[
orig
]
splitPortDecl
(
MIDecl
(
Variable
d
t
x
a
me
))
=
[
MIDecl
$
Variable
d
(
Implicit
r
)
x
a
Nothing
,
MIDecl
$
Variable
Local
t
x
a
me
]
where
(
_
,
r
)
=
typeDims
t
splitPortDecl
other
=
[
other
]
Language/SystemVerilog/AST.hs
View file @
3a507d5f
...
...
@@ -19,6 +19,7 @@ module Language.SystemVerilog.AST
,
Case
,
Range
,
GenCase
,
typeDims
)
where
import
Data.List
...
...
@@ -93,6 +94,15 @@ instance Show Type where
showVal
::
(
Identifier
,
Maybe
Expr
)
->
String
showVal
(
x
,
e
)
=
x
++
(
showAssignment
e
)
typeDims
::
Type
->
([
Range
]
->
Type
,
[
Range
])
typeDims
(
Reg
r
)
=
(
Reg
,
r
)
typeDims
(
Wire
r
)
=
(
Wire
,
r
)
typeDims
(
Logic
r
)
=
(
Logic
,
r
)
typeDims
(
Alias
t
r
)
=
(
Alias
t
,
r
)
typeDims
(
Implicit
r
)
=
(
Implicit
,
r
)
typeDims
(
IntegerT
)
=
(
error
"ranges cannot be applied to IntegerT"
,
[]
)
typeDims
(
Enum
t
v
r
)
=
(
Enum
t
v
,
r
)
data
Decl
=
Parameter
Type
Identifier
Expr
|
Localparam
Type
Identifier
Expr
...
...
sv2v.cabal
View file @
3a507d5f
...
...
@@ -65,6 +65,7 @@ executable sv2v
Convert.CaseKW
Convert.Logic
Convert.PackedArrayFlatten
Convert.SplitPortDecl
Convert.StarPort
Convert.Typedef
Convert.Traverse
...
...
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