From 46af8fa0849ccfad4404786095d94161bf47c9bb Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 31 Oct 2017 06:57:10 +0100 Subject: Fix VhpiNameP for VhpiForGenerateK: add generate label. Fix #450 --- src/grt/grt-avhpi.adb | 17 +++++++++-------- src/grt/grt-vpi.adb | 8 ++++---- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/grt/grt-avhpi.adb b/src/grt/grt-avhpi.adb index 06ad210a8..99097eb48 100644 --- a/src/grt/grt-avhpi.adb +++ b/src/grt/grt-avhpi.adb @@ -711,18 +711,19 @@ package body Grt.Avhpi is Add (Obj.Obj.Name); when VhpiForGenerateK => declare - Blk : Ghdl_Rtin_Block_Acc; - Iter : Ghdl_Rtin_Object_Acc; + Blk : constant Ghdl_Rtin_Block_Acc := + To_Ghdl_Rtin_Block_Acc (Obj.Ctxt.Block); + Iter : constant Ghdl_Rtin_Object_Acc := + To_Ghdl_Rtin_Object_Acc (Blk.Children (0)); + Vptr : constant Ghdl_Value_Ptr := To_Ghdl_Value_Ptr + (Loc_To_Addr (Iter.Common.Depth, Iter.Loc, Obj.Ctxt)); Iter_Type : Ghdl_Rti_Access; - Vptr : Ghdl_Value_Ptr; Buf : String (1 .. 12); Buf_Len : Natural; begin - Blk := To_Ghdl_Rtin_Block_Acc (Obj.Ctxt.Block); - Iter := To_Ghdl_Rtin_Object_Acc (Blk.Children (0)); - Vptr := To_Ghdl_Value_Ptr - (Loc_To_Addr (Iter.Common.Depth, Iter.Loc, Obj.Ctxt)); - Add (Blk.Name); + -- Add the name of the generate (need to skip the + -- generate body). + Add (To_Ghdl_Rtin_Generate_Acc (Blk.Parent).Name); Add ('('); Iter_Type := Iter.Obj_Type; if Iter_Type.Kind = Ghdl_Rtik_Subtype_Scalar then diff --git a/src/grt/grt-vpi.adb b/src/grt/grt-vpi.adb index a3db80a6e..f5c183128 100644 --- a/src/grt/grt-vpi.adb +++ b/src/grt/grt-vpi.adb @@ -645,15 +645,15 @@ package body Grt.Vpi is end if; case Property is - when vpiFullName=> + when vpiFullName => Prop := VhpiFullNameP; - when vpiName=> + when vpiName => Prop := VhpiNameP; when vpiType => Tmpstring2 (1 .. 4) := "???" & NUL; return To_Ghdl_C_String (Tmpstring2'Address); - when others=> - dbgPut_Line ("vpi_get_str: undefined property"); + when others => + dbgPut_Line ("vpi_get_str: unhandled property"); return null; end case; Vhpi_Get_Str (Prop, Ref.Ref, Tmpstring2, Len); -- cgit v1.2.3