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
091520e4
Commit
091520e4
authored
Nov 30, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow generate scoped basic subroutine invocations in statement blocks
parent
454f8dcb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
15 deletions
+40
-15
src/Language/SystemVerilog/Parser/ParseDecl.hs
+10
-15
test/basic/stmt_task.sv
+29
-0
test/basic/stmt_task.v
+1
-0
No files found.
src/Language/SystemVerilog/Parser/ParseDecl.hs
View file @
091520e4
...
...
@@ -41,7 +41,6 @@ module Language.SystemVerilog.Parser.ParseDecl
,
parseDTsAsPortDecls
,
parseDTsAsModuleItems
,
parseDTsAsDecls
,
parseDTsAsDecl
,
parseDTsAsDeclOrStmt
,
parseDTsAsDeclsOrAsgns
)
where
...
...
@@ -225,16 +224,10 @@ parseDTsAsDecl tokens =
-- [PUBLIC]: parser for single block item declarations or assign or arg-less
-- subroutine call statements
parseDTsAsDeclOrStmt
::
[
DeclToken
]
->
([
Decl
],
[
Stmt
])
parseDTsAsDeclOrStmt
[
DTIdent
pos
f
]
=
(
[]
,
[
traceStmt
pos
,
Subroutine
(
Ident
f
)
(
Args
[]
[]
)])
parseDTsAsDeclOrStmt
[
DTPSIdent
pos
ps
f
]
=
(
[]
,
[
traceStmt
pos
,
Subroutine
(
PSIdent
ps
f
)
(
Args
[]
[]
)])
parseDTsAsDeclOrStmt
[
DTCSIdent
pos
ps
pm
f
]
=
(
[]
,
[
traceStmt
pos
,
Subroutine
(
CSIdent
ps
pm
f
)
(
Args
[]
[]
)])
parseDTsAsDeclOrStmt
(
DTAsgn
pos
(
AsgnOp
op
)
mt
e
:
tok
:
toks
)
=
parseDTsAsDeclOrStmt
$
(
tok
:
toks
)
++
[
DTAsgn
pos
(
AsgnOp
op
)
mt
e
]
parseDTsAsDeclOrStmt
tokens
=
if
(
isStmt
(
last
tokens
)
||
tripLookahead
tokens
)
&&
maybeLhs
/=
Nothing
if
not
hasLeadingDecl
then
(
[]
,
[
traceStmt
pos
,
stmt
])
else
(
parseDTsAsDecl
tokens
,
[]
)
where
...
...
@@ -242,13 +235,15 @@ parseDTsAsDeclOrStmt tokens =
stmt
=
case
last
tokens
of
DTAsgn
_
op
mt
e
->
Asgn
op
mt
lhs
e
DTInstance
_
args
->
Subroutine
(
lhsToExpr
lhs
)
(
instanceToArgs
args
)
_
->
error
$
"invalid block item decl or stmt: "
++
(
show
tokens
)
maybeLhs
=
takeLHS
$
init
tokens
Just
lhs
=
maybeLhs
isStmt
::
DeclToken
->
Bool
isStmt
(
DTAsgn
{})
=
True
isStmt
(
DTInstance
{})
=
True
isStmt
_
=
False
_
->
case
takeLHS
tokens
of
Just
fullLHS
->
Subroutine
(
lhsToExpr
fullLHS
)
(
Args
[]
[]
)
_
->
error
$
"invalid block item decl or stmt: "
++
show
tokens
Just
lhs
=
takeLHS
$
init
tokens
hasLeadingDecl
=
tokens
/=
l4
&&
tripLookahead
l4
(
_
,
l1
)
=
takeDir
tokens
(
_
,
l2
)
=
takeLifetime
l1
(
_
,
l3
)
=
takeType
l2
(
_
,
l4
)
=
takeRanges
l3
traceStmt
::
Position
->
Stmt
traceStmt
pos
=
CommentStmt
$
"Trace: "
++
show
pos
...
...
test/basic/stmt_task.sv
0 → 100644
View file @
091520e4
module
top
;
task
tick
;
$
display
(
"tick() called"
)
;
endtask
generate
begin
:
foo
task
tick
;
$
display
(
"foo.tick() called"
)
;
endtask
end
genvar
i
;
for
(
i
=
0
;
i
<
2
;
i
=
i
+
1
)
begin
:
bar
task
tick
;
$
display
(
"bar[%0d].tick() called"
,
i
)
;
endtask
end
endgenerate
initial
begin
tick
;
foo
.
tick
;
bar
[
0
]
.
tick
;
bar
[
1
]
.
tick
;
tick
()
;
foo
.
tick
()
;
bar
[
0
]
.
tick
()
;
bar
[
1
]
.
tick
()
;
end
endmodule
test/basic/stmt_task.v
0 → 100644
View file @
091520e4
`include
"stmt_task.sv"
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