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
937a583e
Commit
937a583e
authored
Mar 09, 2021
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix simple loop jump guarded conversion
parent
31ebf181
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
3 deletions
+32
-3
src/Convert/Jump.hs
+4
-3
test/basic/simple_loop_jump.sv
+15
-0
test/basic/simple_loop_jump.v
+13
-0
No files found.
src/Convert/Jump.hs
View file @
937a583e
...
...
@@ -117,9 +117,10 @@ convertStmts stmts = do
return
stmts'
pattern
SimpleLoopInits
::
Type
->
Identifier
->
Expr
pattern
SimpleLoopInits
::
String
->
Type
->
Identifier
->
Expr
->
Either
[
Decl
]
[(
LHS
,
Expr
)]
pattern
SimpleLoopInits
typ
var
expr
=
Left
[
Variable
Local
typ
var
[]
expr
]
pattern
SimpleLoopInits
msg
typ
var
expr
=
Left
[
CommentDecl
msg
,
Variable
Local
typ
var
[]
expr
]
pattern
SimpleLoopGuard
::
BinOp
->
Identifier
->
Expr
->
Expr
pattern
SimpleLoopGuard
cmp
var
bound
=
BinOp
cmp
(
Ident
var
)
bound
...
...
@@ -177,7 +178,7 @@ convertStmt (Case unique kw expr cases) = do
return
$
Case
unique
kw
expr
cases'
convertStmt
(
For
(
inits
@
(
SimpleLoopInits
_
var1
_
))
(
inits
@
(
SimpleLoopInits
_
_
var1
_
))
(
comp
@
(
SimpleLoopGuard
_
var2
_
))
(
incr
@
(
SimpleLoopIncrs
var3
_
_
))
stmt
)
=
...
...
test/basic/simple_loop_jump.sv
0 → 100644
View file @
937a583e
module
top
;
function
automatic
integer
f
;
input
integer
inp
;
f
=
1
;
for
(
integer
idx
=
0
;
idx
<
inp
;
idx
=
idx
+
1
)
begin
if
(
f
==
32
)
break
;
f
=
f
*
2
;
end
endfunction
integer
i
;
initial
for
(
i
=
0
;
i
<
10
;
i
=
i
+
1
)
$
display
(
"f(%0d) = %0d"
,
i
,
f
(
i
))
;
endmodule
test/basic/simple_loop_jump.v
0 → 100644
View file @
937a583e
module
top
;
function
automatic
integer
f
;
input
integer
inp
;
if
(
inp
>
5
)
f
=
32
;
else
f
=
2
**
inp
;
endfunction
integer
i
;
initial
for
(
i
=
0
;
i
<
10
;
i
=
i
+
1
)
$
display
(
"f(%0d) = %0d"
,
i
,
f
(
i
))
;
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