-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscreenInit.vhd.bak
executable file
·54 lines (44 loc) · 1.25 KB
/
screenInit.vhd.bak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity screenInit is
port( clk : in std_logic;
x : out std_logic_vector(7 downto 0);
y : out std_logic_vector(6 downto 0);
colour : out std_logic_vector(2 downto 0);
plot : out std_logic
);
end screenInit;
architecture behavioural of screenInit is
begin
variable x_temp0: std_logic_vector(7 downto 0) := "00000000";
variable y_temp0: std_logic_vector(6 downto 0) := "0000000";
if(rising_edge(clk)) then
--initialize
if ( y_temp0 < 120 ) then
if ( x_temp0 < 160 ) then
x_temp0 := x_temp0 + 1;
-- check colour
if ( y_temp0 >= 0 AND y < 10 ) then
colour <= "010";
elsif ( y_temp0 >= 110 AND y < 120 ) then
colour <= "010";
elsif ( x_temp0 >= 0 AND x < 10) then
colour <= "011";
elsif ( x_temp0 >= 150 AND x < 160 ) then
colour <= "011";
else
colour <= "000";
end if;
else
y_temp0 := y_temp0 + 1;
x_temp0 := "000000000";
end if;
--plot pixel
plot <= not clock;
x <= std_logic_vector(x_temp0(7 downto 0));
y <= std_logic_vector(y_temp0(6 downto 0));
end if;
end if;
end process;
end architecture;