sed_y
Newbie level 4
hi,
I made simple Gray code to implement gray code increment circuit as
however, i get error:
1) how is it unconstrained when it was constrained through generic.
2) if do something like this
it works fine.but, shouldn't compiler complain for gn as being unconstrained too?
any help?
I made simple Gray code to implement gray code increment circuit as
Code:
library ieee;
use ieee.std_logic_1164.all;
entity graycode_inc is
generic( n:natural := 3);
port( g: in std_logic_vector(n-1 downto 0);
gn : out std_logic_vector(n-1 downto 0)
);
end graycode_inc;
architecture behav of graycode_inc is
begin
with g select
gn <= "001" when "000",
"011" when "001",
"010" when "011",
"110" when "010",
"111" when "110",
"101" when "111",
"100" when "101",
"000" when others;
end behav;
however, i get error:
Code:
Selector (Signal 'g' of type std_logic_vector) is an unconstrained array
2) if do something like this
Code:
port( g: in std_logic_vector(2 downto 0);
gn : out std_logic_vector(n-1 downto 0)
);
any help?