Browse Source

font readded and working well. small changes

pull/2/head
Raniita 3 years ago
parent
commit
2109e52cc8
  1. 118
      toplevel.vhd

118
toplevel.vhd

@ -166,11 +166,10 @@ begin
xCount <= to_integer(unsigned(x));
yCount <= to_integer(unsigned(y));
-- TODO: Proceso controlador del VGA. SIN COMPROBAR!!!
process(clk,reset)
-- Variable para los colores. CARGA INSTANTANEA DEL VALOR, SOLO PARA USO TEMPORAL!!
variable clock_25 : std_logic := '0';
variable RGB : std_logic_vector(2 downto 0);
variable clock_25 : std_logic := '0';
variable x : integer;
variable y : integer;
variable rowData : std_logic_vector(0 to 7) := (others => '0');
@ -181,7 +180,7 @@ begin
variable char_start_y : integer := 0;
variable char_end_y : integer := 0;
variable border_width : integer := 2;
begin
if rising_edge(clk) then
if reset = '1' then
@ -192,9 +191,9 @@ begin
-- 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
--RGB := BLACK;
if xCount < border_width * 8 OR xCount > 639 - (border_width * 8) OR
yCount < (border_width * 8) OR yCount > 479 - (border_width * 8) then
@ -202,11 +201,34 @@ begin
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;
-- Get nearest valid char position using magic division/multiplication decimal crush
terminal_column := xCount / 8 ;
char_start_x := terminal_column * 8;
char_end_x := char_start_x + 8;
terminal_row := yCount / 16;
char_start_y := terminal_row * 16;
char_end_y := char_start_y + 16;
if xCount >= char_start_x AND xCount < char_end_x AND yCount >= char_start_y AND yCount < char_end_y
AND terminal_column < (WORDS_ROM'LENGTH + border_width)
AND terminal_column > border_width - 1 AND terminal_column < 80 - border_width
AND terminal_row > border_width - 2 AND terminal_row <= 30 - border_width then
x := (xCount - char_start_x) mod 8;
y := (yCount - char_start_y) mod 16;
--addrA <= y+16*1;
--rowData := dataOutA;
rowData := font_ROM(y + 16 * WORDS_ROM(terminal_column - border_width));
if rowData(x) = '1' then
RGB := WHITE;
end if;
end if;
-- Sacamos los colores por los puertos de la FPGA
R <= RGB(2);
@ -220,7 +242,7 @@ begin
end process;
--registra el bit tx del puerto de salida, por si ste cambia
-- Usamos el puerto FF.
-- Usamos el puerto FF para el UART.
txbuff:process(reset, clk)
begin
if (reset='1') then
@ -233,7 +255,7 @@ begin
end process;
--aade 7ceros a rx para meterlos al puerto de entrada cuando se lea
-- Usamos el puerto FF.
-- Usamos el puerto FF para el UART.
rxbuff:process(reset, clk)
begin
if (reset='1') then
@ -245,7 +267,7 @@ begin
end if;
end process;
-- Registro VGA.
-- Proceso mover cubo
vgabuff:process(reset, clk)
begin
if (reset='1') then
@ -255,52 +277,44 @@ begin
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;
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)
begin

Loading…
Cancel
Save