Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VPI: cannot access constant variables of array type (array, std_logic, signed, ...) #2300

Open
1 of 3 tasks
Scafir opened this issue Jan 6, 2023 · 2 comments
Open
1 of 3 tasks

Comments

@Scafir
Copy link

Scafir commented Jan 6, 2023

Description
Using VPI (cocotb 0.2.3) with latest ghdl, trying to access a constant array results in vpi_get: unknown property.

Expected behaviour
The value of the constant array should be accessible and not error should happen.

How to reproduce?

LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE ieee.numeric_std.ALL;

ENTITY main IS
    PORT (
        data_out : out  std_logic_vector(15 DOWNTO 0));
END main;

ARCHITECTURE structure OF main IS
    TYPE memT IS ARRAY(0 to 2) OF unsigned(15 DOWNTO 0);
    SIGNAL mem : memT;
    CONSTANT memC : memT := (others => (others => '0'));

BEGIN
    data_out <= std_logic_vector(mem(0));
END structure;
import cocotb
from cocotb.triggers import Timer

@cocotb.test()
async def init_test(dut):
    await Timer(1)

    print("Elements in dut:")
    print(dir(dut))
    print ("")
    print("Memory: ")
    print(dut.mem[0].value)
    # Following line makes GHDL crash
    print(dut.memC[0].value)
VHDL_SOURCES = $(PWD)/main.vhd
TOPLEVEL = main
MODULE = test_main
SIM = ghdl

include $(shell cocotb-config --makefiles)/Makefile.sim

Context
Please, provide the following information:

  • OS: Fedora 37
  • Origin:
    • Package manager: version
    • Released binaries: tarball_url
    • Built from sources: 65a40a067d1b153265eaf8bcadbc225c5eeac041

Maybe helpful material
Issue #237, closed with c64e7ba

@Scafir Scafir changed the title VPI: cannot read constant arrays VPI: cannot access constant arrays Jan 6, 2023
@Scafir Scafir changed the title VPI: cannot access constant arrays VPI: cannot access constant variables of array type (array, std_logic, signed, ...) Apr 6, 2023
@Scafir
Copy link
Author

Scafir commented Apr 6, 2023

With further inspection, it seems any array-based variable is impacted by this. On top of my head:

  • std_logic_vector
  • signed/unsigned
  • arrays
  • ufixed/sfixed
  • ...

I have deleted my previous comment, which was misleading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants