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
f59ed11e
Commit
f59ed11e
authored
Apr 02, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for specifying compile-time defines
parent
5351dee8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
README.md
+3
-2
src/Job.hs
+2
-0
src/sv2v.hs
+10
-2
No files found.
README.md
View file @
f59ed11e
...
@@ -44,9 +44,10 @@ path/to/file.sv` will output the converted file to `stdout`.
...
@@ -44,9 +44,10 @@ path/to/file.sv` will output the converted file to `stdout`.
sv2v [OPTIONS] [FILES]
sv2v [OPTIONS] [FILES]
Common flags:
Common flags:
-e --exclude=CONV
conversion to exclude (always, interface, logic); can
-e --exclude=CONV
conversion to exclude (always, interface, logic);
be specified multiple times
can
be specified multiple times
-i --incdir=DIR add directory to include search path
-i --incdir=DIR add directory to include search path
-d --define=NAME[=VALUE] define value for compilation
-? --help Display help message
-? --help Display help message
-V --version Print version information
-V --version Print version information
--numeric-version Print just the version number
--numeric-version Print just the version number
...
...
src/Job.hs
View file @
f59ed11e
...
@@ -19,6 +19,7 @@ data Job = Job
...
@@ -19,6 +19,7 @@ data Job = Job
{
exclude
::
[
Exclude
]
{
exclude
::
[
Exclude
]
,
files
::
[
FilePath
]
,
files
::
[
FilePath
]
,
incdir
::
[
FilePath
]
,
incdir
::
[
FilePath
]
,
define
::
[
String
]
}
deriving
(
Show
,
Typeable
,
Data
)
}
deriving
(
Show
,
Typeable
,
Data
)
defaultJob
::
Job
defaultJob
::
Job
...
@@ -29,6 +30,7 @@ defaultJob = Job
...
@@ -29,6 +30,7 @@ defaultJob = Job
++
"; can be specified multiple times"
)
++
"; can be specified multiple times"
)
,
files
=
def
&=
args
&=
typ
"FILES"
,
files
=
def
&=
args
&=
typ
"FILES"
,
incdir
=
def
&=
typDir
&=
help
"add directory to include search path"
,
incdir
=
def
&=
typDir
&=
help
"add directory to include search path"
,
define
=
def
&=
typ
"NAME[=VALUE]"
&=
help
"define value for compilation"
}
}
&=
program
"sv2v"
&=
program
"sv2v"
&=
summary
"sv2v v0.0.1, (C) Zachary Snow 2019, Tom Hawkins, 2011-2015"
&=
summary
"sv2v v0.0.1, (C) Zachary Snow 2019, Tom Hawkins, 2011-2015"
...
...
src/sv2v.hs
View file @
f59ed11e
...
@@ -7,16 +7,24 @@
...
@@ -7,16 +7,24 @@
import
System.IO
import
System.IO
import
System.Exit
import
System.Exit
import
Job
(
readJob
,
files
,
exclude
,
incdir
)
import
Data.List
(
elemIndex
)
import
Job
(
readJob
,
files
,
exclude
,
incdir
,
define
)
import
Convert
(
convert
)
import
Convert
(
convert
)
import
Language.SystemVerilog.Parser
import
Language.SystemVerilog.Parser
splitDefine
::
String
->
(
String
,
String
)
splitDefine
str
=
case
elemIndex
'='
str
of
Nothing
->
(
str
,
""
)
Just
idx
->
(
take
idx
str
,
drop
(
idx
+
1
)
str
)
main
::
IO
()
main
::
IO
()
main
=
do
main
=
do
job
<-
readJob
job
<-
readJob
-- parse the input file
-- parse the input file
let
includePaths
=
incdir
job
let
includePaths
=
incdir
job
asts
<-
mapM
(
parseFile
includePaths
[]
)
(
files
job
)
let
defines
=
map
splitDefine
$
define
job
asts
<-
mapM
(
parseFile
includePaths
defines
)
(
files
job
)
let
ast
=
concat
asts
let
ast
=
concat
asts
-- convert the file
-- convert the file
let
ast'
=
convert
(
exclude
job
)
ast
let
ast'
=
convert
(
exclude
job
)
ast
...
...
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