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
945923b3
Commit
945923b3
authored
Feb 28, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaned up command line args module a bit
parent
7bc81ef6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
23 deletions
+20
-23
src/Convert.hs
+7
-7
src/Job.hs
+3
-3
src/sv2v.hs
+9
-12
sv2v.cabal
+1
-1
No files found.
src/Convert.hs
View file @
945923b3
...
...
@@ -7,7 +7,7 @@
module
Convert
(
convert
)
where
import
Language.SystemVerilog.AST
import
qualified
Args
as
Args
import
Job
(
Target
(
..
))
import
qualified
Convert.AlwaysKW
import
qualified
Convert.CaseKW
...
...
@@ -19,24 +19,24 @@ import qualified Convert.StarPort
type
Phase
=
AST
->
AST
phases
::
Args
.
Target
->
[
Phase
]
phases
Args
.
YOSYS
=
phases
::
Target
->
[
Phase
]
phases
YOSYS
=
[
Convert
.
Typedef
.
convert
,
Convert
.
PackedArray
.
convert
,
Convert
.
StarPort
.
convert
]
phases
Args
.
VTR
=
(
phases
Args
.
YOSYS
)
++
phases
VTR
=
(
phases
YOSYS
)
++
[
Convert
.
AlwaysKW
.
convert
,
Convert
.
CaseKW
.
convert
,
Convert
.
Logic
.
convert
,
Convert
.
SplitPortDecl
.
convert
]
run
::
Args
.
Target
->
Phase
run
::
Target
->
Phase
run
target
=
foldr
(
.
)
id
$
phases
target
convert
::
Args
.
Target
->
Phase
convert
::
Target
->
Phase
convert
target
=
convert'
where
convert'
::
Phase
...
...
src/
Args
.hs
→
src/
Job
.hs
View file @
945923b3
...
...
@@ -5,7 +5,7 @@
- Command line arguments.
-}
module
Args
where
module
Job
where
import
System.Console.CmdArgs
...
...
@@ -28,5 +28,5 @@ defaultJob = Job
&=
details
[
"sv2v converts SystemVerilog to Verilog."
,
"More info: https://github.com/zachjs/sv2v"
]
read
Args
::
IO
Job
read
Args
=
cmdArgs
defaultJob
read
Job
::
IO
Job
read
Job
=
cmdArgs
defaultJob
src/sv2v.hs
View file @
945923b3
{-# LANGUAGE DeriveDataTypeable #-}
{- sv2v
- Author: Zachary Snow <zach@zachjs.com>
-
...
...
@@ -8,21 +7,19 @@
import
System.IO
import
System.Exit
import
Args
(
readArgs
,
target
,
file
)
import
Job
(
readJob
,
file
,
target
)
import
Convert
(
convert
)
import
Language.SystemVerilog.Parser
main
::
IO
()
main
=
do
args
<-
readArgs
let
filePath
=
file
args
job
<-
readJob
-- parse the input file
let
filePath
=
file
job
content
<-
readFile
filePath
let
ast
=
parseFile
[]
filePath
content
let
res
=
Right
(
convert
(
target
args
)
ast
)
case
res
of
Left
_
->
do
--hPrint stderr err
exitFailure
Right
str
->
do
hPrint
stdout
str
exitSuccess
-- convert the file
let
ast'
=
convert
(
target
job
)
ast
-- print the converted file out
hPrint
stdout
ast'
exitSuccess
sv2v.cabal
View file @
945923b3
...
...
@@ -48,7 +48,7 @@ executable sv2v
Convert.Typedef
Convert.Traverse
-- sv2v CLI modules
Args
Job
ghc-options:
-O3
-threaded
...
...
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