aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/netlists-dump.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-11-17 21:26:18 +0100
committerTristan Gingold <tgingold@free.fr>2021-11-17 21:26:18 +0100
commitd6f1c6a47fb8df07fca517fb68078c324c761a97 (patch)
tree593370741aad5338b171137d7822e50cd559db25 /src/synth/netlists-dump.adb
parente890899a52b1b879694a41759e7644613d7bd1a6 (diff)
downloadghdl-d6f1c6a47fb8df07fca517fb68078c324c761a97.tar.gz
ghdl-d6f1c6a47fb8df07fca517fb68078c324c761a97.tar.bz2
ghdl-d6f1c6a47fb8df07fca517fb68078c324c761a97.zip
synth: use a global table for instances attributes
Diffstat (limited to 'src/synth/netlists-dump.adb')
-rw-r--r--src/synth/netlists-dump.adb92
1 files changed, 40 insertions, 52 deletions
diff --git a/src/synth/netlists-dump.adb b/src/synth/netlists-dump.adb
index bd9554839..256fd978f 100644
--- a/src/synth/netlists-dump.adb
+++ b/src/synth/netlists-dump.adb
@@ -209,6 +209,44 @@ package body Netlists.Dump is
end case;
end Dump_Parameter;
+ procedure Dump_Attributes (Inst : Instance; Indent : Natural := 0)
+ is
+ Attrs : constant Attribute := Get_Instance_First_Attribute (Inst);
+ Attr : Attribute;
+ Kind : Param_Type;
+ Val : Pval;
+ begin
+ Attr := Attrs;
+ while Attr /= No_Attribute loop
+ pragma Assert (Has_Instance_Attribute (Inst));
+
+ Put_Indent (Indent);
+ Put ("attribute ");
+ Put_Id (Get_Attribute_Name (Attr));
+ Put (" of ");
+ Dump_Name (Get_Instance_Name (Inst));
+ Disp_Instance_Id (Inst);
+ Put (" := ");
+ Kind := Get_Attribute_Type (Attr);
+ Val := Get_Attribute_Pval (Attr);
+ case Kind is
+ when Param_Invalid
+ | Param_Uns32 =>
+ Put ("??");
+ when Param_Pval_String =>
+ Disp_Pval_String (Val);
+ when Param_Pval_Vector
+ | Param_Pval_Integer
+ | Param_Pval_Boolean
+ | Param_Pval_Real
+ | Param_Pval_Time_Ps =>
+ Disp_Pval_Binary (Val);
+ end case;
+ Put_Line (";");
+ Attr := Get_Attribute_Next (Attr);
+ end loop;
+ end Dump_Attributes;
+
procedure Dump_Instance (Inst : Instance; Indent : Natural := 0)
is
Loc : constant Location_Type := Locations.Get_Location (Inst);
@@ -231,6 +269,8 @@ package body Netlists.Dump is
end;
end if;
+ Dump_Attributes (Inst, Indent);
+
Put_Indent (Indent);
Put ("instance ");
Dump_Name (Get_Instance_Name (Inst));
@@ -309,56 +349,6 @@ package body Netlists.Dump is
New_Line;
end Dump_Module_Port;
- procedure Dump_Attributes (M : Module; Indent : Natural := 0)
- is
- Attrs : constant Instances_Attribute_Map_Acc :=
- Get_Instance_Attributes (M);
- Attr : Attribute;
- Inst : Instance;
- Kind : Param_Type;
- Val : Pval;
- begin
- if Attrs = null then
- -- No attributes at all.
- return;
- end if;
-
- for I in Instances_Attribute_Maps.First_Index
- .. Instances_Attribute_Maps.Last_Index (Attrs.all)
- loop
- Attr := Instances_Attribute_Maps.Get_Value (Attrs.all, I);
- Inst := Instances_Attribute_Maps.Get_By_Index (Attrs.all, I);
- while Attr /= No_Attribute loop
- pragma Assert (Has_Instance_Attribute (Inst));
-
- Put_Indent (Indent);
- Put ("attribute ");
- Put_Id (Get_Attribute_Name (Attr));
- Put (" of ");
- Dump_Name (Get_Instance_Name (Inst));
- Disp_Instance_Id (Inst);
- Put (" := ");
- Kind := Get_Attribute_Type (Attr);
- Val := Get_Attribute_Pval (Attr);
- case Kind is
- when Param_Invalid
- | Param_Uns32 =>
- Put ("??");
- when Param_Pval_String =>
- Disp_Pval_String (Val);
- when Param_Pval_Vector
- | Param_Pval_Integer
- | Param_Pval_Boolean
- | Param_Pval_Real
- | Param_Pval_Time_Ps =>
- Disp_Pval_Binary (Val);
- end case;
- Put_Line (";");
- Attr := Get_Attribute_Next (Attr);
- end loop;
- end loop;
- end Dump_Attributes;
-
procedure Dump_Module_Header (M : Module; Indent : Natural := 0) is
begin
-- Module id and name.
@@ -419,8 +409,6 @@ package body Netlists.Dump is
Dump_Module (S, Indent + 1);
end loop;
- Dump_Attributes (M, Indent + 1);
-
declare
Self : constant Instance := Get_Self_Instance (M);
begin