Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library ieee;
- use ieee.std_logic_1164.all;
- use ieee.std_logic_unsigned.all;
- entity PanelDisplay is
- port (clk : in std_logic;
- rst : in std_logic;
- hsync : out std_logic;
- vsync : out std_logic;
- red : out std_logic_vector(3 downto 0);
- green : out std_logic_vector(3 downto 0);
- blue : out std_logic_vector(3 downto 0));
- end PanelDisplay;
- architecture main of PanelDisplay is
- signal hpos: integer range 0 to 800:=0;
- signal vpos: integer range 0 to 524:=0;
- signal Xpos: integer range 0 to 800:=0;
- signal Ypos: integer range 0 to 524:=0;
- signal temp: STD_LOGIC:='1';
- signal counter : integer range 0 to 1:=0;
- signal clk_out: STD_LOGIC:='1';
- begin
- ---------------------
- -- Frequency div --
- ---------------------
- process (clk) begin
- if rising_edge(clk) then
- if (counter = 1) then
- temp <= NOT(temp);
- counter <= 0;
- else
- counter <= counter + 1;
- end if;
- end if;
- clk_out<= temp;
- end process;
- process (clk_out) begin
- if (rising_edge(clk_out)) then
- -------------------
- -- HPOS, VPOS --
- -------------------
- if (hpos<800) then
- hpos <= hpos+1;
- else
- hpos<=0;
- if (vpos<524)then
- vpos<=vpos+1;
- else
- vpos<=0;
- end if;
- end if;
- ---------------------
- -- HSYNC, VSYNC --
- ---------------------
- if (hpos>16 and hpos<144) then
- hsync<='0';
- else
- hsync<='1';
- end if;
- if (vpos>10 and vpos<13) then
- vsync<='0';
- else
- vsync<='1';
- end if;
- -- Blanking period
- if ((hpos>0 and hpos<160) or (vpos>0 and vpos<44)) then
- red<=(others =>'0');
- green<=(others =>'0');
- blue<=(others =>'0');
- end if;
- Xpos<=405;
- Ypos<=209;
- ------------------
- -- Block #1 --
- ------------------
- if ((hpos>Xpos and hpos<Xpos+50) and (vpos>Ypos and vpos<Ypos+100))then
- red<=(others =>'1');
- green<=(others =>'0');
- blue<=(others =>'0');
- end if;
- ------------------
- -- Block #2 --
- ------------------
- if ((hpos>Xpos+100 and hpos<Xpos+150) and (vpos>Ypos+100 and vpos<Ypos+150))then
- red<=(others =>'0');
- green<=(others =>'1');
- blue<=(others =>'0');
- end if;
- ------------------
- -- Block #3 --
- ------------------
- if ((hpos>Xpos and hpos<Xpos+50) and (vpos>Ypos and vpos<Ypos+100))then
- red<=(others =>'0');
- green<=(others =>'0');
- blue<=(others =>'1');
- end if;
- ------------------
- -- Block #4 --
- ------------------
- if ((hpos>Xpos+100 and hpos<Xpos+150) and (vpos>Ypos+100 and vpos<Ypos+150))then
- red<=(others =>'0');
- green<=(others =>'1');
- blue<=(others =>'1');
- end if;
- end if;
- end process;
- end main;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement