In line 99, i concatenated keyval1 and keyval2 to get a 16 bit xkey signal.
Then in line 153, im trying to check if xkey is equal to E074. But it gives me the error “cant determine definition of operator =”. If i put x”E074″ then it gives an error “digit ‘0’ in based literal “X”E074″” must be smaller than base”. I cant figure out what to do and im kind of in a hurry. Any help is really appreciated.
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
--use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.math_real.all;
use work.SQUARE.all;
use IEEE.NUMERIC_STD.ALL;
entity VGA is
Port ( CLK25 : IN STD_LOGIC;
rez_160x120 : IN STD_LOGIC;
rez_320x240 : IN STD_LOGIC;
Hsync,Vsync : OUT STD_LOGIC;
Nblank : OUT STD_LOGIC;
activecam_o : OUT STD_LOGIC;
KEYS: IN STD_LOGIC_VECTOR(3 DOWNTO 0);
S: IN STD_LOGIC_VECTOR(1 DOWNTO 0);
--cam_data_i : IN STD_LOGIC_VECTOR(11 DOWNTO 0);
--activecam_i : IN STD_LOGIC;
R,G,B : OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
--distance_in : IN INTEGER range 0 to 255 ;
--motor_location_in : IN INTEGER range 0 to 360 ;
Nsync : OUT STD_LOGIC);
end VGA;
architecture Behavioral of VGA is
signal Hcnt:STD_LOGIC_VECTOR(9 downto 0):="0000000000";
signal Vcnt:STD_LOGIC_VECTOR(9 downto 0):="1000001000";
signal video:STD_LOGIC;
constant HM: integer :=799;
constant HD: integer :=640;
constant HF: integer :=16;
constant HB: integer :=48;
constant HR: integer :=96;
constant VM: integer :=524;
constant VD: integer :=480;
constant VF: integer :=10;
constant VB: integer :=33;
constant VR: integer :=2;
signal counter :integer range 0 to 200_000_000 :=0;
signal co :integer:=0;
signal ball_row: integer := 240; -- 480/2
signal ball_col: integer := 320; -- 640/2
signal ball_size : integer := 5;
type sinlut is array (0 to 359) of integer;--
signal sinrom : sinlut;
signal cosrom : sinlut;
--------- square
SIGNAL RGB: STD_LOGIC_VECTOR(3 DOWNTO 0);
SIGNAL DRAW1,DRAW2,DRAW3: STD_LOGIC;
SIGNAL SQ_X1,SQ_Y1: integer range 0 to 1688:=125;
SIGNAL SQ_X2,SQ_Y2: integer range 0 to 1688:=250;
SIGNAL SQ_X3,SQ_Y3: integer range 0 to 1688:=480;
signal pixel_column_W : std_logic_vector(9 downto 0);
signal pixel_row_W : std_logic_vector(9 downto 0);
signal HSYNC_W,VSYNC_W: STD_LOGIC;
-----
signal pixel_row : std_logic_vector(9 downto 0);
signal pixel_column : std_logic_vector(9 downto 0);
-------clock divider
signal slow_clk : STD_LOGIC;
component Clock_Divider
Port (
clk : in STD_LOGIC;
reset : in STD_LOGIC;
clock_out: out STD_LOGIC
);
end component;
-------------------------
signal clr,ps2c,ps2d: STD_LOGIC;
signal keyval1, keyval2, keyval3: STD_LOGIC_VECTOR(7 downto 0);
signal xkey: STD_LOGIC_VECTOR(15 downto 0);
component keyboard_ctrl is
port(
clk25: in STD_LOGIC;
clr: in STD_LOGIC;
PS2C: in STD_LOGIC;
PS2D: in STD_LOGIC;
keyval1: out STD_LOGIC_VECTOR(7 downto 0);
keyval2: out STD_LOGIC_VECTOR(7 downto 0);
keyval3: out STD_LOGIC_VECTOR(7 downto 0)
);
end component;
------------------------
begin
--------- adding clock divider
K1: keyboard_ctrl port map (clk25 => clk25, clr => clr, ps2c => ps2c, ps2d => ps2d, keyval1 => keyval1, keyval2 => keyval2, keyval3 => keyval3);
xkey <= keyval1 & keyval2;
U1: Clock_Divider port map (clk => CLK25, reset => '0', clock_out => slow_clk);
SQ_X3 <= 420;
SQ_Y3 <= 350;
--Hcnt <=std_logic_vector(to_unsigned(9, 10));
--Hsync <= HSYNC_W;
--Vsync <= VSYNC_W;
SQ(
to_integer(unsigned(pixel_column)),
to_integer(unsigned(pixel_row)),
SQ_X1,
SQ_Y1,
RGB,
DRAW1
);
SQ(
to_integer(unsigned(pixel_column)),
to_integer(unsigned(pixel_row)),
SQ_X2,
SQ_Y2,
RGB,
DRAW2
);
SQ(
to_integer(unsigned(pixel_column)),
to_integer(unsigned(pixel_row)),
SQ_X3,
SQ_Y3,
RGB,
DRAW3
);
genrom_sin: for i in 0 to 359 generate
constant x : real := sin ( real(i) * math_pi / real(179));
constant xn : integer := (integer (x * real(100)));
begin
sinrom(i) <= xn;
end generate;
genrom_cos: for i in 0 to 359 generate
constant x : real := cos ( real(i) * math_pi / real(179));
constant xn : integer := (integer (x * real(100)));
begin
cosrom(i) <= xn;
end generate;
pixel_column <= Hcnt;
pixel_row <= Vcnt;
---------------slow clock
process(slow_clk)
begin
if rising_edge(slow_clk) then
if S(0) = '1' then
if (xkey = "EO74") then
SQ_X1 <= SQ_X1 + 1;
end if;
if (xkey = "E06B") then
SQ_X1 <= SQ_X1 - 1;
end if;
if (xkey = "E072") then
SQ_Y1 <= SQ_Y1 - 1;
end if;
if (xkey = "E075") then
SQ_Y1 <= SQ_Y1 + 1;
end if;
end if;
if S(1) = '1' then
if (xkey = "EO74") then
SQ_X2 <= SQ_X2 + 1;
end if;
if (xkey = "E06B") then
SQ_X2 <= SQ_X2 - 1;
end if;
if (xkey = "E072") then
SQ_Y2 <= SQ_Y2 - 1;
end if;
if (xkey = "E075") then
SQ_Y2 <= SQ_Y2 + 1;
end if;
end if;
end if;
end process;
--------------------
process(CLK25)
begin
if (CLK25'event and CLK25='1') then
if (Hcnt = HM) then
Hcnt <= "0000000000";
if (Vcnt= VM) then
Vcnt <= "0000000000";
activecam_o <= '1';
else
if rez_160x120 = '1' then
if vCnt < 120-1 then
activecam_o <= '1';
end if;
elsif rez_320x240 = '1' then
if vCnt < 240-1 then
activecam_o <= '1';
end if;
else
if vCnt < 480-1 then
activecam_o <= '1';
end if;
end if;
Vcnt <= Vcnt+1;
end if;
else
if rez_160x120 = '1' then
if hcnt = 160-1 then
activecam_o <= '0';
end if;
elsif rez_320x240 = '1' then
if hcnt = 320-1 then
activecam_o <= '0';
end if;
else
if hcnt = 640-1 then
activecam_o <= '0';
end if;
end if;
Hcnt <= Hcnt + 1;
end if;
end if;
end process;
--process(CLK25)
--begin
-- if (rising_edge(CLK25)) then
-- if counter = 25_000_000 then
-- co <= 0;
-- elsif counter = 50_000_000 then
-- co <= 50;
-- elsif counter = 75_000_000 then
-- co <= 120;
-- elsif counter = 100_000_000 then
-- co <= 160;
-- elsif counter = 125_000_000 then
-- co <= 210;
-- elsif counter = 150_000_000 then
-- co <= 260;
-- elsif counter = 175_000_000 then
-- co <= 310;
-- elsif counter = 200_000_000 then
-- co <= 350;
-- counter <= 0;
-- end if;
-- counter <= counter + 1;
-- end if;
--end process;
process(video)
begin
-- if (distance_in > 0) then
-- if distance_in > 100 then -- if distance is higher than 200cm, show black point at 10x10 pixel
-- ball_row <= 10;
-- ball_col <= 10;
-- R <= (others => '0');
-- G <= (others => '0');
-- B <= (others => '0');
-- else
-- ball_col <= (distance_in*(cosrom (motor_location_in))/100)*2+320;---en son çembere göre 175 oldu için değelere maplamek istenilen sayıya bolunuğ çarpılıyor.
-- ball_row <= (distance_in*(sinrom (motor_location_in))/100)*2+240;-- ornek 175 en son cember normalde 175 150 istiyoruz =>>>>175/150 çarp
-- end if;
-- end if;
-----DRAW BACKGROUND BLACK---- square
IF(DRAW1='1')THEN
IF(S(0)='1')THEN
R <= (others => '1');
G <= (others => '0');
B <= (others => '0');
ELSE
R <= (others => '1');
G <= (others => '1');
B <= (others => '1');
END IF;
END IF;
IF(DRAW2='1')THEN
IF(S(1)='1')THEN
R <= (others => '1');
G <= (others => '0');
B <= (others => '0');
ELSE
R <= (others => '1');
G <= (others => '1');
B <= (others => '1');
END IF;
END IF;
IF(DRAW1='0' AND DRAW2 ='0')THEN
R <= (others => '0');
G <= (others => '0');
B <= (others => '0');
END IF;
-- if (pixel_row > 0 and pixel_row < 480 and pixel_column > 0 and pixel_column < 640) then
-- R <= (others => '0');
-- G <= (others => '0');
-- B <= (others => '0');
--
-- if (pixel_row = 1048 or pixel_column = 554)then
-- R <= (others => '1');
-- G <= (others => '1');
-- B <= (others => '1');
-- else
-- R <= (others => '0');
-- G <= (others => '0');
-- B <= (others => '0');
-- end if;
--
-- if (pixel_row = 1 or pixel_column = 1)then
-- R <= (others => '1');
-- G <= (others => '0');
-- B <= (others => '1');
-- end if;
--
-- if (pixel_row = 10 or pixel_column = 10)then
-- R <= (others => '1');
-- G <= (others => '1');
-- B <= (others => '0');
-- end if;
----------------------Lines----------------
if (pixel_row > 120 and pixel_column = 320)then
R <= (others => '1');
G <= (others => '1');
B <= (others => '1');
end if;
if (pixel_row = 120 and pixel_column > 0)then
R <= (others => '1');
G <= (others => '1');
B <= (others => '1');
end if;
-------------------------------------
-- IF(DRAW3='1')THEN
-- R <= (others => '1');
-- G <= (others => '1');
-- B <= (others => '1');
-- ELSE
-- R <= (others => '0');
-- G <= (others => '0');
-- B <= (others => '0');
-- end if;
-- if (pixel_row = 240 or pixel_column = 320)then
-- R <= (others => '0');
-- G <= (others => '1');
-- B <= (others => '0');
-- end if;
-- if (pixel_row = 100 or pixel_column = 100)then
-- R <= (others => '1');
-- G <= (others => '1');
-- B <= (others => '1');
-- end if;
--------------- burdan sonras� benim kendi �izimlerim merkezi ortadan sa�a 50 pixel kayd�rd�m
-----DRAW POINT MAGENTA----
-- if (activecam_i = '1') then
-- R <= cam_data_i(11 downto 8) & cam_data_i(11 downto 8);
-- G <= cam_data_i(7 downto 4) & cam_data_i(7 downto 4) ;
-- B <= cam_data_i(3 downto 0) & cam_data_i(3 downto 0) ;
-- end if;
------------------------------
-- if ( (pixel_column-50) > (ball_col - ball_size) and (pixel_column-50) < (ball_col + ball_size) and pixel_row > (ball_row - ball_size) and pixel_row < (ball_row + ball_size) ) then
-- R <= (others => '1');
-- G <= (others => '1');
-- B <= (others => '1');
-- end if;
----
-- if ( ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) <= 2500
-- and ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) >= 2401) then
-- R <= (others => '1');
-- G <= (others => '0');
-- B <= (others => '0');
-- end if;
--
-- if ( ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) <= 4900
-- and ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) >= 4761) then
-- R <= (others => '1');
-- G <= (others => '0');
-- B <= (others => '0');
-- end if;
--
-- if ( ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) <= 8100
-- and ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) >= 7921) then
-- R <= (others => '1');
-- G <= (others => '0');
-- B <= (others => '0');
-- end if;
--
-- if ( ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) <= 12100
-- and ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) >= 11881) then
-- R <= (others => '1');
-- G <= (others => '0');
-- B <= (others => '0');
-- end if;
--
-- if ( ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) <= 16900
-- and ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) >= 16641) then
-- R <= (others => '1');
-- G <= (others => '0');
-- B <= (others => '0');
-- end if;
--
-- if ( ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) <= 22500
-- and ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) >= 22201) then
-- R <= (others => '1');
-- G <= (others => '0');
-- B <= (others => '0');
-- end if;
--
-- if ( ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) <= 28900
-- and ( ((conv_integer(pixel_column)-370)*(conv_integer(pixel_column)-370)) + ((conv_integer(pixel_row)-240)*(conv_integer(pixel_row)-240)) ) >= 28561) then
-- R <= (others => '1');
-- G <= (others => '0');
-- B <= (others => '0');
-- end if;
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
--end if;
end process;
process(CLK25)
begin
if (CLK25'event and CLK25='1') then
if (Hcnt >= (HD+HF) and Hcnt <= (HD+HF+HR-1)) then --- Hcnt >= 656 and Hcnt <= 751
Hsync <= '0';
else
Hsync <= '1';
end if;
end if;
end process;
process(CLK25)
begin
if (CLK25'event and CLK25='1') then
if (Vcnt >= (VD+VF) and Vcnt <= (VD+VF+VR-1)) then ---Vcnt >= 490 and vcnt<= 491
Vsync <= '0';
else
Vsync <= '1';
end if;
end if;
end process;
--PROCESS(CLK25)
-- BEGIN
--IF(CLK25'EVENT AND CLK25='1')THEN
-- IF(DRAW1='1')THEN
-- IF(S(0)='1')THEN
-- R<=(others=>'1');
-- G<=(others=>'0');
-- B<=(others=>'0');
-- ELSE
-- R<=(others=>'1');
-- G<=(others=>'1');
-- B<=(others=>'1');
-- END IF;
-- END IF;
-- IF(DRAW2='1')THEN
-- IF(S(1)='1')THEN
-- R<=(others=>'1');
-- G<=(others=>'0');
-- B<=(others=>'0');
-- ELSE
-- R<=(others=>'1');
-- G<=(others=>'1');
-- B<=(others=>'1');
-- END IF;
-- END IF;
-- IF (DRAW1='0' AND DRAW2='0')THEN
-- R<=(others=>'0');
-- G<=(others=>'0');
-- B<=(others=>'0');
-- END IF;
-- IF(Hcnt<1688)THEN
-- Hcnt<=Hcnt+1;
-- ELSE
-- Hcnt <= "0000000000";
-- IF(Vcnt<1066)THEN
-- Vcnt<=Vcnt+1;
-- ELSE
-- Vcnt<= "0000000000";
-- IF(S(0)='1')THEN
-- IF(KEYS(0)='0')THEN
-- SQ_X1<=SQ_X1+5;
-- END IF;
-- IF(KEYS(1)='0')THEN
-- SQ_X1<=SQ_X1-5;
-- END IF;
-- IF(KEYS(2)='0')THEN
-- SQ_Y1<=SQ_Y1-5;
-- END IF;
-- IF(KEYS(3)='0')THEN
-- SQ_Y1<=SQ_Y1+5;
-- END IF;
-- END IF;
-- IF(S(1)='1')THEN
-- IF(KEYS(0)='0')THEN
-- SQ_X2<=SQ_X2+5;
-- END IF;
-- IF(KEYS(1)='0')THEN
-- SQ_X2<=SQ_X2-5;
-- END IF;
-- IF(KEYS(2)='0')THEN
-- SQ_Y2<=SQ_Y2-5;
-- END IF;
-- IF(KEYS(3)='0')THEN
-- SQ_Y2<=SQ_Y2+5;
-- END IF;
-- END IF;
-- END IF;
-- END IF;
-- IF((Hcnt>0 AND Hcnt<408) OR (Vcnt>0 AND Vcnt<42))THEN
-- R<=(others=>'0');
-- G<=(others=>'0');
-- B<=(others=>'0');
-- END IF;
-- IF(Hcnt>48 AND Hcnt<160)THEN----Hsync
-- HSYNC_W<='0';
-- ELSE
-- HSYNC_W<='1';
-- END IF;
-- IF(Vcnt>0 AND Vcnt<4)THEN----------Vsync
-- VSYNC_W<='0';
-- ELSE
-- VSYNC_W<='1';
-- END IF;
-- END IF;
-- END PROCESS;
Nsync <= '1';
video <= '1' when (Hcnt < HD) and (Vcnt < VD) else '0';
Nblank <= video;
end Behavioral;
I played with brackets ‘ and “, i removed X, tried adding paranthesis. Nothing worked
1
it didnt give an error when typed the hexadecimal values in binary but i dont get why this works and not hexadecimals (I did try putting an X right before the “)