aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-insts.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-03-13 05:38:04 +0100
committerTristan Gingold <tgingold@free.fr>2020-03-13 06:30:34 +0100
commit0c130072578b486ad74e19e96571c500138f81dc (patch)
tree38ab2d1cbbdf7e49dc54eb3da1fe3349b917073b /src/synth/synth-insts.adb
parent99cd9e61d58acd28dded11ef27f55e3ba955ae8c (diff)
downloadghdl-0c130072578b486ad74e19e96571c500138f81dc.tar.gz
ghdl-0c130072578b486ad74e19e96571c500138f81dc.tar.bz2
ghdl-0c130072578b486ad74e19e96571c500138f81dc.zip
synth-insts: handle record in generics.
Diffstat (limited to 'src/synth/synth-insts.adb')
-rw-r--r--src/synth/synth-insts.adb34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/synth/synth-insts.adb b/src/synth/synth-insts.adb
index 2824e4ce3..95597ea5d 100644
--- a/src/synth/synth-insts.adb
+++ b/src/synth/synth-insts.adb
@@ -183,7 +183,9 @@ package body Synth.Insts is
end case;
end Hash_Bounds;
- procedure Hash_Const (C : in out GNAT.SHA1.Context; Val : Value_Acc) is
+ procedure Hash_Const (C : in out GNAT.SHA1.Context;
+ Val : Value_Acc;
+ Typ : Type_Acc) is
begin
case Val.Kind is
when Value_Discrete =>
@@ -191,18 +193,27 @@ package body Synth.Insts is
when Value_Float =>
Hash_Uns64 (C, To_Uns64 (Val.Fp));
when Value_Const_Array =>
- -- Bounds.
- Hash_Bounds (C, Val.Typ);
- -- Values.
- for I in Val.Arr.V'Range loop
- Hash_Const (C, Val.Arr.V (I));
- end loop;
+ declare
+ El_Typ : constant Type_Acc := Get_Array_Element (Typ);
+ begin
+ -- Bounds.
+ Hash_Bounds (C, Typ);
+ -- Values.
+ for I in Val.Arr.V'Range loop
+ Hash_Const (C, Val.Arr.V (I), El_Typ);
+ end loop;
+ end;
when Value_Const_Record =>
for I in Val.Rec.V'Range loop
- Hash_Const (C, Val.Rec.V (I));
+ Hash_Const (C, Val.Rec.V (I), Typ.Rec.E (I).Typ);
end loop;
when Value_Const =>
- Hash_Const (C, Val.C_Val);
+ Hash_Const (C, Val.C_Val, Typ);
+ when Value_Alias =>
+ if Val.A_Off /= 0 then
+ raise Internal_Error;
+ end if;
+ Hash_Const (C, Val.A_Obj, Typ);
when Value_Net
| Value_Wire
| Value_Array
@@ -210,7 +221,6 @@ package body Synth.Insts is
| Value_Access
| Value_File
| Value_Instance
- | Value_Alias
| Value_Subtype =>
raise Internal_Error;
end case;
@@ -263,7 +273,7 @@ package body Synth.Insts is
begin
if Len + S'Length > Str_Len then
Has_Hash := True;
- Hash_Const (Ctxt, Gen);
+ Hash_Const (Ctxt, Gen, Gen.Typ);
else
Str (Len + 1 .. Len + S'Length) := S;
pragma Assert (Str (Len + 1) = ' ');
@@ -273,7 +283,7 @@ package body Synth.Insts is
end;
when others =>
Has_Hash := True;
- Hash_Const (Ctxt, Gen);
+ Hash_Const (Ctxt, Gen, Gen.Typ);
end case;
Gen_Decl := Get_Chain (Gen_Decl);
end loop;