Skip to content

Commit

Permalink
Add support for 59.94 Hz video modes
Browse files Browse the repository at this point in the history
  • Loading branch information
MJoergen committed Nov 3, 2023
1 parent eddfb6e commit ff350ba
Show file tree
Hide file tree
Showing 10 changed files with 290 additions and 100 deletions.
5 changes: 5 additions & 0 deletions CORE/vhdl/config.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@ constant OPTM_ITEMS : string :=
" 720p 60 Hz 16:9\n" &
" 576p 50 Hz 4:3\n" &
" 576p 50 Hz 5:4\n" &
" 640x480 60 Hz\n" &
" 720x480 60 Hz\n" &
" 640x480 59.94 Hz\n" &
" 720x480 59.94 Hz\n" &
" 720p 59.94 Hz\n" &
"\n" &
" Back to main menu\n" &

Expand Down
32 changes: 21 additions & 11 deletions CORE/vhdl/mega65.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ port (

-- Video and audio mode control
qnice_dvi_o : out std_logic; -- 0=HDMI (with sound), 1=DVI (no sound)
qnice_video_mode_o : out natural range 0 to 3; -- HDMI 1280x720 @ 50 Hz resolution = mode 0,
qnice_video_mode_o : out natural range 0 to 8; -- HDMI 1280x720 @ 50 Hz resolution = mode 0,
-- HDMI 1280x720 @ 60 Hz resolution = mode 1,
-- PAL 576p in 4:3 and 5:4 are modes 2 and 3
-- HDMI 640x480 @ 60 Hz = mode 4
Expand Down Expand Up @@ -242,13 +242,18 @@ signal main_rst : std_logic;
---------------------------------------------------------------------------------------------

-- Democore menu items
constant C_MENU_HDMI_16_9_50 : natural := 12;
constant C_MENU_HDMI_16_9_60 : natural := 13;
constant C_MENU_HDMI_4_3_50 : natural := 14;
constant C_MENU_HDMI_5_4_50 : natural := 15;
constant C_MENU_CRT_EMULATION : natural := 27;
constant C_MENU_HDMI_ZOOM : natural := 28;
constant C_MENU_IMPROVE_AUDIO : natural := 29;
constant C_MENU_HDMI_16_9_50 : natural := 12;
constant C_MENU_HDMI_16_9_60 : natural := 13;
constant C_MENU_HDMI_4_3_50 : natural := 14;
constant C_MENU_HDMI_5_4_50 : natural := 15;
constant C_MENU_HDMI_640_60 : natural := 16;
constant C_MENU_HDMI_720_60 : natural := 17;
constant C_MENU_HDMI_640_5994 : natural := 18;
constant C_MENU_HDMI_720_5994 : natural := 19;
constant C_MENU_HDMI_1280_5994 : natural := 20;
constant C_MENU_CRT_EMULATION : natural := 32;
constant C_MENU_HDMI_ZOOM : natural := 33;
constant C_MENU_IMPROVE_AUDIO : natural := 34;

-- QNICE clock domain
signal qnice_demo_vd_data_o : std_logic_vector(15 downto 0);
Expand Down Expand Up @@ -394,9 +399,14 @@ begin
-- while in the 4:3 mode we are outputting a 5:4 image. This is kind of odd, but it seemed that our 4/3 aspect ratio
-- adjusted image looks best on a 5:4 monitor and the other way round.
-- Not sure if this will stay forever or if we will come up with a better naming convention.
qnice_video_mode_o <= 3 when qnice_osm_control_i(C_MENU_HDMI_5_4_50) = '1' else
2 when qnice_osm_control_i(C_MENU_HDMI_4_3_50) = '1' else
1 when qnice_osm_control_i(C_MENU_HDMI_16_9_60) = '1' else
qnice_video_mode_o <= 8 when qnice_osm_control_i(C_MENU_HDMI_1280_5994) = '1' else
7 when qnice_osm_control_i(C_MENU_HDMI_720_5994) = '1' else
6 when qnice_osm_control_i(C_MENU_HDMI_640_5994) = '1' else
5 when qnice_osm_control_i(C_MENU_HDMI_720_60) = '1' else
4 when qnice_osm_control_i(C_MENU_HDMI_640_60) = '1' else
3 when qnice_osm_control_i(C_MENU_HDMI_5_4_50) = '1' else
2 when qnice_osm_control_i(C_MENU_HDMI_4_3_50) = '1' else
1 when qnice_osm_control_i(C_MENU_HDMI_16_9_60) = '1' else
0;

-- Use On-Screen-Menu selections to configure several audio and video settings
Expand Down
18 changes: 9 additions & 9 deletions M2M/vhdl/av_pipeline/av_pipeline.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ entity av_pipeline is
qnice_zoom_crop_i : in std_logic;
qnice_audio_filter_i : in std_logic;
qnice_audio_mute_i : in std_logic;
qnice_video_mode_i : in std_logic_vector( 1 downto 0);
qnice_video_mode_i : in std_logic_vector( 3 downto 0);
qnice_dvi_i : in std_logic;
qnice_poly_clk_i : in std_logic;
qnice_poly_dw_i : in std_logic_vector( 9 downto 0);
Expand Down Expand Up @@ -200,7 +200,7 @@ signal hdmi_osm_cfg_dxdy : std_logic_vector(15 downto 0);
signal hdmi_osm_vram_addr : std_logic_vector(15 downto 0);
signal hdmi_osm_vram_data : std_logic_vector(15 downto 0);

signal hdmi_video_mode : std_logic_vector(1 downto 0);
signal hdmi_video_mode : std_logic_vector(3 downto 0);
signal hdmi_zoom_crop : std_logic;

-- QNICE On Screen Menu selections
Expand Down Expand Up @@ -482,23 +482,23 @@ begin
-- Clock domain crossing: QNICE to HDMI
i_qnice2hdmi: xpm_cdc_array_single
generic map (
WIDTH => 45
WIDTH => 47
)
port map (
src_clk => qnice_clk_i,
src_in(15 downto 0) => qnice_osm_cfg_xy_i,
src_in(31 downto 16) => qnice_osm_cfg_dxdy_i,
src_in(32) => qnice_osm_cfg_enable_i,
src_in(34 downto 33) => qnice_video_mode_i,
src_in(35) => qnice_zoom_crop_i,
src_in(44 downto 36) => qnice_osm_cfg_scaling_i,
src_in(36 downto 33) => qnice_video_mode_i,
src_in(37) => qnice_zoom_crop_i,
src_in(46 downto 38) => qnice_osm_cfg_scaling_i,
dest_clk => hdmi_clk_i,
dest_out(15 downto 0) => hdmi_osm_cfg_xy,
dest_out(31 downto 16) => hdmi_osm_cfg_dxdy,
dest_out(32) => hdmi_osm_cfg_enable,
dest_out(34 downto 33) => hdmi_video_mode,
dest_out(35) => hdmi_zoom_crop,
dest_out(44 downto 36) => hdmi_osm_cfg_scaling
dest_out(36 downto 33) => hdmi_video_mode,
dest_out(37) => hdmi_zoom_crop,
dest_out(46 downto 38) => hdmi_osm_cfg_scaling
); -- i_qnice2hdmi


Expand Down
2 changes: 1 addition & 1 deletion M2M/vhdl/av_pipeline/digital_pipeline.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ entity digital_pipeline is

-- Connect to QNICE and Video RAM
hdmi_dvi_i : in std_logic;
hdmi_video_mode_i : in natural range 0 to 3;
hdmi_video_mode_i : in natural range 0 to 8;
hdmi_crop_mode_i : in std_logic;
hdmi_osm_cfg_scaling_i : in natural range 0 to 8;
hdmi_osm_cfg_enable_i : in std_logic;
Expand Down
Loading

0 comments on commit ff350ba

Please sign in to comment.