Implement single character write interface
This basic interface just moves the cursor to the next position after writing a character and supports CR and LF as special chars for now.
This commit is contained in:
@ -16,7 +16,11 @@ entity framebuffer is
|
||||
x: in std_logic_vector(9 downto 0);
|
||||
y: in std_logic_vector(8 downto 0);
|
||||
|
||||
rgb: out std_logic_vector(23 downto 0)
|
||||
rgb: out std_logic_vector(23 downto 0);
|
||||
|
||||
write_enable: std_logic;
|
||||
write_address: std_logic_vector(12 downto 0);
|
||||
write_data: std_logic_vector(7 downto 0)
|
||||
);
|
||||
end framebuffer;
|
||||
|
||||
@ -41,6 +45,7 @@ architecture logic of framebuffer is
|
||||
|
||||
constant font: rom_type := read_font("font.hex");
|
||||
|
||||
signal read_address: std_logic_vector(12 downto 0);
|
||||
signal current_char: std_logic_vector(7 downto 0);
|
||||
|
||||
signal current_glyph: std_logic_vector(63 downto 0);
|
||||
@ -49,52 +54,17 @@ architecture logic of framebuffer is
|
||||
constant glyph_pos_length: integer := 2;
|
||||
type glyph_pos_type is array(1 to glyph_pos_length) of integer range 0 to 63;
|
||||
signal glyph_pos: glyph_pos_type;
|
||||
|
||||
signal write_x: unsigned(6 downto 0);
|
||||
signal write_y: unsigned(5 downto 0);
|
||||
signal write_value: std_logic_vector(7 downto 0);
|
||||
|
||||
signal ra: std_logic_vector(12 downto 0);
|
||||
signal wa: std_logic_vector(12 downto 0);
|
||||
begin
|
||||
|
||||
ra <= x(9 downto 3) & y(8 downto 3);
|
||||
wa <= std_logic_vector(write_x) & std_logic_vector(write_y);
|
||||
|
||||
write_value <= "0" & std_logic_vector(write_x + 32);
|
||||
|
||||
cycle_write_location:
|
||||
process(clk)
|
||||
constant max_delay: integer := 2000000;
|
||||
variable delay: integer range 0 to max_delay;
|
||||
begin
|
||||
if rising_edge(clk) then
|
||||
if delay = max_delay then
|
||||
delay := 0;
|
||||
|
||||
if write_x = 79 then
|
||||
write_x <= (others => '0');
|
||||
if write_y = 59 then
|
||||
write_y <= (others => '0');
|
||||
else
|
||||
write_y <= write_y + 1;
|
||||
end if;
|
||||
else
|
||||
write_x <= write_x + 1;
|
||||
end if;
|
||||
else
|
||||
delay := delay + 1;
|
||||
end if;
|
||||
end if;
|
||||
end process cycle_write_location;
|
||||
read_address <= x(9 downto 3) & y(8 downto 3);
|
||||
|
||||
terminal_buffer: entity work.terminal_buffer port map (
|
||||
clk => clk,
|
||||
ra => ra,
|
||||
ra => read_address,
|
||||
do => current_char,
|
||||
we => '1',
|
||||
wa => wa,
|
||||
di => write_value
|
||||
we => write_enable,
|
||||
wa => write_address,
|
||||
di => write_data
|
||||
);
|
||||
|
||||
process(clk)
|
||||
|
Reference in New Issue
Block a user