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
6d2cdf1d
Commit
6d2cdf1d
authored
Feb 09, 2021
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix infinite loop on mutually recursive functions
parent
d847fdfa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
5 deletions
+31
-5
src/Convert/Package.hs
+7
-5
test/basic/mutual_recursion.sv
+24
-0
No files found.
src/Convert/Package.hs
View file @
6d2cdf1d
...
...
@@ -438,21 +438,23 @@ addItems pis existingPIs ((item, usedPIs) : items) =
if
not
$
Set
.
disjoint
existingPIs
thisPI
then
-- this item was re-imported earlier in the module
addItems
pis
existingPIs
items
else
if
null
itemsToAdd
then
else
if
Map
.
null
itemsToAdd
then
-- this item has no additional dependencies
item
:
addItems
pis
(
Set
.
union
existingPIs
thisPI
)
items
else
-- this item has at least one un-met dependency
addItems
pis
existingPIs
(
addUsedPIs
chosen
:
(
item
,
usedPIs
)
:
items
)
addItems
remainingPIs
existingPIs
(
addUsedPIs
chosenItem
:
(
item
,
usedPIs
)
:
items
)
where
thisPI
=
case
item
of
MIPackageItem
packageItem
->
Set
.
fromList
$
piNames
packageItem
_
->
Set
.
empty
neededPIs
=
Set
.
difference
(
Set
.
difference
usedPIs
existingPIs
)
thisPI
itemsToAdd
=
map
MIPackageItem
$
Map
.
elems
$
Map
.
restrictKeys
pis
neededPIs
chosen
=
head
itemsToAdd
itemsToAdd
=
Map
.
restrictKeys
pis
neededPIs
(
chosenName
,
chosenPI
)
=
Map
.
findMin
itemsToAdd
chosenItem
=
MIPackageItem
chosenPI
remainingPIs
=
Map
.
delete
chosenName
pis
addItems
_
_
[]
=
[]
-- augment a module item with the set of identifiers it uses
...
...
test/basic/mutual_recursion.sv
0 → 100644
View file @
6d2cdf1d
module
top
;
function
automatic
integer
bar
;
input
integer
inp
;
begin
if
(
inp
==
0
)
bar
=
0
;
else
bar
=
1
+
foo
(
inp
-
1
)
;
end
endfunction
function
automatic
integer
foo
;
input
integer
inp
;
begin
if
(
inp
==
0
)
foo
=
0
;
else
foo
=
1
+
bar
(
inp
-
1
)
;
end
endfunction
initial
begin
$
display
(
"%d"
,
foo
(
10
))
;
$
display
(
"%d"
,
bar
(
11
))
;
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