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
581a7911
Commit
581a7911
authored
Aug 16, 2021
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for deferred immediate assertion statements
parent
4ded2a59
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
27 deletions
+64
-27
src/Convert/Traverse.hs
+7
-7
src/Language/SystemVerilog/AST/Stmt.hs
+26
-11
src/Language/SystemVerilog/Parser/Parse.y
+18
-8
test/error/assert_deferred_nonzero.sv
+4
-0
test/nosim/assert.sv
+9
-1
No files found.
src/Convert/Traverse.hs
View file @
581a7911
...
...
@@ -345,10 +345,10 @@ traverseAssertionExprsM mapper = assertionMapper
e'
<-
mapper
e
pe'
<-
propExprMapper
pe
return
$
PropertySpec
ms
e'
pe'
assertionExprMapper
(
Lef
t
e
)
=
propSpecMapper
e
>>=
return
.
Lef
t
assertionExprMapper
(
Right
e
)
=
mapper
e
>>=
return
.
Right
assertionExprMapper
(
Concurren
t
e
)
=
propSpecMapper
e
>>=
return
.
Concurren
t
assertionExprMapper
(
Immediate
d
e
)
=
mapper
e
>>=
return
.
Immediate
d
assertionMapper
(
Assert
e
ab
)
=
do
e'
<-
assertionExprMapper
e
return
$
Assert
e'
ab
...
...
@@ -389,10 +389,10 @@ traverseStmtLHSsM mapper = stmtMapper
s2'
<-
senseMapper
s2
return
$
SenseOr
s1'
s2'
senseMapper
(
SenseStar
)
=
return
SenseStar
assertionExprMapper
(
Lef
t
(
PropertySpec
(
Just
sense
)
me
pe
))
=
do
assertionExprMapper
(
Concurren
t
(
PropertySpec
(
Just
sense
)
me
pe
))
=
do
sense'
<-
senseMapper
sense
return
$
Lef
t
$
PropertySpec
(
Just
sense'
)
me
pe
assertionExprMapper
other
=
return
$
other
return
$
Concurren
t
$
PropertySpec
(
Just
sense'
)
me
pe
assertionExprMapper
other
=
return
other
assertionMapper
(
Assert
e
ab
)
=
do
e'
<-
assertionExprMapper
e
return
$
Assert
e'
ab
...
...
src/Language/SystemVerilog/AST/Stmt.hs
View file @
581a7911
...
...
@@ -16,8 +16,9 @@ module Language.SystemVerilog.AST.Stmt
,
SeqMatchItem
(
..
)
,
SeqExpr
(
..
)
,
AssertionItem
,
AssertionExpr
,
Assertion
(
..
)
,
AssertionKind
(
..
)
,
Deferral
(
..
)
,
PropertySpec
(
..
)
,
ViolationCheck
(
..
)
,
BlockKW
(
..
)
...
...
@@ -235,20 +236,34 @@ instance Show SeqExpr where
show
(
SeqExprFirstMatch
e
a
)
=
printf
"first_match(%s, %s)"
(
show
e
)
(
commas
$
map
show
a
)
type
AssertionItem
=
(
Identifier
,
Assertion
)
type
AssertionExpr
=
Either
PropertySpec
Expr
data
Assertion
=
Assert
Assertion
Expr
ActionBlock
|
Assume
Assertion
Expr
ActionBlock
|
Cover
Assertion
Expr
Stmt
=
Assert
Assertion
Kind
ActionBlock
|
Assume
Assertion
Kind
ActionBlock
|
Cover
Assertion
Kind
Stmt
deriving
Eq
instance
Show
Assertion
where
show
(
Assert
e
a
)
=
printf
"assert %s%s"
(
showAssertionExpr
e
)
(
show
a
)
show
(
Assume
e
a
)
=
printf
"assume %s%s"
(
showAssertionExpr
e
)
(
show
a
)
show
(
Cover
e
a
)
=
printf
"cover %s%s"
(
showAssertionExpr
e
)
(
show
a
)
show
(
Assert
k
a
)
=
printf
"assert %s%s"
(
show
k
)
(
show
a
)
show
(
Assume
k
a
)
=
printf
"assume %s%s"
(
show
k
)
(
show
a
)
show
(
Cover
k
a
)
=
printf
"cover %s%s"
(
show
k
)
(
show
a
)
data
AssertionKind
=
Concurrent
PropertySpec
|
Immediate
Deferral
Expr
deriving
Eq
instance
Show
AssertionKind
where
show
(
Concurrent
e
)
=
printf
"property (%s
\n
)"
(
show
e
)
show
(
Immediate
d
e
)
=
printf
"%s(%s)"
(
showPad
d
)
(
show
e
)
showAssertionExpr
::
AssertionExpr
->
String
showAssertionExpr
(
Left
e
)
=
printf
"property (%s
\n
)"
(
show
e
)
showAssertionExpr
(
Right
e
)
=
printf
"(%s)"
(
show
e
)
data
Deferral
=
NotDeferred
|
ObservedDeferred
|
FinalDeferred
deriving
Eq
instance
Show
Deferral
where
show
NotDeferred
=
""
show
ObservedDeferred
=
"#0"
show
FinalDeferred
=
"final"
data
PropertySpec
=
PropertySpec
(
Maybe
Sense
)
Expr
PropExpr
...
...
src/Language/SystemVerilog/Parser/Parse.y
View file @
581a7911
...
...
@@ -733,16 +733,18 @@ ConcurrentAssertionItem :: { AssertionItem }
:
Identifier
":"
ConcurrentAssertionStatement
{
(
$
1
,
$
3
)
}
|
ConcurrentAssertionStatement
{
(
""
,
$
1
)
}
ConcurrentAssertionStatement
::
{
Assertion
}
:
"assert"
"property"
"("
PropertySpec
")"
ActionBlock
{
Assert
(
Lef
t
$
4
)
$
6
}
|
"assume"
"property"
"("
PropertySpec
")"
ActionBlock
{
Assume
(
Lef
t
$
4
)
$
6
}
|
"cover"
"property"
"("
PropertySpec
")"
Stmt
{
Cover
(
Lef
t
$
4
)
$
6
}
:
"assert"
"property"
"("
PropertySpec
")"
ActionBlock
{
Assert
(
Concurren
t
$
4
)
$
6
}
|
"assume"
"property"
"("
PropertySpec
")"
ActionBlock
{
Assume
(
Concurren
t
$
4
)
$
6
}
|
"cover"
"property"
"("
PropertySpec
")"
Stmt
{
Cover
(
Concurren
t
$
4
)
$
6
}
ImmediateAssertionStatement
::
{
Assertion
}
:
SimpleImmediateAssertionStatement
{
$
1
}
SimpleImmediateAssertionStatement
::
{
Assertion
}
:
"assert"
"("
Expr
")"
ActionBlock
{
Assert
(
Right
$
3
)
$
5
}
|
"assume"
"("
Expr
")"
ActionBlock
{
Assume
(
Right
$
3
)
$
5
}
|
"cover"
"("
Expr
")"
Stmt
{
Cover
(
Right
$
3
)
$
5
}
:
"assert"
Deferral
"("
Expr
")"
ActionBlock
{
Assert
(
Immediate
$
2
$
4
)
$
6
}
|
"assume"
Deferral
"("
Expr
")"
ActionBlock
{
Assume
(
Immediate
$
2
$
4
)
$
6
}
|
"cover"
Deferral
"("
Expr
")"
Stmt
{
Cover
(
Immediate
$
2
$
4
)
$
6
}
Deferral
::
{
Deferral
}
:
{- empty -}
{
NotDeferred
}
|
"#"
number
{
%
expectZeroDelay
$
2
ObservedDeferred
}
|
"final"
{
FinalDeferred
}
PropertySpec
::
{
PropertySpec
}
:
opt
(
ClockingEvent
)
"disable"
"iff"
"("
Expr
")"
PropExpr
{
PropertySpec
$
1
$
5
$
7
}
...
...
@@ -1682,4 +1684,12 @@ readNumber pos str = do
hPutStrLn
stderr
$
show
pos
++
": Warning: "
++
msg
return
num
expectZeroDelay
::
Token
->
a
->
ParseState
a
expectZeroDelay
tok
a
=
do
num
<-
readNumber
pos
str
case
num
of
Decimal
(
-
32
)
True
0
->
return
a
_
->
parseError
pos
$
"expected 0 after #, but found "
++
str
where
Token
{
tokenString
=
str
,
tokenPosition
=
pos
}
=
tok
}
test/error/assert_deferred_nonzero.sv
0 → 100644
View file @
581a7911
// pattern: assert_deferred_nonzero.sv:3:21: Parse error: expected 0 after #, but found 1
module
top
;
initial
assert
#
1
(
1
)
;
endmodule
test/nosim/assert.sv
View file @
581a7911
...
...
@@ -12,7 +12,15 @@ module top;
assert
(
1
)
;
assume
(
1
)
;
cover
(
1
)
;
assume
(
1
)
;
assert
#
0
(
1
)
;
assume
#
0
(
1
)
;
cover
#
0
(
1
)
;
assert
#
0_0
(
1
)
;
assume
#
0_0
(
1
)
;
cover
#
0_0
(
1
)
;
assert
final
(
1
)
;
assume
final
(
1
)
;
cover
final
(
1
)
;
end
assert
property
(
@
(
posedge
clk
)
1
)
else
$
display
(
"FOO"
)
;
...
...
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