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

Error when using inout record #176

Open
albydnc opened this issue Oct 19, 2022 · 3 comments
Open

Error when using inout record #176

albydnc opened this issue Oct 19, 2022 · 3 comments

Comments

@albydnc
Copy link

albydnc commented Oct 19, 2022

I declare an entity which has an inout record port.
When I run simulation in GHDL, it works as intended. When I try to run it through yosys I get this error:

$ yosys -m ghdl -ql ../model/design.log ../model/design.ys
shift_left.vhd:17:5:warning: no assignment for offsets 1:353 of port "snk"
    snk : inout t_comm_channel;
    ^
shift_left.vhd:18:5:warning: no assignment for offset 0 of port "src"
    src : inout t_comm_channel
    ^
ERROR: wire not found for $inout

The record is defined as:

  type t_comm_channel is record
    ready  : std_logic;
    valid  : std_logic;
    sop    : std_logic;
    eop    : std_logic;
    evid   : unsigned(EVID_BITS - 1 downto 0); 
    evtype : unsigned(7 downto 0);
    size   : unsigned(15 downto 0);
    empty  : unsigned(5 downto 0);
    data   : std_logic_vector(255 downto 0);
  end record;
@tmeissner
Copy link
Contributor

tmeissner commented Oct 19, 2022

Inout ports of record types don't work with VHDL (pre VHDL-2019) synthesis. You have to split your record in two, one for each direction. This isn't a GHDL limitation, it's more a limitation of the language, which was solved with VHDL-2019 interfaces.

Hmmm, right - it's more a limitation of FPGA-hardware, VHDL itself supports bidirectional records, I use it in simulation for my verification components a lot.

@tgingold
Copy link
Member

tgingold commented Oct 19, 2022 via email

@albydnc
Copy link
Author

albydnc commented Oct 20, 2022

Here you go @tgingold.

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

package utils is
    type t_comm_channel is record
        valid : std_logic;
        ready : std_logic;
        data  : std_logic_vector(15 downto 0);
    end record;
end package;

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.utils.all;

entity test is
    port (
        input : inout t_comm_channel;
        output : inout t_comm_channel
    );
end entity;

architecture rtl of test is
begin
    output <= input;
end architecture;

in yosys (with ghdl module loaded), run ghdl --std=08 test.vhdl -e test.

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

No branches or pull requests

3 participants