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 _ _ }
...
@@ -421,6 +421,7 @@ time { Token Lit_time _ _ }
%left "*" "/" "%"
%left "*" "/" "%"
%left "**"
%left "**"
%right REDUCE_OP "!" "~" "++" "--"
%right REDUCE_OP "!" "~" "++" "--"
%left "'"
%left "(" ")" "[" "]" "." "::"
%left "(" ")" "[" "]" "." "::"
%%
%%
...
@@ -1140,13 +1141,10 @@ Expr :: { Expr }
...
@@ -1140,13 +1141,10 @@ Expr :: { Expr }
| "{" Expr Concat "}" { Repeat $2 $3 }
| "{" Expr Concat "}" { Repeat $2 $3 }
| Concat { Concat $1 }
| Concat { Concat $1 }
| Expr "?" Expr ":" Expr { Mux $1 $3 $5 }
| 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 }
| Expr "." Identifier { Dot $1 $3 }
| "'" "{" PatternItems "}" { Pattern $3 }
| "'" "{" PatternItems "}" { Pattern $3 }
| CastingType "'" "(" Expr ")" { Cast (Left $1) $4 }
| Expr "'" "(" Expr ")" { Cast (Right $1) $4 }
| "{" StreamOp StreamSize Concat "}" { Stream $2 $3 $4 }
| "{" StreamOp StreamSize Concat "}" { Stream $2 $3 $4 }
| "{" StreamOp Concat "}" { Stream $2 (Number "1") $3 }
| "{" StreamOp Concat "}" { Stream $2 (Number "1") $3 }
| Expr "inside" "{" OpenRangeList "}" { Inside $1 $4 }
| Expr "inside" "{" OpenRangeList "}" { Inside $1 $4 }
...
...
test/basic/size_cast.sv
View file @
463cdcb2
module
top
;
module
top
;
localparam
BW
=
3
;
localparam
BW
=
3
;
logic
[
2
:
0
]
test
;
logic
[
2
:
0
]
test
;
assign
test
=
BW
'
(
0
)
;
logic
[
3
:
0
]
foo
;
initial
#
1
$
display
(
test
)
;
logic
[
3
:
0
]
bar
;
initial
begin
test
=
BW
'
(
0
)
;
$
display
(
test
)
;
foo
=
2
'
(
'1
)
;
$
display
(
foo
)
;
bar
=
$
bits
(
bar
)
'
(
'1
)
;
$
display
(
bar
)
;
end
endmodule
endmodule
test/basic/size_cast.v
View file @
463cdcb2
module
top
;
module
top
;
localparam
BW
=
3
;
reg
[
2
:
0
]
test
;
wire
[
2
:
0
]
test
;
reg
[
3
:
0
]
foo
;
assign
test
=
0
;
reg
[
3
:
0
]
bar
;
initial
#
1
$
display
(
test
)
;
initial
begin
test
=
0
;
$
display
(
test
)
;
foo
=
4'b0011
;
$
display
(
foo
)
;
bar
=
4'b1111
;
$
display
(
bar
)
;
end
endmodule
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