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
56c597e3
Commit
56c597e3
authored
Jul 19, 2021
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support explicitly typed struct patterns
parent
836536c3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
0 deletions
+19
-0
src/Convert/Struct.hs
+3
-0
src/Language/SystemVerilog/Parser/Parse.y
+1
-0
test/core/struct_pattern_cast.sv
+12
-0
test/core/struct_pattern_cast.v
+3
-0
No files found.
src/Convert/Struct.hs
View file @
56c597e3
...
...
@@ -292,6 +292,9 @@ convertExpr (struct @ (Struct _ fields [])) (Pattern itemsOrig) =
Just
value
=
numberToInteger
n
Right
(
Number
n
)
=
item
convertExpr
_
(
Cast
(
Left
t
)
expr
@
Pattern
{})
=
Cast
(
Left
t
)
$
convertExpr
t
expr
convertExpr
(
Implicit
_
[]
)
expr
=
expr
convertExpr
(
Implicit
sg
rs
)
expr
=
convertExpr
(
IntegerVector
TBit
sg
rs
)
expr
...
...
src/Language/SystemVerilog/Parser/Parse.y
View file @
56c597e3
...
...
@@ -1266,6 +1266,7 @@ Expr :: { Expr }
|
Expr
"?"
Expr
":"
Expr
{
Mux
$
1
$
3
$
5
}
|
Expr
"."
Identifier
{
Dot
$
1
$
3
}
|
"'"
"{"
PatternItems
"}"
{
Pattern
$
3
}
|
Expr
"'"
"{"
PatternItems
"}"
{
Cast
(
Right
$
1
)
(
Pattern
$
4
)
}
|
CastingType
"'"
"("
Expr
")"
{
Cast
(
Left
$
1
)
$
4
}
|
Expr
"'"
"("
Expr
")"
{
Cast
(
Right
$
1
)
$
4
}
|
"{"
StreamOp
StreamSize
Concat
"}"
{
Stream
$
2
$
3
$
4
}
...
...
test/core/struct_pattern_cast.sv
0 → 100644
View file @
56c597e3
module
top
;
typedef
struct
packed
{
integer
x
;
byte
y
;
}
S
;
typedef
struct
packed
{
byte
x
;
shortint
y
;
S
z
;
}
T
;
initial
$
display
(
"%b"
,
T
'
{
x
:
1
,
y
:
2
,
z
:
'
{
x
:
3
,
y
:
4
}
}
)
;
endmodule
test/core/struct_pattern_cast.v
0 → 100644
View file @
56c597e3
module
top
;
initial
$
display
(
"%b"
,
{
8'd1
,
16'd2
,
32'd3
,
8'd4
}
)
;
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