aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-decls.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-10-08 20:24:00 +0200
committerTristan Gingold <tgingold@free.fr>2019-10-08 20:24:00 +0200
commit9fc6a1b3e2b83dbed76f6792e72034f1bcb056ef (patch)
tree354ba36fb9559db59c528e8acb93597484337b7c /src/synth/synth-decls.adb
parente8db7dfc689d4aa25a5ce7227d60ba6d9779f490 (diff)
downloadghdl-9fc6a1b3e2b83dbed76f6792e72034f1bcb056ef.tar.gz
ghdl-9fc6a1b3e2b83dbed76f6792e72034f1bcb056ef.tar.bz2
ghdl-9fc6a1b3e2b83dbed76f6792e72034f1bcb056ef.zip
synth: handle read-only aliases. Fix #973
Diffstat (limited to 'src/synth/synth-decls.adb')
-rw-r--r--src/synth/synth-decls.adb10
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;