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
7f8c2e33
Commit
7f8c2e33
authored
Mar 19, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simple conversion for unbased unsized literals
parent
071d56a1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
0 deletions
+32
-0
src/Convert.hs
+2
-0
src/Convert/UnbasedUnsized.hs
+29
-0
sv2v.cabal
+1
-0
No files found.
src/Convert.hs
View file @
7f8c2e33
...
...
@@ -20,6 +20,7 @@ import qualified Convert.Return
import
qualified
Convert.StarPort
import
qualified
Convert.Struct
import
qualified
Convert.Typedef
import
qualified
Convert.UnbasedUnsized
import
qualified
Convert.Unique
type
Phase
=
AST
->
AST
...
...
@@ -35,6 +36,7 @@ phases excludes =
,
Convert
.
Struct
.
convert
,
Convert
.
Return
.
convert
,
Convert
.
Typedef
.
convert
,
Convert
.
UnbasedUnsized
.
convert
,
Convert
.
Unique
.
convert
]
where
...
...
src/Convert/UnbasedUnsized.hs
0 → 100644
View file @
7f8c2e33
{- sv2v
- Author: Zachary Snow <zach@zachjs.com>
-
- Conversion for unbased, unsized literals ('0, '1, 'z, 'x)
-
- Maintaining the unsized-ness of the literals is critical, but those digits
- are all equivalent regardless of base. We simply convert them to all use a
- binary base for compatability with Verilog-2005.
-}
module
Convert.UnbasedUnsized
(
convert
)
where
import
Convert.Traverse
import
Language.SystemVerilog.AST
convert
::
AST
->
AST
convert
=
traverseDescriptions
$
traverseModuleItems
$
traverseExprs
$
traverseNestedExprs
convertExpr
digits
::
[
Char
]
digits
=
[
'0'
,
'1'
,
'x'
,
'z'
,
'X'
,
'Z'
]
convertExpr
::
Expr
->
Expr
convertExpr
(
Number
[
'
\'
',
ch
])
=
if
elem
ch
digits
then
Number
(
"'b"
++
[
ch
])
else
error
$
"unexpected unbased-unsized digit: "
++
[
ch
]
convertExpr
other
=
other
sv2v.cabal
View file @
7f8c2e33
...
...
@@ -53,6 +53,7 @@ executable sv2v
Convert.Struct
Convert.Typedef
Convert.Traverse
Convert.UnbasedUnsized
Convert.Unique
-- sv2v CLI modules
Job
...
...
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