using GHDL to compile some VHDL getting a weird error. simulation compiler for VHDL fails on line: "case i_cli_adr is" with error message: "vhdl: object subtype is not locally static". How to fix it?
library ieee;
use ieee.std_logic_1164.all;
entity sim_regs is
generic(
LW : integer := 16
);
port(
i_sys_clk : in std_logic;
i_sys_rst_n : in std_logic;
i_cli_vld : in std_logic;
i_cli_wnr : in std_logic;
i_cli_adr : in std_logic_vector(LW-1 downto 0);
i_cli_dat : in std_logic_vector(LW-1 downto 0);
);
end entity;
architecture sim of sim_regs is
signal testreg0 : std_logic_vector(LW-1 downto 0);
signal testreg1 : std_logic_vector(LW-1 downto 0);
signal awrite : std_logic;
begin
awrite <= i_cli_vld and i_cli_wnr;
process(i_sys_clk)
begin
if (i_sys_clk = '1' and i_sys_clk'event) then
if (i_sys_rst_n = '0') then
testreg0 <= (others => '0');
testreg1 <= (others => '0');
end if;
else
o_cli_rvld <= '0';
if (awrite = '1') then
case i_cli_adr is
when 0 => testreg0 <= i_cli_dat;
when 1 => testreg1 <= i_cli_dat;
end case;
end if;
end if;
end process;
end architecture;