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
02ba9e95
Commit
02ba9e95
authored
Aug 28, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove comments by default; added --verbose flag
parent
b48ca0bb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
1 deletions
+37
-1
src/Convert.hs
+2
-0
src/Convert/RemoveComments.hs
+26
-0
src/Job.hs
+8
-1
sv2v.cabal
+1
-0
No files found.
src/Convert.hs
View file @
02ba9e95
...
...
@@ -23,6 +23,7 @@ import qualified Convert.NamedBlock
import
qualified
Convert.NestPI
import
qualified
Convert.Package
import
qualified
Convert.PackedArray
import
qualified
Convert.RemoveComments
import
qualified
Convert.Return
import
qualified
Convert.StarPort
import
qualified
Convert.StmtBlock
...
...
@@ -56,6 +57,7 @@ phases excludes =
,
Convert
.
Return
.
convert
,
selectExclude
(
Job
.
Interface
,
Convert
.
Interface
.
convert
)
,
selectExclude
(
Job
.
Always
,
Convert
.
AlwaysKW
.
convert
)
,
selectExclude
(
Job
.
Succinct
,
Convert
.
RemoveComments
.
convert
)
]
where
selectExclude
::
(
Job
.
Exclude
,
Phase
)
->
Phase
...
...
src/Convert/RemoveComments.hs
0 → 100644
View file @
02ba9e95
{- sv2v
- Author: Zachary Snow <zach@zachjs.com>
-
- Conversion for removing any comments
-}
module
Convert.RemoveComments
(
convert
)
where
import
Convert.Traverse
import
Language.SystemVerilog.AST
convert
::
[
AST
]
->
[
AST
]
convert
=
map
convertFile
convertFile
::
AST
->
AST
convertFile
=
traverseDescriptions
(
traverseModuleItems
convertModuleItem
)
.
filter
(
not
.
isComment
)
isComment
::
Description
->
Bool
isComment
(
PackageItem
(
Comment
_
))
=
True
isComment
_
=
False
convertModuleItem
::
ModuleItem
->
ModuleItem
convertModuleItem
(
MIPackageItem
(
Comment
_
))
=
Generate
[]
convertModuleItem
other
=
other
src/Job.hs
View file @
02ba9e95
...
...
@@ -13,6 +13,7 @@ data Exclude
=
Always
|
Interface
|
Logic
|
Succinct
deriving
(
Show
,
Typeable
,
Data
,
Eq
)
data
Job
=
Job
...
...
@@ -21,6 +22,7 @@ data Job = Job
,
incdir
::
[
FilePath
]
,
define
::
[
String
]
,
oneunit
::
Bool
,
verbose
::
Bool
}
deriving
(
Show
,
Typeable
,
Data
)
defaultJob
::
Job
...
...
@@ -33,6 +35,7 @@ defaultJob = Job
++
" preprocessing"
)
,
oneunit
=
False
&=
help
(
"put all files in one compilation unit, so"
++
" macros from earlier files remain defined in later files"
)
,
verbose
=
False
&=
help
"retain certain conversion artifacts"
}
&=
program
"sv2v"
&=
summary
"sv2v v0.0.1, (C) 2019 Zachary Snow, 2011-2015 Tom Hawkins"
...
...
@@ -40,4 +43,8 @@ defaultJob = Job
,
"More info: https://github.com/zachjs/sv2v"
]
readJob
::
IO
Job
readJob
=
cmdArgs
defaultJob
readJob
=
do
job
<-
cmdArgs
defaultJob
return
$
if
verbose
job
then
job
{
exclude
=
Succinct
:
exclude
job
}
else
job
sv2v.cabal
View file @
02ba9e95
...
...
@@ -67,6 +67,7 @@ executable sv2v
Convert.NestPI
Convert.Package
Convert.PackedArray
Convert.RemoveComments
Convert.Return
Convert.StarPort
Convert.StmtBlock
...
...
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