aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-context.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-07-26 04:32:07 +0200
committerTristan Gingold <tgingold@free.fr>2019-07-26 04:32:07 +0200
commit2075f8cf5995bc83a8edc07456331b5b0f5b6be1 (patch)
tree114477245057faf8957c9790b18c61d78f62605e /src/synth/synth-context.adb
parent1aa373bd730caa2a558cc02f3f6a0fb269316a16 (diff)
downloadghdl-2075f8cf5995bc83a8edc07456331b5b0f5b6be1.tar.gz
ghdl-2075f8cf5995bc83a8edc07456331b5b0f5b6be1.tar.bz2
ghdl-2075f8cf5995bc83a8edc07456331b5b0f5b6be1.zip
synth: preliminary support of integer subtypes.
Diffstat (limited to 'src/synth/synth-context.adb')
-rw-r--r--src/synth/synth-context.adb17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/synth/synth-context.adb b/src/synth/synth-context.adb
index 1d87df365..e4c0436e8 100644
--- a/src/synth/synth-context.adb
+++ b/src/synth/synth-context.adb
@@ -110,16 +110,29 @@ package body Synth.Context is
end;
when Iir_Kind_Array_Subtype_Definition =>
declare
- El_Type : constant Node := Get_Element_Subtype (Obj_Type);
Bounds : Value_Bound_Acc;
begin
Bounds := Synth_Array_Bounds (Syn_Inst, Obj_Type, 0);
- if Is_Bit_Type (El_Type) then
+ if Is_Vector_Type (Obj_Type) then
return Alloc_Wire (Kind, Obj, Bounds);
else
raise Internal_Error;
end if;
end;
+ when Iir_Kind_Integer_Subtype_Definition =>
+ declare
+ Rng : Value_Acc;
+ W : Width;
+ Bnd : Value_Bound_Acc;
+ begin
+ Rng := Get_Value (Syn_Inst, Obj_Type);
+ W := Get_Range_Width (Rng.Rng);
+ Bnd := Create_Value_Bound ((Dir => Iir_Downto,
+ Left => Int32 (W - 1),
+ Right => 0,
+ Len => W));
+ return Alloc_Wire (Kind, Obj, Bnd);
+ end;
when others =>
Error_Kind ("alloc_object", Obj_Type);
end case;