From cceab917794f7c6016519380dadd51a8f537e976 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 28 Nov 2019 05:53:26 +0100 Subject: netlists-errors: can display instance numbers. --- src/synth/netlists-errors.adb | 45 +++++++++++++++++++++++++------------------ src/synth/netlists-errors.ads | 4 ++++ 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/synth/netlists-errors.adb b/src/synth/netlists-errors.adb index 0bee02e6a..b67af38d1 100644 --- a/src/synth/netlists-errors.adb +++ b/src/synth/netlists-errors.adb @@ -67,11 +67,15 @@ package body Netlists.Errors is pragma Unreferenced (Err); Inst : constant Instance := Instance (Val); begin - if Format = 'n' then - Output_Name_1 (Get_Instance_Name (Inst)); - else - raise Internal_Error; - end if; + case Format is + when 'n' => + Output_Name_1 (Get_Instance_Name (Inst)); + when 'i' => + Output_Message ("i"); + Output_Uns32 (Uns32 (Inst)); + when others => + raise Internal_Error; + end case; end Synth_Instance_Handler; procedure Synth_Net_Handler @@ -80,20 +84,23 @@ package body Netlists.Errors is pragma Unreferenced (Err); N : constant Net := Net (Val); begin - if Format = 'n' then - declare - Inst : constant Instance := Get_Net_Parent (N); - Idx : constant Port_Idx := Get_Port_Idx (N); - begin - if Is_Self_Instance (Inst) then - Output_Name_1 (Get_Input_Desc (Get_Module (Inst), Idx).Name); - else - Output_Name_1 (Get_Output_Desc (Get_Module (Inst), Idx).Name); - end if; - end; - else - raise Internal_Error; - end if; + case Format is + when 'n' => + declare + Inst : constant Instance := Get_Net_Parent (N); + Idx : constant Port_Idx := Get_Port_Idx (N); + Name : Sname; + begin + if Is_Self_Instance (Inst) then + Name := Get_Input_Desc (Get_Module (Inst), Idx).Name; + else + Name := Get_Output_Desc (Get_Module (Inst), Idx).Name; + end if; + Output_Name_1 (Name); + end; + when others => + raise Internal_Error; + end case; end Synth_Net_Handler; procedure Synth_Name_Handler diff --git a/src/synth/netlists-errors.ads b/src/synth/netlists-errors.ads index 33765017d..12302ecea 100644 --- a/src/synth/netlists-errors.ads +++ b/src/synth/netlists-errors.ads @@ -22,7 +22,11 @@ with Errorout; use Errorout; with Netlists.Locations; package Netlists.Errors is + -- For instances: + -- %n : name + -- %i : instance number function "+" (N : Instance) return Earg_Type; + function "+" (N : Net) return Earg_Type; function "+" (N : Sname) return Earg_Type; function "+" (N : Instance) return Location_Type -- cgit v1.2.3