F
fl
Guest
Hi,
VHDL grammar is still not easy to me. I see this line on a forum:
architecture lut of bit_count is
subtype lutin is std_logic_vector (3 downto 0);
subtype lutout is std_logic_vector (2 downto 0);
type lut00 is array (natural range 0 to 15) of lutout;
constant bitcount: lut00 := (
"000", "001", "001", "010",
"011", "010", "010", "011",
"001", "010", "010", "011",
"010", "011", "011", "100"
);
signal temp: std_logic_vector (2 downto 0);
begin
temp <= bitcount( TO_INTEGER ( unsigned (lutin(a&b&c&d) ) ) );
.....
it has an error:
Illegal type conversion to lutin (operand type is not known).
I know the correct answer is:
temp <= bitcount( TO_INTEGER ( unsigned (lutin'(a&b&c&d) ) ) );
but I don't know the detail rule on understanding it. Online search ' gives
predefined attribute. Obviously here is not an attribute. What function of '
is here?
Thanks,
VHDL grammar is still not easy to me. I see this line on a forum:
architecture lut of bit_count is
subtype lutin is std_logic_vector (3 downto 0);
subtype lutout is std_logic_vector (2 downto 0);
type lut00 is array (natural range 0 to 15) of lutout;
constant bitcount: lut00 := (
"000", "001", "001", "010",
"011", "010", "010", "011",
"001", "010", "010", "011",
"010", "011", "011", "100"
);
signal temp: std_logic_vector (2 downto 0);
begin
temp <= bitcount( TO_INTEGER ( unsigned (lutin(a&b&c&d) ) ) );
.....
it has an error:
Illegal type conversion to lutin (operand type is not known).
I know the correct answer is:
temp <= bitcount( TO_INTEGER ( unsigned (lutin'(a&b&c&d) ) ) );
but I don't know the detail rule on understanding it. Online search ' gives
predefined attribute. Obviously here is not an attribute. What function of '
is here?
Thanks,