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
b5b9fdb3
Commit
b5b9fdb3
authored
Mar 08, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for null call arguments
parent
b4b6ea34
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
12 deletions
+17
-12
src/Convert/Traverse.hs
+5
-2
src/Language/SystemVerilog/AST.hs
+4
-4
src/Language/SystemVerilog/Parser/Parse.y
+8
-6
No files found.
src/Convert/Traverse.hs
View file @
b5b9fdb3
...
...
@@ -180,6 +180,9 @@ traverseNestedExprsM :: Monad m => MapperM m Expr -> MapperM m Expr
traverseNestedExprsM
mapper
=
exprMapper
where
exprMapper
e
=
mapper
e
>>=
em
maybeExprMapper
Nothing
=
return
Nothing
maybeExprMapper
(
Just
e
)
=
exprMapper
e
>>=
return
.
Just
em
(
String
s
)
=
return
$
String
s
em
(
Number
s
)
=
return
$
Number
s
em
(
ConstBool
b
)
=
return
$
ConstBool
b
...
...
@@ -200,7 +203,7 @@ traverseNestedExprsM mapper = exprMapper
em
(
Concat
l
)
=
mapM
exprMapper
l
>>=
return
.
Concat
em
(
Call
f
l
)
=
mapM
e
xprMapper
l
>>=
return
.
Call
f
mapM
maybeE
xprMapper
l
>>=
return
.
Call
f
em
(
UniOp
o
e
)
=
exprMapper
e
>>=
return
.
UniOp
o
em
(
BinOp
o
e1
e2
)
=
do
...
...
@@ -277,7 +280,7 @@ traverseExprsM mapper = moduleItemMapper
exprMapper
cc
>>=
\
cc'
->
return
$
If
cc'
s1
s2
flatStmtMapper
(
Timing
event
stmt
)
=
return
$
Timing
event
stmt
flatStmtMapper
(
Subroutine
f
exprs
)
=
mapM
e
xprMapper
exprs
>>=
return
.
Subroutine
f
mapM
maybeE
xprMapper
exprs
>>=
return
.
Subroutine
f
flatStmtMapper
(
Return
expr
)
=
exprMapper
expr
>>=
return
.
Return
flatStmtMapper
(
Null
)
=
return
Null
...
...
src/Language/SystemVerilog/AST.hs
View file @
b5b9fdb3
...
...
@@ -269,7 +269,7 @@ data Expr
|
Bit
Expr
Expr
|
Repeat
Expr
[
Expr
]
|
Concat
[
Expr
]
|
Call
Identifier
[
Expr
]
|
Call
Identifier
[
Maybe
Expr
]
|
UniOp
UniOp
Expr
|
BinOp
BinOp
Expr
Expr
|
Mux
Expr
Expr
Expr
...
...
@@ -369,7 +369,7 @@ instance Show Expr where
Range
a
(
b
,
c
)
->
printf
"%s[%s:%s]"
(
show
a
)
(
show
b
)
(
show
c
)
Repeat
a
b
->
printf
"{%s {%s}}"
(
show
a
)
(
commas
$
map
show
b
)
Concat
a
->
printf
"{%s}"
(
commas
$
map
show
a
)
Call
a
b
->
printf
"%s(%s)"
a
(
commas
$
map
show
b
)
Call
a
b
->
printf
"%s(%s)"
a
(
commas
$
map
(
maybe
""
show
)
b
)
UniOp
a
b
->
printf
"(%s %s)"
(
show
a
)
(
show
b
)
BinOp
a
b
c
->
printf
"(%s %s %s)"
(
show
b
)
(
show
a
)
(
show
c
)
Mux
a
b
c
->
printf
"(%s ? %s : %s)"
(
show
a
)
(
show
b
)
(
show
c
)
...
...
@@ -431,7 +431,7 @@ data Stmt
|
If
Expr
Stmt
Stmt
|
Timing
Timing
Stmt
|
Return
Expr
|
Subroutine
Identifier
[
Expr
]
|
Subroutine
Identifier
[
Maybe
Expr
]
|
Null
deriving
Eq
...
...
@@ -462,7 +462,7 @@ instance Show Stmt where
show
(
If
a
b
Null
)
=
printf
"if (%s) %s"
(
show
a
)
(
show
b
)
show
(
If
a
b
c
)
=
printf
"if (%s) %s
\n
else %s"
(
show
a
)
(
show
b
)
(
show
c
)
show
(
Return
e
)
=
printf
"return %s;"
(
show
e
)
show
(
Subroutine
x
a
)
=
printf
"%s(%s);"
x
(
commas
$
map
show
a
)
show
(
Subroutine
x
a
)
=
printf
"%s(%s);"
x
(
commas
$
map
(
maybe
""
show
)
a
)
show
(
Timing
t
s
)
=
printf
"%s%s"
(
show
t
)
rest
where
rest
=
case
s
of
...
...
src/Language/SystemVerilog/Parser/Parse.y
View file @
b5b9fdb3
...
...
@@ -479,12 +479,14 @@ Number :: { String }
String :: { String }
: string { tail $ init $ tokenString $1 }
CallArgs :: { [Expr] }
: {- empty -} { [] }
| CallArgsNonEmpty { $1 }
CallArgsNonEmpty :: { [Expr] }
: Expr { [$1] }
| CallArgsNonEmpty "," Expr { $1 ++ [$3] }
CallArgs :: { [Maybe Expr] }
: {- empty -} { [] }
| Expr { [Just $1] }
| CallArgsFollow { (Nothing) : $1 }
| Expr CallArgsFollow { (Just $1) : $2 }
CallArgsFollow :: { [Maybe Expr] }
: "," opt(Expr) { [$2] }
| "," opt(Expr) CallArgsFollow { $2 : $3 }
Exprs :: { [Expr] }
: Expr { [$1] }
...
...
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