diff options
Diffstat (limited to 'fpga/hp_lcd_driver/common.vhdl')
-rw-r--r-- | fpga/hp_lcd_driver/common.vhdl | 134 |
1 files changed, 68 insertions, 66 deletions
diff --git a/fpga/hp_lcd_driver/common.vhdl b/fpga/hp_lcd_driver/common.vhdl index f796421..df58203 100644 --- a/fpga/hp_lcd_driver/common.vhdl +++ b/fpga/hp_lcd_driver/common.vhdl @@ -11,50 +11,50 @@ use work.all; entity common is - generic (input_video_width : natural := 2; - video_width : natural :=2; - addr_width : natural := 18; - phase_slip : natural := 320; - i_clk_multiple : natural := 4; - use_pclk : natural := 0; - target : string := "artix7"); - port (clk_50m : in std_logic; - sys_rst_n : in std_logic; - video : in std_logic_vector(input_video_width -1 downto 0); - hsync_in : in std_logic; - vsync_in : in std_logic; - pclk_in : in std_logic; - r_out : out std_logic; - b_out : out std_logic; - g_out : out std_logic; - hsync_out : out std_logic; - vsync_out : out std_logic; - hdmi_c_p : out std_logic; - hdmi_c_n : out std_logic; - hdmi_r_p : out std_logic; - hdmi_r_n : out std_logic; - hdmi_g_p : out std_logic; - hdmi_g_n : out std_logic; - hdmi_b_p : out std_logic; - hdmi_b_n : out std_logic; - hdmi_vcc : out std_logic; - i_clk_out : out std_logic; - led : out std_logic; - video_out_data : out std_logic_vector(wideo_width-1 downto 0); - video_out_valid: out std_logic; - video_out_clk : out std_logic; - video_out_index :out std_logic -); + generic (input_video_width : natural := 2; + video_width : natural := 2; + addr_width : natural := 18; + phase_slip : natural := 320; + i_clk_multiple : natural := 4; + use_pclk : natural := 0; + target : string := "artix7"); + port (clk_50m : in std_logic; + sys_rst_n : in std_logic; + video : in std_logic_vector(input_video_width -1 downto 0); + hsync_in : in std_logic; + vsync_in : in std_logic; + pclk_in : in std_logic; + r_out : out std_logic; + b_out : out std_logic; + g_out : out std_logic; + hsync_out : out std_logic; + vsync_out : out std_logic; + hdmi_c_p : out std_logic; + hdmi_c_n : out std_logic; + hdmi_r_p : out std_logic; + hdmi_r_n : out std_logic; + hdmi_g_p : out std_logic; + hdmi_g_n : out std_logic; + hdmi_b_p : out std_logic; + hdmi_b_n : out std_logic; + hdmi_vcc : out std_logic; + i_clk_out : out std_logic; + led : out std_logic; + video_out_data : out std_logic_vector(video_width-1 downto 0); + video_out_valid : out std_logic; + video_out_clk : out std_logic; + video_out_index : out std_logic + ); end common; architecture Behavioral of common is signal video_lut : std_logic_vector (video_width-1 downto 0); - signal wr_addr : std_logic_vector(addr_width-1 downto 0); - signal wr_data : std_logic_vector(video_width-1 downto 0); + signal wr_addr : std_logic_vector(addr_width-1 downto 0); + signal wr_data : std_logic_vector(video_width-1 downto 0); signal wr_data_b : std_logic_vector(video_width-1 downto 0); - signal wr_en : std_logic; + signal wr_en : std_logic; signal rd_addr : std_logic_vector(addr_width-1 downto 0); signal rd_data : std_logic_vector(video_width-1 downto 0); @@ -84,6 +84,8 @@ architecture Behavioral of common is signal c : natural; signal t : std_logic; + + signal wr_index: std_logic; begin @@ -106,17 +108,17 @@ begin ); -video_lut <= "1111" when video(0)='1' else - "1011" when video(1)='1' else - "1100" when video(2)='1' else - "1010" when video(3)='1' else - "0011" when video(4)='1' else - "1110" when video(5)='1' else - "1001" when video(6)='1' else - "1101" when video(7)='1' else - "0000"; + video_lut <= "1111" when video(0) = '1' else + "1011" when video(1) = '1' else + "1100" when video(2) = '1' else + "1010" when video(3) = '1' else + "0011" when video(4) = '1' else + "1110" when video(5) = '1' else + "1001" when video(6) = '1' else + "1101" when video(7) = '1' else + "0000"; -hdmi_vcc <='1'; + hdmi_vcc <= '1'; process (i_clk, sys_rst_n) @@ -186,13 +188,13 @@ hdmi_vcc <='1'; video_out => wr_data, addr_out => wr_addr, wren_out => wr_en, - index_out => wr_index + index_out => wr_index ); -video_out_data <= wr_data; -video_out_valid <= wr_en; -video_out_index <= wr_index; -video_out_clk <=i_clk; + video_out_data <= wr_data; + video_out_valid <= wr_en; + video_out_index <= wr_index; + video_out_clk <= i_clk; @@ -248,21 +250,21 @@ video_out_clk <=i_clk; - r<=x"ff" when rd_data(0)='1' else - x"00"; + r <=x"ff" when rd_data(0) = '1' else + x"00"; -- r<=x"ff" when rd_data(0)='1' and rd_data(3)='1' else --- x"80" when rd_data(0)='1' else --- x"00"; +-- x"80" when rd_data(0)='1' else +-- x"00"; + + g <=x"ff" when rd_data(1) = '1' and rd_data(3) = '1' else + x"80" when rd_data(1) = '1' else + x"00"; + b <=x"ff" when rd_data(2) = '1' and rd_data(3) = '1' else + x"80" when rd_data(2) = '1' else + x"00"; - g<=x"ff" when rd_data(1)='1' and rd_data(3)='1' else - x"80" when rd_data(1)='1' else - x"00"; - b<=x"ff" when rd_data(2)='1' and rd_data(3)='1' else - x"80" when rd_data(2)='1' else - x"00"; - --"ff" when rd_data(1) = '1' else -- x"80" when rd_data(0) = '1' else @@ -363,10 +365,10 @@ video_out_clk <=i_clk; if rising_edge(clk_50m) then if c < 19999999 then - c <=c+1; + c <= c+1; else - c <=0; - t <=not t; + c <= 0; + t <= not t; end if; end if; end process; |