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
2d034dcb
Commit
2d034dcb
authored
Sep 17, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basic support for elaboration system tasks
parent
1078603b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
4 deletions
+32
-4
src/Language/SystemVerilog/Parser/ParseDecl.hs
+24
-4
test/basic/elab_task.sv
+6
-0
test/basic/elab_task.v
+2
-0
No files found.
src/Language/SystemVerilog/Parser/ParseDecl.hs
View file @
2d034dcb
...
...
@@ -116,14 +116,33 @@ parseDTsAsPortDecls pieces =
parseDTsAsModuleItems
::
[
DeclToken
]
->
[
ModuleItem
]
parseDTsAsModuleItems
tokens
=
forbidNonEqAsgn
tokens
$
if
any
isInstance
tokens
then
parseDTsAsIntantiations
tokens
else
map
(
MIPackageItem
.
Decl
)
$
parseDTsAsDecl
tokens
if
isElabTask
$
head
tokens
then
asElabTask
tokens
else
if
any
isInstance
tokens
then
parseDTsAsIntantiations
tokens
else
map
(
MIPackageItem
.
Decl
)
$
parseDTsAsDecl
tokens
where
isElabTask
::
DeclToken
->
Bool
isElabTask
(
DTIdent
x
)
=
elem
x
elabTasks
where
elabTasks
=
[
"$fatal"
,
"$error"
,
"$warning"
,
"$info"
]
isElabTask
_
=
False
isInstance
::
DeclToken
->
Bool
isInstance
(
DTInstance
_
)
=
True
isInstance
_
=
False
-- internal; approximates the behavior of the elaboration system tasks
asElabTask
::
[
DeclToken
]
->
[
ModuleItem
]
asElabTask
[
DTIdent
name
,
DTInstance
args
]
=
if
name
==
"$info"
then
[]
-- just drop them for simplicity
else
[
Instance
"ThisModuleDoesNotExist"
[]
name'
Nothing
args
]
where
name'
=
"__sv2v_elab_"
++
tail
name
asElabTask
[
DTIdent
name
]
=
asElabTask
[
DTIdent
name
,
DTInstance
[]
]
asElabTask
tokens
=
error
$
"could not parse elaboration system task: "
++
show
tokens
-- internal; parser for module instantiations
parseDTsAsIntantiations
::
[
DeclToken
]
->
[
ModuleItem
]
...
...
@@ -142,7 +161,8 @@ parseDTsAsIntantiations (DTIdent name : tokens) =
[
DTIdent
a
,
DTRange
(
NonIndexed
,
s
),
DTInstance
b
]
->
(
a
,
Just
s
,
b
)
[
DTIdent
a
,
DTInstance
b
]
->
(
a
,
Nothing
,
b
)
_
->
error
$
"unrecognized instantiation: "
++
show
inst
_
->
error
$
"unrecognized instantiation of "
++
name
++
": "
++
show
inst
follow
=
x
`
seq
`
if
null
toks'
then
[]
else
step
(
tail
toks'
)
(
params
,
rest
)
=
case
head
tokens
of
...
...
test/basic/elab_task.sv
0 → 100644
View file @
2d034dcb
module
top
;
if
(
1
==
0
)
wire
foo
;
else
$
info
(
"foo"
)
;
endmodule
test/basic/elab_task.v
0 → 100644
View file @
2d034dcb
module
top
;
endmodule
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