I have a VHDL entity with some unconstrained std_logic_vector ports that is wrapped by a verilog module that clearly defines those port widths.
Verilog wrapper:
module conv_wrapper (din,dout,clk,ce);
input [7:0] din;
output [7:0] dout;
input clk;
input ce;
conv conv_inst (
.din(din),
.dout(dout),
.clk(clk),
.ce(ce));
endmodule
VHDL module:
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.numeric_std.ALL;
entity conv is
port(
clk : in std_logic;
ce : in std_logic;
din : in std_logic_vector;
dout : out std_logic_vector
);
end entity conv;
architecture behavioural of conv is
signal s_nosignbit : std_logic_vector(din'high - 1 downto din'low) := (others => '0');
signal s_nosignbit_not : std_logic_vector(din'high - 1 downto din'low) := (others => '0');
signal s_dout : std_logic_vector(din'range) := (others => '0');
signal msb : std_logic := '0';
begin
-- Assign the MSB
msb <= din(din'high);
-- Assign the rest of the bits excluding the MSB
s_nosignbit <= din(din'high - 1 downto din'low);
-- Perform bitwise NOT operation on s_nosignbit
s_nosignbit_not <= not s_nosignbit;
-- Concat
s_dout <= msb & s_nosignbit_not;
dout <= s_dout;
end architecture behavioural;
The VHDL module essentially just converts a number to 2's complement. There are probably simpler ways to do this but that is not the point here really.
I'm getting an error during simulation that this line:
s_nosignbit <= din(din'high - 1 downto din'low);
is incorrectly assigning the values as the "slice direction differs from its index type range".
I've often used unconstrained ports in my designs and have never seen this before. Does Vivado not correctly translate 7:0 as 7 downto 0 perhaps?
Using Vivado 2024.1
Thank you all.