Altera_Forum
Honored Contributor
15 years agoI got error because of not proper use of std_logic and bit, please help me in solving
----------------------------------------------------------------------------------
-- Company: -- Engineer: -- -- Create Date: 15:16:54 02/14/2011 -- Design Name: -- Module Name: glu - Behavioral -- Project Name: -- Target Devices: -- Tool versions: -- Description: -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ---- Uncomment the following library declaration if instantiating ---- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; ---------------------------------------------------------------------------------- --ENTITY Declarations ---------------------------------------------------------------------------------- ENTITY glu is port( Data_reg: OUT STD_LOGIC_vector(11 downto 0); Creg: out STD_LOGIC_vector(4 downto 0)); end glu; ---------------------------------------------------------------------------------- --Architecture Body ---------------------------------------------------------------------------------- architecture Behavioral of glu is TYPE Memory IS ARRAY (0 TO 1026) OF STD_LOGIC_VECTOR(7 DOWNTO 0); SIGNAL Ram : Memory; rows and 8 bit in each rowSIGNAL Temp1,Temp2,Temp3: STD_LOGIC_VECTOR(15 DOWNTO 0) ; SIGNAL A1A0,CS: STD_LOGIC_VECTOR(1 DOWNTO 0) ; SIGNAL Temp2,Mirror_Num10 ,Mirror_Num20,Axis10,Temp10,Temp40,Temp3:STD_LOGIC_VECTOR(15 DOWNTO 0); SIGNAL Temp1,Mirror_Num ,Mirror_Num2 ,Temp4,Axis : BIT_VECTOR(15 DOWNTO 0); SIGNAL Cur_Add: STD_LOGIC_VECTOR(31 downto 0); SIGNAL Base_Add:STD_LOGIC_VECTOR:=x"00000000"; SIGNAL Mnum_Add:STD_LOGIC_VECTOR:=x"00000403"; SIGNAL flag:STD_LOGIC_VECTOR:= x"00000400"; SIGNAL Axis_Add:STD_LOGIC_VECTOR:=x"00000401"; SIGNAL X:STD_LOGIC_VECTOR:="000000000000000"; SIGNAL Y :STD_LOGIC_VECTOR:="0000000000000010"; BEGIN process(Ram(Conv_Integer(flag))) -- Process begin and we take the flag in sensitivity list. BEGIN IF ( Ram(Conv_Integer(flag))='1') THEN Mirror_Num(15 DOWNTO 8) <= CONV_STD_LOGIC_VECTOR (Ram(Conv_Integer(Mnum_Add))); --Store the value of the mirror number in the Temp1 Mirror_Num(7 DOWNTO 0) <= CONV_STD_LOGIC_VECTOR (Ram(Conv_Integer(Mnum_Add+1))); Axis(15 DOWNTO 8) <= CONV_STD_LOGIC_VECTOR (Ram(Conv_Integer(Axis_Add))); --Store the value for choosing X or Y axis in temp2 Axis(7 DOWNTO 0) <= CONV_STD_LOGIC_VECTOR (Ram(Conv_Integer(Axis_Add+1))); Mirror_Num2 <= Mirror_Num sla 1 ; --Multiply mirror number by 2 If(Axis=X) THEN --Check for the X axis Cur_Add<= (Base_Add + (Mirror_Num sla 2) + Axis); --If we have to move the mirror in X axis then current address of BRAM is Temp1 <= Mirror_Num2 + Axis ; ELSIf(Axis=Y) THEN --Check for the Y axis Cur_Add<= (Base_Add + (Mirror_Num sla 2) + Axis); --If we have to move the mirror in X axis then current address of BRAM is Temp1 <= Axis sra 1 + Mirror_Num2; END IF; Temp4 <= Temp1 sra 2; Mirror_Num10 <= CONV_STD_LOGIC_VECTOR( Mirror_Num) ; Mirror_Num20 <= CONV_STD_LOGIC_VECTOR ( Mirror_Num2 ) ; Axis10 <= CONV_STD_LOGIC_VECTOR ( Axis ) ; Temp10 <= CONV_STD_LOGIC_VECTOR ( Temp1 ) ; Temp40 <= CONV_STD_LOGIC_VECTOR ( Temp4 ) ; DATA_reg(11:8)<=Ram(Conv_Integer(Cur_Add))(3:0); -- Put the value of the current address of BRAM to Data reg DATA_reg(7:0)<=Ram(Conv_Integer(Cur_Add+1)); Temp2 <= conv_STD_LOGIC_vector((conv_integer(Temp1) mod 4),16); --Calculation for the Position in Particular DAC according to mirrir number and axis selection. A1A0 <= Temp2(1 DOWNTO 0); Temp3 <= conv_STD_LOGIC_vector(conv_integer(Temp4),16) ; IF(Temp3="0000000000000000") THEN CS<="01"; ELSIF(Temp3="0000000000000001") THEN CS<="10"; END IF; --Calculation for chip select CS <= Temp3(1 DOWNTO 0); Creg(4 DOWNTO 3) <= CS ; -- Put the value for chip select and A1A0 in the control registor. Creg(2 DOWNTO 1) <= A1A0 ; Creg(0) <= '0' ; -- set the value of lsb of control registor to 0 for R/(W)bar -- If flag=0 then exit. END IF; END PROCESS; Creg(4 DOWNTO 3) <= "11" ; flag <= 0; END Behavioral; -------------------------------------------------------------------------------