You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GHDL 4.0.0 Recently added support for unconstrained array typedefs in VHDL, however as it seems this features hasn't been tested in cocotb and a bug occurs. when a constrained array is read from/written to GHDL performs the same as any other simulator, however when the dimensions of the array type is unconstrained a cocotb GPI error occurs.
How to reproduce?
Test
@cocotbTest()asyncdefrun(dut):
""" Template Test program """print(dut.test_constrained[0].value)
print(dut.test_unconstrained[0].value)
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entityrtl_benchisport(
clk : instd_logic
);
endrtl_bench;
architecturearchofrtl_benchistypeconstrained_array_tisarray (0to3) ofstd_logic_vector(7downto0);
typeunconstrained_array_tisarray (integerrange<>) ofstd_logic_vector;
signal test_constrained : constrained_array_t := (others=>x"ba");
signal test_unconstrained : unconstrained_array_t (0to3)(7downto0) := (others=>x"ba");
beginendarch;
Output
INFO cocotb:simulator.py:305 0.00ns DEBUG gpi VPI: Created GPI object from type ???(114)
INFO cocotb:simulator.py:305 0.00ns DEBUG gpi Checking rtl_bench.test_constrained exists
INFO cocotb:simulator.py:305 0.00ns DEBUG cocotb.test_constrained Created
INFO cocotb:simulator.py:305 0.00ns DEBUG gpi Checking if index 0 native through implementation VPI
INFO cocotb:simulator.py:305 0.00ns DEBUG gpi VPI: Indexable object initialized with range [7:0] and length >8<
INFO cocotb:simulator.py:305 0.00ns DEBUG gpi VPI: test_constrained[0] initialized with 8 elements
INFO cocotb:simulator.py:305 0.00ns DEBUG gpi VPI: Created GPI object from type ???(36)
INFO cocotb:simulator.py:305 0.00ns DEBUG gpi Checking rtl_bench.test_constrained[0] exists
INFO cocotb:simulator.py:305 0.00ns DEBUG cocotb.test_constrained[0] Created
INFO cocotb:simulator.py:305 10111010
INFO cocotb:simulator.py:305 0.00ns DEBUG gpi Searching for test_unconstrained
INFO cocotb:simulator.py:305 0.00ns DEBUG gpi VPI: Created GPI object from type ???(114)
INFO cocotb:simulator.py:305 0.00ns DEBUG gpi Checking rtl_bench.test_unconstrained exists
INFO cocotb:simulator.py:305 0.00ns DEBUG cocotb.test_unconstrained Created
INFO cocotb:simulator.py:305 0.00ns DEBUG gpi Checking if index 0 native through implementation VPI
INFO cocotb:simulator.py:305 0.00ns DEBUG gpi Unable to find handle through vpi_handle_by_index(), attempting second method
INFO cocotb:simulator.py:305 0.00ns DEBUG gpi Unable to vpi_get_handle_by_index test_unconstrained[0]
INFO cocotb:simulator.py:305 0.00ns WARNING gpi Failed to find a handle at index 0 via any registered implementation
INFO cocotb:simulator.py:305 0.00ns TRACE gpi Returning to simulator
INFO cocotb:simulator.py:305 0.00ns TRACE gpi Returning control to simulator
INFO cocotb:simulator.py:305 0.00ns TRACE gpi Passing control to GPI user
INFO cocotb:simulator.py:305 0.00ns TRACE gpi Returning to Python
INFO cocotb:simulator.py:305 0.00ns INFO cocotb.regression run failed
INFO cocotb:simulator.py:305 Traceback (most recent call last):
INFO cocotb:simulator.py:305 File "/data/firmware/src/pylib/cocotb/templates/avl_st_template/avl_st_template_test.py", line 43, in run
INFO cocotb:simulator.py:305 print(dut.test_unconstrained[0].value)
INFO cocotb:simulator.py:305 File "/usr/local/lib/python3.10/dist-packages/cocotb/handle.py", line 652, in __getitem__
INFO cocotb:simulator.py:305 raise IndexError(
INFO cocotb:simulator.py:305 IndexError: test_unconstrained(GPI_ARRAY) contains no object at index 0
Context
GHDL 4.0.0 Built from GCC
cocotb 1.8.1
Ubuntu 22.04
The text was updated successfully, but these errors were encountered:
Well, the vpi functions are implemented in grt-vpi.adb, which relies on information generated during compile-time (the so called rti) and described in grt-rtis.ads and similar files.
I am not sure the description is complete enough for the unconstrained elements.
But long-term, I'd like to get rid of RTIs and directly use the intermediate representation; that will be more accurate.
Description
GHDL 4.0.0 Recently added support for unconstrained array typedefs in VHDL, however as it seems this features hasn't been tested in cocotb and a bug occurs. when a constrained array is read from/written to GHDL performs the same as any other simulator, however when the dimensions of the array type is unconstrained a cocotb GPI error occurs.
How to reproduce?
Test
Output
Context
The text was updated successfully, but these errors were encountered: