Browse Source

FUNSIONA PAYO

pull/2/head
Raniita 3 years ago
parent
commit
44e46c796b
  1. 3
      tb_vga1.vhd
  2. 128
      toplevel.vhd

3
tb_vga1.vhd

@ -158,6 +158,9 @@ BEGIN
wait for 8.68 us;
----------------------------
wait for 15 us;
wait for 10 ms;
-- Mandamos otro caracter
rx <= '1'; --linea de recepcion inactiva
wait for 20 us;

128
toplevel.vhd

@ -111,7 +111,7 @@ signal cube_y_max : integer := 260;
constant font_ROM : font_rom_type := ROM;
-- Signal vga register
--signal vga_reg :std_logic_vector(7 downto 0) := "00000000";
signal vga_reg :std_logic_vector(7 downto 0) := "00000000";
-- Aadimos el controlador de VGA
component controllerVGA
@ -185,63 +185,29 @@ begin
begin
if rising_edge(clk) then
if reset = '1' then
RGB := (others => '0');
clock_25 := '0';
RGB := BLACK;
clock_25 := '0';
else
if clock_25 = '1' then
-- Si estamos dentro del rango de display y la pantalla esta lista para sacar cosas
if (ready = '1' AND xCount >= 0 AND xCount < 640 AND yCount >= 0 AND yCount < 480) then
-- ## LO QUE EJECUTAMOS EN CADA FRAME ## --
-- Default color como black
RGB := BLACK;
-- NO ME BORRES SOY BUENA GENTE
if xCount < border_width * 8 OR xCount > 639 - (border_width * 8) OR
yCount < (border_width * 8) OR yCount > 479 - (border_width * 8) then
RGB := BLUE;
elsif(writestrobe = '1' AND portid=x"FE") then
case outport is
when x"64" =>
-- Recibimos ascii d
-- Movemos derecha?
cube_x_min <= cube_x_min+1;
cube_x_max <= cube_x_max+1;
cube_y_min <= cube_y_min;
cube_y_max <= cube_y_max;
when x"61" =>
-- Recibimos ascii a
-- Movemos izquierda?
cube_x_min <= cube_x_min-1;
cube_x_max <= cube_x_max-1;
cube_y_min <= cube_y_min;
cube_y_max <= cube_y_max;
when x"77" =>
-- Recibimos ascii w
-- Movemos arriba?
cube_x_min <= cube_x_min;
cube_x_max <= cube_x_max;
cube_y_min <= cube_y_min-1;
cube_y_max <= cube_y_max-1;
when x"73" =>
-- Recibimos ascii s
-- Movemos abajo?
cube_x_min <= cube_x_min;
cube_x_max <= cube_x_max;
cube_y_min <= cube_y_min+1;
cube_y_max <= cube_y_max+1;
when others =>
cube_x_min <= cube_x_min;
cube_x_max <= cube_x_max;
cube_y_min <= cube_y_min;
cube_y_max <= cube_y_max;
end case;
end if;
if(xCount>=cube_x_min AND xCount<cube_x_max AND
yCount>=cube_y_min AND yCount<cube_y_max) then
RGB := GREEN;
else
RGB := RED;
end if;
elsif(xCount>=cube_x_min AND xCount<cube_x_max AND
yCount>=cube_y_min AND yCount<cube_y_max) then
RGB := GREEN;
elsif (vga_reg /= "00000000") then
RGB := YELLOW;
else
RGB := RED;
end if;
-- Sacamos los colores por los puertos de la FPGA
R <= RGB(2);
G <= RGB(1);
@ -280,16 +246,60 @@ begin
end process;
-- Registro VGA.
-- vgabuff:process(reset, clk)
-- begin
-- if (reset='1') then
-- vga_reg <= '1';
-- elsif rising_edge(clk) then
-- if (writestrobe = '1' and portid=x"FE") then
-- vga_reg <= outport;
-- end if;
-- end if;
-- end process;
vgabuff:process(reset, clk)
begin
if (reset='1') then
vga_reg <= "00000000";
elsif rising_edge(clk) then
if (writestrobe = '1' and portid=x"FE") then
vga_reg <= outport;
case outport is
when x"64" =>
-- Recibimos ascii d
-- Movemos derecha?
cube_x_min <= cube_x_min+10;
cube_x_max <= cube_x_max+10;
cube_y_min <= cube_y_min;
cube_y_max <= cube_y_max;
when x"61" =>
-- Recibimos ascii a
-- Movemos izquierda?
cube_x_min <= cube_x_min-10;
cube_x_max <= cube_x_max-10;
cube_y_min <= cube_y_min;
cube_y_max <= cube_y_max;
when x"77" =>
-- Recibimos ascii w
-- Movemos arriba?
cube_x_min <= cube_x_min;
cube_x_max <= cube_x_max;
cube_y_min <= cube_y_min-10;
cube_y_max <= cube_y_max-10;
when x"73" =>
-- Recibimos ascii s
-- Movemos abajo?
cube_x_min <= cube_x_min;
cube_x_max <= cube_x_max;
cube_y_min <= cube_y_min+10;
cube_y_max <= cube_y_max+10;
when others =>
cube_x_min <= cube_x_min;
cube_x_max <= cube_x_max;
cube_y_min <= cube_y_min;
cube_y_max <= cube_y_max;
end case;
end if;
end if;
end process;
-- Observer VGA_reg
--process(writestrobe)
--begin
-- if(writestrobe = '1' AND outport /= "00000000" AND portid=x"FE") then
--
-- end if;
--end process;
-- Memoria RAM. Tipo => Escritura sincrona/Lectura asincrona
process(clk)
@ -304,7 +314,7 @@ begin
-- Lectura asincrona, limitada solo por el valor de portid
process(portid)
begin
if(portid>x"0" AND portid<x"40") then
if(portid<x"40") then
RAM_out <= RAM(to_integer(unsigned(portid)));
end if;
end process;

Loading…
Cancel
Save