Skip to content

Registering VHPI ValueChange callback on field of signal with record type doesn't work #1045

@FireFox317

Description

@FireFox317

I found this issue while working with cocotb and NVC.

It returns the following error:

     2.00ns ERROR    gpi                                VHPI Error level 3: class kind vhpiSelectedNameK is not an object declaration
                                                        FILE /home/verysecretuser/simple.vhd:11
     2.00ns ERROR    gpi                                VHPI: Unable to register a callback handle for VHPI type vhpiCbValueChange(1001)
     2.00ns ERROR    gpi                                Failed to register a value change callback

With the following VHDL file:

library IEEE;
use IEEE.std_logic_1164.all;

entity simple is
end entity;

architecture rtl of simple is
    type record_t is record
        field : std_logic;
    end record;
    signal record_signal : record_t;
begin
    record_signal.field <= '0';
end architecture;

And following cocotb test:

import cocotb
from cocotb.triggers import RisingEdge

@cocotb.test()
async def simple_test(dut):
    await RisingEdge(dut.record_signal.field)

I have tested this on the latest release version 1.14.1.

Let me know if you need more information, or a way to reproduce, but thanks again for this very cool simulator!

Btw, something unrelated which I ran into while trying to make a small reproduceable is the following:
Note, if you ask cocotb to trigger on the RisingEdge of the signal itself (i.e await RisingEdge(dut.record_signal)), which maybe doesn't make sense at all(?), you get the following backtrace:

*** Caught signal 11 (SEGV_MAPERR) [address=(nil), ip=0x7fd99f665da7] ***

[0x558272ca379d] ../src/util.c:872 signal_handler.lto_priv.0
[0x7fd9988f351f] (/usr/lib/x86_64-linux-gnu/libc.so.6) 
[0x7fd99f665da7] (python3.10/site-packages/cocotb/libs/libgpi.so) cocotb/share/lib/gpi/GpiCommon.cpp:589 gpi_deregister_callback
[0x7fd9956fabfc] (python3.10/site-packages/cocotb/simulator.cpython-310-x86_64-linux-gnu.so) cocotb/share/lib/simulator/simulatormodule.cpp:835 _ZL10deregisterPN12_GLOBAL__N_114gpi_hdl_ObjectIP8GpiCbHdlEEP7_object
[0x7fd992f13bd9] (/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0) 
[0x7fd992ea2efd] (/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0) _PyEval_EvalFrameDefault
[0x7fd992feb3ae] (/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0) 
[0x7fd992ea2efd] (/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0) _PyEval_EvalFrameDefault
[0x7fd992feb3ae] (/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0) 
[0x7fd992ea2efd] (/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0) _PyEval_EvalFrameDefault
[0x7fd992feb3ae] (/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0) 
[0x7fd992ea2efd] (/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0) _PyEval_EvalFrameDefault
[0x7fd992feb3ae] (/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0) 
[0x7fd992ea2efd] (/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0) _PyEval_EvalFrameDefault
[0x7fd992feb3ae] (/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0) 
[0x7fd992f0b552] (/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0) 
[0x7fd992f0bed0] (/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0) PyObject_CallFunction
[0x7fd9957380f6] (python3.10/site-packages/cocotb/libs/libcocotb.so) cocotb/share/lib/embed/gpi_embed.cpp:326 _embed_sim_event
[0x7fd9957380f6] (python3.10/site-packages/cocotb/libs/libcocotb.so) cocotb/share/lib/embed/gpi_embed.cpp:314 _embed_sim_event
[0x7fd99f6655ff] (python3.10/site-packages/cocotb/libs/libgpi.so) cocotb/share/lib/gpi/GpiCommon.cpp:127 _Z13gpi_embed_endv
[0x7fd9956d1060] (python3.10/site-packages/cocotb/libs/libcocotbvhpi_nvc.so) _ZTv0_n40_N17VhpiShutdownCbHdl12run_callbackEv
[0x7fd9956d15dd] (python3.10/site-packages/cocotb/libs/libcocotbvhpi_nvc.so) cocotb/share/lib/vhpi/VhpiImpl.cpp:1034 handle_vhpi_callback
[0x558272db5d20] ../src/vhpi/vhpi-model.c:1553 vhpi_global_cb
[0x558272c9fc82] ../src/rt/model.c:432 model_run
[0x558272c9fc82] ../src/rt/model.c:857 run_cmd
[0x558272c9af44] ../src/nvc.c:2117 process_command
[0x558272c9e169] ../src/nvc.c:533 elaborate
[0x558272c9ae99] ../src/nvc.c:2115 process_command
[0x558272c96e16] ../src/nvc.c:2257 main

nvc 1.14.1 (Using LLVM 14.0.0) [x86_64-pc-linux-gnu]

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions