From 9a2709515197bf90a545262025d943be978d2db4 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 16 Apr 2019 19:03:15 +0200 Subject: synth: handle free instances in net iterator. --- src/synth/netlists-iterators.adb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/synth/netlists-iterators.adb b/src/synth/netlists-iterators.adb index babf74eb8..2bb1c8c05 100644 --- a/src/synth/netlists-iterators.adb +++ b/src/synth/netlists-iterators.adb @@ -301,10 +301,12 @@ package body Netlists.Iterators is pragma Unreferenced (It); begin if Cur.Num > 1 then + -- Next net for the instance. return Nets_Cursor'(Inst => Cur.Inst, N => Cur.N + 1, Num => Cur.Num - 1); else + -- Next instance. declare Inst : Instance; Num : Port_Nbr; @@ -314,10 +316,13 @@ package body Netlists.Iterators is Inst := Get_Next_Instance (Inst); exit when Inst = No_Instance; Num := Get_Nbr_Outputs (Inst); - pragma Assert (Num > 0); - return Nets_Cursor'(Inst => Inst, - N => Get_First_Output (Inst), - Num => Num); + if Num = 0 then + pragma Assert (Get_Id (Get_Module (Inst)) = Id_Free); + else + return Nets_Cursor'(Inst => Inst, + N => Get_First_Output (Inst), + Num => Num); + end if; end loop; end; return Nets_Cursor'(Inst => No_Instance, -- cgit v1.2.3