aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-01-12 09:14:33 +0100
committerTristan Gingold <tgingold@free.fr>2020-01-12 09:15:38 +0100
commit7da5c8b0aeca0f824ac7af99dbcdb205d6e1f155 (patch)
tree36c3c784543556eb3c70ca21ed2dd72e5744bc71
parent5b62240d233c9c122c9fa2715e4d9bba677fe7cd (diff)
downloadghdl-7da5c8b0aeca0f824ac7af99dbcdb205d6e1f155.tar.gz
ghdl-7da5c8b0aeca0f824ac7af99dbcdb205d6e1f155.tar.bz2
ghdl-7da5c8b0aeca0f824ac7af99dbcdb205d6e1f155.zip
synth-expr: handle pos attribute. For #1080
-rw-r--r--src/synth/synth-expr.adb12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index 763e6379c..56f32a0ba 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -1923,6 +1923,18 @@ package body Synth.Expr is
B := Synth_Array_Attribute (Syn_Inst, Expr);
return Create_Value_Discrete (Int64 (B.Len), Expr_Type);
end;
+ when Iir_Kind_Pos_Attribute =>
+ declare
+ Param : constant Node := Get_Parameter (Expr);
+ V : Value_Acc;
+ Dtype : Type_Acc;
+ begin
+ V := Synth_Expression (Syn_Inst, Param);
+ Dtype := Get_Value_Type (Syn_Inst, Get_Type (Expr));
+ -- FIXME: to be generalized. Not always as simple as a
+ -- subtype conversion.
+ return Synth_Subtype_Conversion (V, Dtype, False, Expr);
+ end;
when Iir_Kind_Null_Literal =>
return Create_Value_Access (Expr_Type, Null_Heap_Index);
when Iir_Kind_Allocator_By_Subtype =>