cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Tom1
Visitor
Visitor
274 Views
Registered: ‎02-05-2021

error 'Q' does not have attribute 'lenght'

I get "error 'Q' does not have attribute 'lenght'" in the line "Q <= std_logic_vector(to_unsigned(count, Q'lenght));" 

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity ELE218_Counter_up is

GENERIC ( N:INTEGER :=8) ;
Port ( R : in STD_LOGIC_VECTOR (N-1 downto 0);
Resetn : in STD_LOGIC;
E : in STD_LOGIC;
L : in STD_LOGIC;
clk : in STD_LOGIC;
Q : out STD_LOGIC_VECTOR (N-1 downto 0));
end ELE218_Counter_up;

architecture Behavioral of ELE218_Counter_up is

signal count: Integer range 0 to 2**N ;
begin
PROCESS (Resetn, clk)
begin
if resetn = '0' then
count <= 0;
elsif clk'event and clk ='1' then
if L = '1' then
count <= to_integer(unsigned(R));
elsif E = '1' then
count <= count +1;
end if;
end if;
end PROCESS;

Q <= std_logic_vector(to_unsigned(count, Q'lenght));

end Behavioral;

0 Kudos
3 Replies
bruce_karaffa
Scholar
Scholar
253 Views
Registered: ‎06-21-2017

Wouldn't it be just as easy to write:

Q <= std_logic_vector(to_unsigned(count, N));

bruce_karaffa
Scholar
Scholar
252 Views
Registered: ‎06-21-2017

Or you could try spelling length correctly.

Tom1
Visitor
Visitor
239 Views
Registered: ‎02-05-2021

haha, thank you. Even though english is not my native language I should spell that correctly

0 Kudos