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
463cdcb2
Commit
463cdcb2
authored
Feb 15, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support complex sizes in size casts (resolves #69)
parent
fe8839ea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
11 deletions
+26
-11
src/Language/SystemVerilog/Parser/Parse.y
+3
-5
test/basic/size_cast.sv
+11
-2
test/basic/size_cast.v
+12
-4
No files found.
src/Language/SystemVerilog/Parser/Parse.y
View file @
463cdcb2
...
...
@@ -421,6 +421,7 @@ time { Token Lit_time _ _ }
%left "*" "/" "%"
%left "**"
%right REDUCE_OP "!" "~" "++" "--"
%left "'"
%left "(" ")" "[" "]" "." "::"
%%
...
...
@@ -1140,13 +1141,10 @@ Expr :: { Expr }
| "{" Expr Concat "}" { Repeat $2 $3 }
| Concat { Concat $1 }
| Expr "?" Expr ":" Expr { Mux $1 $3 $5 }
| CastingType "'" "(" Expr ")" { Cast (Left $1) $4 }
| Number "'" "(" Expr ")" { Cast (Right $ Number $1) $4 }
| "(" Expr ")" "'""(" Expr ")" { Cast (Right $2) $6 }
| Identifier "'" "(" Expr ")" { Cast (Right $ Ident $1 ) $4 }
| Identifier "::" Identifier "'" "(" Expr ")" { Cast (Right $ PSIdent $1 $3) $6 }
| Expr "." Identifier { Dot $1 $3 }
| "'" "{" PatternItems "}" { Pattern $3 }
| CastingType "'" "(" Expr ")" { Cast (Left $1) $4 }
| Expr "'" "(" Expr ")" { Cast (Right $1) $4 }
| "{" StreamOp StreamSize Concat "}" { Stream $2 $3 $4 }
| "{" StreamOp Concat "}" { Stream $2 (Number "1") $3 }
| Expr "inside" "{" OpenRangeList "}" { Inside $1 $4 }
...
...
test/basic/size_cast.sv
View file @
463cdcb2
module
top
;
localparam
BW
=
3
;
logic
[
2
:
0
]
test
;
assign
test
=
BW
'
(
0
)
;
initial
#
1
$
display
(
test
)
;
logic
[
3
:
0
]
foo
;
logic
[
3
:
0
]
bar
;
initial
begin
test
=
BW
'
(
0
)
;
$
display
(
test
)
;
foo
=
2
'
(
'1
)
;
$
display
(
foo
)
;
bar
=
$
bits
(
bar
)
'
(
'1
)
;
$
display
(
bar
)
;
end
endmodule
test/basic/size_cast.v
View file @
463cdcb2
module
top
;
localparam
BW
=
3
;
wire
[
2
:
0
]
test
;
assign
test
=
0
;
initial
#
1
$
display
(
test
)
;
reg
[
2
:
0
]
test
;
reg
[
3
:
0
]
foo
;
reg
[
3
:
0
]
bar
;
initial
begin
test
=
0
;
$
display
(
test
)
;
foo
=
4'b0011
;
$
display
(
foo
)
;
bar
=
4'b1111
;
$
display
(
bar
)
;
end
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