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
1c902773
Commit
1c902773
authored
Jun 17, 2024
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parser support for not, strong, weak, nexttime, and s_nexttime
parent
636130f8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
0 deletions
+41
-0
CHANGELOG.md
+5
-0
src/Convert/Traverse.hs
+11
-0
src/Language/SystemVerilog/AST/Stmt.hs
+12
-0
src/Language/SystemVerilog/Parser/Parse.y
+8
-0
test/nosim/assert.sv
+5
-0
No files found.
CHANGELOG.md
View file @
1c902773
## Unreleased
## Unreleased
### New Features
*
Added parsing support for
`not`
,
`strong`
,
`weak`
,
`nexttime`
, and
`s_nexttime`
in assertion property expressions
### Bug Fixes
### Bug Fixes
*
Fixed
`--write path/to/dir/`
with directives like
`` `default_nettype ``
*
Fixed
`--write path/to/dir/`
with directives like
`` `default_nettype ``
...
...
src/Convert/Traverse.hs
View file @
1c902773
...
@@ -111,6 +111,7 @@ module Convert.Traverse
...
@@ -111,6 +111,7 @@ module Convert.Traverse
)
where
)
where
import
Data.Bitraversable
(
bimapM
)
import
Data.Bitraversable
(
bimapM
)
import
Data.Functor
((
<&>
))
import
Data.Functor.Identity
(
Identity
,
runIdentity
)
import
Data.Functor.Identity
(
Identity
,
runIdentity
)
import
Control.Monad
((
>=>
))
import
Control.Monad
((
>=>
))
import
Control.Monad.Writer.Strict
import
Control.Monad.Writer.Strict
...
@@ -344,6 +345,16 @@ traversePropExprExprsM mapper (PropExprIff p1 p2) = do
...
@@ -344,6 +345,16 @@ traversePropExprExprsM mapper (PropExprIff p1 p2) = do
p1'
<-
traversePropExprExprsM
mapper
p1
p1'
<-
traversePropExprExprsM
mapper
p1
p2'
<-
traversePropExprExprsM
mapper
p2
p2'
<-
traversePropExprExprsM
mapper
p2
return
$
PropExprIff
p1'
p2'
return
$
PropExprIff
p1'
p2'
traversePropExprExprsM
mapper
(
PropExprNeg
pe
)
=
traversePropExprExprsM
mapper
pe
<&>
PropExprNeg
traversePropExprExprsM
mapper
(
PropExprStrong
se
)
=
traverseSeqExprExprsM
mapper
se
<&>
PropExprStrong
traversePropExprExprsM
mapper
(
PropExprWeak
se
)
=
traverseSeqExprExprsM
mapper
se
<&>
PropExprWeak
traversePropExprExprsM
mapper
(
PropExprNextTime
strong
index
prop
)
=
do
index'
<-
mapper
index
prop'
<-
traversePropExprExprsM
mapper
prop
return
$
PropExprNextTime
strong
index'
prop'
seqExprHelper
::
Monad
m
=>
MapperM
m
Expr
seqExprHelper
::
Monad
m
=>
MapperM
m
Expr
->
(
SeqExpr
->
SeqExpr
->
SeqExpr
)
->
(
SeqExpr
->
SeqExpr
->
SeqExpr
)
...
...
src/Language/SystemVerilog/AST/Stmt.hs
View file @
1c902773
...
@@ -235,6 +235,10 @@ data PropExpr
...
@@ -235,6 +235,10 @@ data PropExpr
|
PropExprFollowsO
SeqExpr
PropExpr
|
PropExprFollowsO
SeqExpr
PropExpr
|
PropExprFollowsNO
SeqExpr
PropExpr
|
PropExprFollowsNO
SeqExpr
PropExpr
|
PropExprIff
PropExpr
PropExpr
|
PropExprIff
PropExpr
PropExpr
|
PropExprNeg
PropExpr
|
PropExprStrong
SeqExpr
|
PropExprWeak
SeqExpr
|
PropExprNextTime
Bool
Expr
PropExpr
deriving
Eq
deriving
Eq
instance
Show
PropExpr
where
instance
Show
PropExpr
where
show
(
PropExpr
se
)
=
show
se
show
(
PropExpr
se
)
=
show
se
...
@@ -243,6 +247,14 @@ instance Show PropExpr where
...
@@ -243,6 +247,14 @@ instance Show PropExpr where
show
(
PropExprFollowsO
a
b
)
=
printf
"(%s #-# %s)"
(
show
a
)
(
show
b
)
show
(
PropExprFollowsO
a
b
)
=
printf
"(%s #-# %s)"
(
show
a
)
(
show
b
)
show
(
PropExprFollowsNO
a
b
)
=
printf
"(%s #=# %s)"
(
show
a
)
(
show
b
)
show
(
PropExprFollowsNO
a
b
)
=
printf
"(%s #=# %s)"
(
show
a
)
(
show
b
)
show
(
PropExprIff
a
b
)
=
printf
"(%s iff %s)"
(
show
a
)
(
show
b
)
show
(
PropExprIff
a
b
)
=
printf
"(%s iff %s)"
(
show
a
)
(
show
b
)
show
(
PropExprNeg
pe
)
=
printf
"not (%s)"
(
show
pe
)
show
(
PropExprStrong
se
)
=
printf
"strong (%s)"
(
show
se
)
show
(
PropExprWeak
se
)
=
printf
"weak (%s)"
(
show
se
)
show
(
PropExprNextTime
strong
index
prop
)
=
printf
"%s%s (%s)"
kwStr
indexStr
(
show
prop
)
where
kwStr
=
(
if
strong
then
"s_"
else
""
)
++
"nexttime"
indexStr
=
if
index
==
Nil
then
""
else
printf
" [%s]"
(
show
index
)
data
SeqMatchItem
data
SeqMatchItem
=
SeqMatchAsgn
(
LHS
,
AsgnOp
,
Expr
)
=
SeqMatchAsgn
(
LHS
,
AsgnOp
,
Expr
)
|
SeqMatchCall
Identifier
Args
|
SeqMatchCall
Identifier
Args
...
...
src/Language/SystemVerilog/Parser/Parse.y
View file @
1c902773
...
@@ -413,6 +413,7 @@ time { Token Lit_time _ _ }
...
@@ -413,6 +413,7 @@ time { Token Lit_time _ _ }
%
right
"iff"
%
right
"iff"
%
left
"or"
","
%
left
"or"
","
%
left
"and"
%
left
"and"
%
nonassoc
"not"
"nexttime"
"s_nexttime"
%
left
"intersect"
%
left
"intersect"
%
left
"within"
%
left
"within"
%
right
"throughout"
%
right
"throughout"
...
@@ -794,6 +795,13 @@ PropExprParens :: { PropExpr }
...
@@ -794,6 +795,13 @@ PropExprParens :: { PropExpr }
|
SeqExpr
"#-#"
PropExpr
{
PropExprFollowsO
$
1
$
3
}
|
SeqExpr
"#-#"
PropExpr
{
PropExprFollowsO
$
1
$
3
}
|
SeqExpr
"#=#"
PropExpr
{
PropExprFollowsNO
$
1
$
3
}
|
SeqExpr
"#=#"
PropExpr
{
PropExprFollowsNO
$
1
$
3
}
|
PropExpr
"iff"
PropExpr
{
PropExprIff
$
1
$
3
}
|
PropExpr
"iff"
PropExpr
{
PropExprIff
$
1
$
3
}
|
"not"
PropExpr
{
PropExprNeg
$
2
}
|
"strong"
"("
SeqExpr
")"
{
PropExprStrong
$
3
}
|
"weak"
"("
SeqExpr
")"
{
PropExprWeak
$
3
}
|
"nexttime"
PropExpr
{
PropExprNextTime
False
Nil
$
2
}
|
"nexttime"
"["
Expr
"]"
PropExpr
{
PropExprNextTime
False
$
3
$
5
}
|
"s_nexttime"
PropExpr
{
PropExprNextTime
True
Nil
$
2
}
|
"s_nexttime"
"["
Expr
"]"
PropExpr
{
PropExprNextTime
True
$
3
$
5
}
SeqExpr
::
{
SeqExpr
}
SeqExpr
::
{
SeqExpr
}
:
Expr
{
SeqExpr
$
1
}
:
Expr
{
SeqExpr
$
1
}
|
SeqExprParens
{
$
1
}
|
SeqExprParens
{
$
1
}
...
...
test/nosim/assert.sv
View file @
1c902773
...
@@ -47,6 +47,11 @@ module top;
...
@@ -47,6 +47,11 @@ module top;
(
1
|->
(
1
|=>
(
1
#
-
#
(
1
#
=
#
(
1
iff
1
))))))
;
(
1
|->
(
1
|=>
(
1
#
-
#
(
1
#
=
#
(
1
iff
1
))))))
;
assert
property
(
@
(
posedge
clk
)
assert
property
(
@
(
posedge
clk
)
1
and
1
or
1
intersect
1
throughout
1
within
1
)
;
1
and
1
or
1
intersect
1
throughout
1
within
1
)
;
assert
property
(
@
(
posedge
clk
)
not
(
strong
(
1
)
iff
weak
(
1
)))
;
assert
property
(
@
(
posedge
clk
)
nexttime
(
1
iff
1
))
;
assert
property
(
@
(
posedge
clk
)
nexttime
[
0
]
(
1
iff
1
))
;
assert
property
(
@
(
posedge
clk
)
s_nexttime
(
1
iff
1
))
;
assert
property
(
@
(
posedge
clk
)
s_nexttime
[
0
]
(
1
iff
1
))
;
assert
property
(
@
(
posedge
clk
)
1
##
1
1
)
;
assert
property
(
@
(
posedge
clk
)
1
##
1
1
)
;
assert
property
(
@
(
posedge
clk
)
##
1
1
)
;
assert
property
(
@
(
posedge
clk
)
##
1
1
)
;
localparam
C
=
1
;
localparam
C
=
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