diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-10-20 07:48:53 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-10-20 07:48:53 +0200 |
commit | af3c9bd03c53d1ac91d35171317b8b8e8f682d89 (patch) | |
tree | 19972a8de51568e253bd20c4af3888cc24899770 | |
parent | e03c4cb598c99190e870d08c6f1d547b9da046a7 (diff) | |
download | ghdl-af3c9bd03c53d1ac91d35171317b8b8e8f682d89.tar.gz ghdl-af3c9bd03c53d1ac91d35171317b8b8e8f682d89.tar.bz2 ghdl-af3c9bd03c53d1ac91d35171317b8b8e8f682d89.zip |
netlists-dump: also dump instances location.
-rw-r--r-- | src/synth/netlists-dump.adb | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/src/synth/netlists-dump.adb b/src/synth/netlists-dump.adb index 85080050d..f7d2f5767 100644 --- a/src/synth/netlists-dump.adb +++ b/src/synth/netlists-dump.adb @@ -18,11 +18,14 @@ -- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, -- MA 02110-1301, USA. -with Ada.Text_IO; use Ada.Text_IO; +with Simple_IO; use Simple_IO; with Name_Table; +with Files_Map; + with Netlists.Utils; use Netlists.Utils; with Netlists.Iterators; use Netlists.Iterators; with Netlists.Gates; use Netlists.Gates; +with Netlists.Locations; package body Netlists.Dump is procedure Put_Indent (Indent : Natural) is @@ -40,6 +43,11 @@ package body Netlists.Dump is end if; end Put_Trim; + procedure Put_Uns32 (V : Uns32) is + begin + Put_Trim (Uns32'Image (V)); + end Put_Uns32; + procedure Put_Width (W : Width) is begin Put_Trim (Width'Image (W)); @@ -80,7 +88,7 @@ package body Netlists.Dump is Dump_Name (Prefix); end if; Put ("%"); - Put_Trim (Uns32'Image (Get_Sname_Version (N))); + Put_Uns32 (Get_Sname_Version (N)); end case; end Dump_Name; @@ -141,12 +149,32 @@ package body Netlists.Dump is when Param_Invalid => Put ("invalid"); when Param_Uns32 => - Put_Trim (Uns32'Image (Get_Param_Uns32 (Inst, Idx))); + Put_Uns32 (Get_Param_Uns32 (Inst, Idx)); end case; end Dump_Parameter; - procedure Dump_Instance (Inst : Instance; Indent : Natural := 0) is + procedure Dump_Instance (Inst : Instance; Indent : Natural := 0) + is + Loc : constant Location_Type := Locations.Get_Location (Inst); begin + if Loc /= No_Location then + declare + File : Name_Id; + Line : Positive; + Col : Natural; + begin + Put_Indent (Indent); + Put ("# "); + Files_Map.Location_To_Position (Loc, File, Line, Col); + Put (Name_Table.Image (File)); + Put (':'); + Put_Uns32 (Uns32 (Line)); + Put (':'); + Put_Uns32 (Uns32 (Col)); + New_Line; + end; + end if; + Put_Indent (Indent); Put ("instance "); Dump_Name (Get_Instance_Name (Inst)); @@ -415,10 +443,10 @@ package body Netlists.Dump is Disp_Driver (Get_Input_Net (Inst, 0)); Put ('['); if W > 1 then - Put_Trim (Uns32'Image (Off + W - 1)); + Put_Uns32 (Off + W - 1); Put (':'); end if; - Put_Trim (Uns32'Image (Off)); + Put_Uns32 (Off); Put (']'); return; end; |