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
dca3a55f
Commit
dca3a55f
authored
Apr 08, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for indexed part select in first procedural Stmt
parent
9b51d756
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
src/Language/SystemVerilog/Parser/Parse.y
+1
-1
src/Language/SystemVerilog/Parser/ParseDecl.hs
+9
-8
No files found.
src/Language/SystemVerilog/Parser/Parse.y
View file @
dca3a55f
...
...
@@ -402,7 +402,7 @@ DeclOrStmtTokens(delim) :: { [DeclToken] }
| "<=" opt(DelayOrEventControl) Expr delim { [DTAsgnNBlk $2 $3] }
DeclOrStmtToken :: { DeclToken }
: "," { DTComma }
|
Range
{ DTRange $1 }
|
PartSelect
{ DTRange $1 }
| Identifier { DTIdent $1 }
| Direction { DTDir $1 }
| "[" Expr "]" { DTBit $2 }
...
...
src/Language/SystemVerilog/Parser/ParseDecl.hs
View file @
dca3a55f
...
...
@@ -49,7 +49,7 @@ data DeclToken
=
DTComma
|
DTAsgn
AsgnOp
Expr
|
DTAsgnNBlk
(
Maybe
Timing
)
Expr
|
DTRange
Range
|
DTRange
(
PartSelectMode
,
Range
)
|
DTIdent
Identifier
|
DTDir
Direction
|
DTType
(
Signing
->
[
Range
]
->
Type
)
...
...
@@ -137,8 +137,9 @@ parseDTsAsIntantiations (DTIdent name : tokens) =
where
(
inst
,
toks'
)
=
span
(
DTComma
/=
)
toks
(
x
,
mr
,
p
)
=
case
inst
of
[
DTIdent
a
,
DTRange
s
,
DTInstance
b
]
->
(
a
,
Just
s
,
b
)
[
DTIdent
a
,
DTInstance
b
]
->
(
a
,
Nothing
,
b
)
[
DTIdent
a
,
DTRange
(
NonIndexed
,
s
),
DTInstance
b
]
->
(
a
,
Just
s
,
b
)
[
DTIdent
a
,
DTInstance
b
]
->
(
a
,
Nothing
,
b
)
_
->
error
$
"unrecognized instantiation: "
++
show
inst
follow
=
x
`
seq
`
if
null
toks'
then
[]
else
step
(
tail
toks'
)
(
params
,
rest
)
=
...
...
@@ -235,7 +236,7 @@ takeLHSStep :: Maybe LHS -> DeclToken -> Maybe LHS
takeLHSStep
(
Nothing
)
(
DTConcat
lhss
)
=
Just
$
LHSConcat
lhss
takeLHSStep
(
Nothing
)
(
DTIdent
x
)
=
Just
$
LHSIdent
x
takeLHSStep
(
Just
curr
)
(
DTBit
e
)
=
Just
$
LHSBit
curr
e
takeLHSStep
(
Just
curr
)
(
DTRange
r
)
=
Just
$
LHSRange
curr
NonIndexed
r
takeLHSStep
(
Just
curr
)
(
DTRange
(
m
,
r
))
=
Just
$
LHSRange
curr
m
r
takeLHSStep
(
Just
curr
)
(
DTDot
x
)
=
Just
$
LHSDot
curr
x
takeLHSStep
(
maybeCurr
)
token
=
error
$
"unexpected token in LHS: "
++
show
(
maybeCurr
,
token
)
...
...
@@ -323,9 +324,9 @@ takeRanges :: [DeclToken] -> ([Range], [DeclToken])
takeRanges
[]
=
(
[]
,
[]
)
takeRanges
(
token
:
tokens
)
=
case
token
of
DTRange
r
->
(
r
:
rs
,
rest
)
DTBit
s
->
(
asRange
s
:
rs
,
rest
)
_
->
(
[]
,
token
:
tokens
)
DTRange
(
NonIndexed
,
r
)
->
(
r
:
rs
,
rest
)
DTBit
s
->
(
asRange
s
:
rs
,
rest
)
_
->
(
[]
,
token
:
tokens
)
where
(
rs
,
rest
)
=
takeRanges
tokens
asRange
s
=
(
simplify
$
BinOp
Sub
s
(
Number
"1"
),
Number
"0"
)
...
...
@@ -342,7 +343,7 @@ takeAsgn rest = (Nothing, rest)
takeComma
::
[
DeclToken
]
->
(
Bool
,
[
DeclToken
])
takeComma
[]
=
(
False
,
[]
)
takeComma
(
DTComma
:
rest
)
=
(
True
,
rest
)
takeComma
_
=
error
"take comma encountered neither comma nor end of tokens"
takeComma
toks
=
error
$
"expected comma or end of decl, got: "
++
show
toks
takeIdent
::
[
DeclToken
]
->
(
Identifier
,
[
DeclToken
])
takeIdent
(
DTIdent
x
:
rest
)
=
(
x
,
rest
)
...
...
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