aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-10-29 16:02:53 +0200
committerTristan Gingold <tgingold@free.fr>2022-10-29 16:02:53 +0200
commit98f5c0a02f08b912a33923d5383f6d22ff00d3ca (patch)
tree862ff821786cc858c5b089f16af1a7bf56ecf248 /src/synth
parent0f79086ca4b9efaec0a6d251d29edd87bfb2ee83 (diff)
downloadghdl-98f5c0a02f08b912a33923d5383f6d22ff00d3ca.tar.gz
ghdl-98f5c0a02f08b912a33923d5383f6d22ff00d3ca.tar.bz2
ghdl-98f5c0a02f08b912a33923d5383f6d22ff00d3ca.zip
elab-vhdl_types: abstract elab_floating_type_definition
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/elab-vhdl_types.adb25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/synth/elab-vhdl_types.adb b/src/synth/elab-vhdl_types.adb
index 81ab20268..b3ec1fed5 100644
--- a/src/synth/elab-vhdl_types.adb
+++ b/src/synth/elab-vhdl_types.adb
@@ -474,6 +474,20 @@ package body Elab.Vhdl_Types is
return Create_Discrete_Type (Rng, Scalar_Size_To_Size (Def), W);
end Elab_Scalar_Type_Definition;
+ function Elab_Floating_Type_Definition (Def : Node; St : Node)
+ return Type_Acc
+ is
+ pragma Unreferenced (Def);
+ Cst : constant Node := Get_Range_Constraint (St);
+ L, R : Fp64;
+ Rng : Float_Range_Type;
+ begin
+ L := Get_Fp_Value (Get_Left_Limit (Cst));
+ R := Get_Fp_Value (Get_Right_Limit (Cst));
+ Rng := (Get_Direction (Cst), L, R);
+ return Create_Float_Type (Rng);
+ end Elab_Floating_Type_Definition;
+
procedure Elab_Anonymous_Type_Definition
(Syn_Inst : Synth_Instance_Acc; Def : Node; St : Node)
is
@@ -486,16 +500,7 @@ package body Elab.Vhdl_Types is
| Iir_Kind_Physical_Type_Definition =>
Typ := Elab_Scalar_Type_Definition (Def, St);
when Iir_Kind_Floating_Type_Definition =>
- declare
- Cst : constant Node := Get_Range_Constraint (St);
- L, R : Fp64;
- Rng : Float_Range_Type;
- begin
- L := Get_Fp_Value (Get_Left_Limit (Cst));
- R := Get_Fp_Value (Get_Right_Limit (Cst));
- Rng := (Get_Direction (Cst), L, R);
- Typ := Create_Float_Type (Rng);
- end;
+ Typ := Elab_Floating_Type_Definition (Def, St);
when Iir_Kind_Array_Type_Definition =>
Typ := Synth_Array_Type_Definition (Syn_Inst, Def);
when others =>