siowyein
Newbie level 2
I m curently work out this converter but the compilation is not successful. Below is the codes and error message. And I am using shift add3 algorithm for this.
LIBRARY ieee;
USE ieee.STD_LOGIC_1164.all;
USE ieee.STD_LOGIC_ARITH.all;
USE ieee.STD_LOGIC_UNSIGNED.all;
--use work.project.all;
ENTITY projectTest3 IS
port( D : in std_logic_vector(15 downto 0);
Q : out std_logic_vector(15 downto 0));
END projectTest3;
ARCHITECTURE behavioral OF projectTest3 IS
Begin
PROCESS(D)
variable r: STD_LOGIC_VECTOR (15 DOWNTO 0);
variable a: integer :=10;
BEGIN
r:=(others=>'0');
r(4 DOWNTO 0):=D(15 DOWNTO 11);
FOR i IN 0 TO 9 loop
IF D(a)='1' then
r(4+(i+1) DOWNTO 0) := r(4+i DOWNTO 0) & '1';
ELSE
r(4+(i+1) DOWNTO 0) := r(4+i DOWNTO 0) & '0';
END IF;
a:=a-1;
IF r(3 DOWNTO 0) >= 5 then
r(3 DOWNTO 0) := r(3 DOWNTO 0) + "0011";
IF r(7 DOWNTO 4) >= 5 then
r(7 DOWNTO 4) := r(7 DOWNTO 4) + "0011";
IF r(11 DOWNTO 8) >= 5 then
r(11 DOWNTO 8) := r(11 DOWNTO 8) + "0011";
END IF;
END IF;
END IF;
END LOOP;
Q(15 downto 0) <= r(15 downto 0);
END PROCESS;
end behavioral;
Error: a deferred constant declaration without a full declaration is not supported
ANYone can help?
I think the problem is occurred at D(a)='1', but i dont know how to change it
LIBRARY ieee;
USE ieee.STD_LOGIC_1164.all;
USE ieee.STD_LOGIC_ARITH.all;
USE ieee.STD_LOGIC_UNSIGNED.all;
--use work.project.all;
ENTITY projectTest3 IS
port( D : in std_logic_vector(15 downto 0);
Q : out std_logic_vector(15 downto 0));
END projectTest3;
ARCHITECTURE behavioral OF projectTest3 IS
Begin
PROCESS(D)
variable r: STD_LOGIC_VECTOR (15 DOWNTO 0);
variable a: integer :=10;
BEGIN
r:=(others=>'0');
r(4 DOWNTO 0):=D(15 DOWNTO 11);
FOR i IN 0 TO 9 loop
IF D(a)='1' then
r(4+(i+1) DOWNTO 0) := r(4+i DOWNTO 0) & '1';
ELSE
r(4+(i+1) DOWNTO 0) := r(4+i DOWNTO 0) & '0';
END IF;
a:=a-1;
IF r(3 DOWNTO 0) >= 5 then
r(3 DOWNTO 0) := r(3 DOWNTO 0) + "0011";
IF r(7 DOWNTO 4) >= 5 then
r(7 DOWNTO 4) := r(7 DOWNTO 4) + "0011";
IF r(11 DOWNTO 8) >= 5 then
r(11 DOWNTO 8) := r(11 DOWNTO 8) + "0011";
END IF;
END IF;
END IF;
END LOOP;
Q(15 downto 0) <= r(15 downto 0);
END PROCESS;
end behavioral;
Error: a deferred constant declaration without a full declaration is not supported
ANYone can help?
I think the problem is occurred at D(a)='1', but i dont know how to change it