diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-10-08 20:24:00 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-10-08 20:24:00 +0200 |
commit | 9fc6a1b3e2b83dbed76f6792e72034f1bcb056ef (patch) | |
tree | 354ba36fb9559db59c528e8acb93597484337b7c | |
parent | e8db7dfc689d4aa25a5ce7227d60ba6d9779f490 (diff) | |
download | ghdl-9fc6a1b3e2b83dbed76f6792e72034f1bcb056ef.tar.gz ghdl-9fc6a1b3e2b83dbed76f6792e72034f1bcb056ef.tar.bz2 ghdl-9fc6a1b3e2b83dbed76f6792e72034f1bcb056ef.zip |
synth: handle read-only aliases. Fix #973
-rw-r--r-- | src/synth/synth-decls.adb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb index fe5883ac3..408e8ecc6 100644 --- a/src/synth/synth-decls.adb +++ b/src/synth/synth-decls.adb @@ -617,7 +617,15 @@ package body Synth.Decls is Stmts.Synth_Assignment_Prefix (Syn_Inst, Get_Name (Decl), Obj, Off, Voff, Rdwd, Typ); pragma Assert (Voff = No_Net); - Res := Create_Value_Alias (Obj, Off, Typ); + if Obj.Kind = Value_Net then + -- Object is a net if it is not writable. Extract the + -- bits for the alias. + Res := Create_Value_Net + (Build2_Extract (Get_Build (Syn_Inst), Obj.N, Off, Typ.W), + Typ); + else + Res := Create_Value_Alias (Obj, Off, Typ); + end if; Res := Synth_Subtype_Conversion (Res, Obj_Type, True, Decl); Create_Object (Syn_Inst, Decl, Res); end; |