Update sys (#17)
This commit is contained in:
1 parent
1da70a7929
commit
0cc97c86d9
23 files changed
+1808
-270
No files matched your search
@@ -43,6 +43,8 @@ module emu
|
|||||||
input [11:0] HDMI_WIDTH,
|
input [11:0] HDMI_WIDTH,
|
||||||
input [11:0] HDMI_HEIGHT,
|
input [11:0] HDMI_HEIGHT,
|
||||||
output HDMI_FREEZE,
|
output HDMI_FREEZE,
|
||||||
|
output HDMI_BLACKOUT,
|
||||||
|
output HDMI_BOB_DEINT,
|
||||||
|
|
||||||
`ifdef MISTER_FB
|
`ifdef MISTER_FB
|
||||||
// Use framebuffer in DDRAM
|
// Use framebuffer in DDRAM
|
||||||
@@ -180,6 +182,8 @@ assign LED_POWER = 0;
|
|||||||
|
|
||||||
assign VGA_SCALER = 0;
|
assign VGA_SCALER = 0;
|
||||||
assign HDMI_FREEZE = 0;
|
assign HDMI_FREEZE = 0;
|
||||||
|
assign HDMI_BLACKOUT = 0;
|
||||||
|
assign HDMI_BOB_DEINT = 0;
|
||||||
|
|
||||||
wire [1:0] ar = status[9:8];
|
wire [1:0] ar = status[9:8];
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,11 @@ generate
|
|||||||
assign G = {RGB_fix[7:4],RGB_fix[7:4]};
|
assign G = {RGB_fix[7:4],RGB_fix[7:4]};
|
||||||
assign B = {RGB_fix[3:0],RGB_fix[3:0]};
|
assign B = {RGB_fix[3:0],RGB_fix[3:0]};
|
||||||
end
|
end
|
||||||
|
else if(DW == 18) begin
|
||||||
|
assign R = {RGB_fix[17:12],RGB_fix[17:16]};
|
||||||
|
assign G = {RGB_fix[11: 6],RGB_fix[11:10]};
|
||||||
|
assign B = {RGB_fix[ 5: 0],RGB_fix[ 5: 4]};
|
||||||
|
end
|
||||||
else begin // 24
|
else begin // 24
|
||||||
assign R = RGB_fix[23:16];
|
assign R = RGB_fix[23:16];
|
||||||
assign G = RGB_fix[15:8];
|
assign G = RGB_fix[15:8];
|
||||||
|
|||||||
+159
-40
@@ -103,7 +103,7 @@ USE ieee.numeric_std.ALL;
|
|||||||
-- DOWNSCALE : True=Support downscaling False=Downscaling disabled
|
-- DOWNSCALE : True=Support downscaling False=Downscaling disabled
|
||||||
-- BYTESWAP : Little/Big endian byte swap
|
-- BYTESWAP : Little/Big endian byte swap
|
||||||
-- FRAC : Fractional bits, subpixel resolution
|
-- FRAC : Fractional bits, subpixel resolution
|
||||||
-- OHRES : Max. output horizontal resolution. Must be a power of two.
|
-- OHRES : Max. output horizontal resolution. 1024, 2048, 2304, 2560, 4096
|
||||||
-- (Used for sizing line buffers)
|
-- (Used for sizing line buffers)
|
||||||
-- IHRES : Max. input horizontal resolution. Must be a power of two.
|
-- IHRES : Max. input horizontal resolution. Must be a power of two.
|
||||||
-- (Used for sizing line buffers)
|
-- (Used for sizing line buffers)
|
||||||
@@ -125,7 +125,7 @@ ENTITY ascal IS
|
|||||||
ADAPTIVE : boolean := true;
|
ADAPTIVE : boolean := true;
|
||||||
DOWNSCALE_NN : boolean := false;
|
DOWNSCALE_NN : boolean := false;
|
||||||
FRAC : natural RANGE 4 TO 8 :=4;
|
FRAC : natural RANGE 4 TO 8 :=4;
|
||||||
OHRES : natural RANGE 1 TO 4096 :=2048;
|
OHRES : natural RANGE 1 TO 4096 :=2304;
|
||||||
IHRES : natural RANGE 1 TO 2048 :=2048;
|
IHRES : natural RANGE 1 TO 2048 :=2048;
|
||||||
N_DW : natural RANGE 64 TO 128 := 128;
|
N_DW : natural RANGE 64 TO 128 := 128;
|
||||||
N_AW : natural RANGE 8 TO 32 := 32;
|
N_AW : natural RANGE 8 TO 32 := 32;
|
||||||
@@ -204,6 +204,7 @@ ENTITY ascal IS
|
|||||||
run : IN std_logic :='1'; -- 1=Enable output image. 0=No image
|
run : IN std_logic :='1'; -- 1=Enable output image. 0=No image
|
||||||
freeze : IN std_logic :='0'; -- 1=Disable framebuffer writes
|
freeze : IN std_logic :='0'; -- 1=Disable framebuffer writes
|
||||||
mode : IN unsigned(4 DOWNTO 0);
|
mode : IN unsigned(4 DOWNTO 0);
|
||||||
|
bob_deint : IN std_logic := '0';
|
||||||
-- SYNC |_________________________/"""""""""\_______|
|
-- SYNC |_________________________/"""""""""\_______|
|
||||||
-- DE |""""""""""""""""""\________________________|
|
-- DE |""""""""""""""""""\________________________|
|
||||||
-- RGB | <#IMAGE#> ^HDISP |
|
-- RGB | <#IMAGE#> ^HDISP |
|
||||||
@@ -222,6 +223,7 @@ ENTITY ascal IS
|
|||||||
vmax : IN natural RANGE 0 TO 4095; -- 0 <= vmin < vmax < vdisp
|
vmax : IN natural RANGE 0 TO 4095; -- 0 <= vmin < vmax < vdisp
|
||||||
vrr : IN std_logic := '0';
|
vrr : IN std_logic := '0';
|
||||||
vrrmax : IN natural RANGE 0 TO 4095 := 0;
|
vrrmax : IN natural RANGE 0 TO 4095 := 0;
|
||||||
|
swblack : IN std_logic := '0'; -- will output 3 black frame on every resolution switch
|
||||||
|
|
||||||
-- Scaler format. 00=16bpp 565, 01=24bpp 10=32bpp
|
-- Scaler format. 00=16bpp 565, 01=24bpp 10=32bpp
|
||||||
format : IN unsigned(1 DOWNTO 0) :="01";
|
format : IN unsigned(1 DOWNTO 0) :="01";
|
||||||
@@ -257,6 +259,9 @@ ENTITY ascal IS
|
|||||||
BEGIN
|
BEGIN
|
||||||
ASSERT N_DW=64 OR N_DW=128 REPORT "DW" SEVERITY failure;
|
ASSERT N_DW=64 OR N_DW=128 REPORT "DW" SEVERITY failure;
|
||||||
|
|
||||||
|
ASSERT OHRES = 1024 OR OHRES = 2048 OR OHRES = 2304 OR
|
||||||
|
OHRES = 2560 OR OHRES = 4096 REPORT "OHRES" SEVERITY failure;
|
||||||
|
|
||||||
END ENTITY ascal;
|
END ENTITY ascal;
|
||||||
|
|
||||||
--##############################################################################
|
--##############################################################################
|
||||||
@@ -287,6 +292,35 @@ ARCHITECTURE rtl OF ascal IS
|
|||||||
END IF;
|
END IF;
|
||||||
END FUNCTION to_std_logic;
|
END FUNCTION to_std_logic;
|
||||||
|
|
||||||
|
----------------------------------------------------------
|
||||||
|
FUNCTION ohres_h(CONSTANT r : natural) RETURN natural IS
|
||||||
|
BEGIN
|
||||||
|
CASE r IS
|
||||||
|
WHEN 1024 => RETURN 1024;
|
||||||
|
WHEN 2048 => RETURN 2048;
|
||||||
|
WHEN OTHERS => RETURN 4096;
|
||||||
|
END CASE;
|
||||||
|
END FUNCTION;
|
||||||
|
FUNCTION ohres_l(CONSTANT r : natural) RETURN natural IS
|
||||||
|
BEGIN
|
||||||
|
CASE r IS
|
||||||
|
WHEN 1024 => RETURN 1024;
|
||||||
|
WHEN 2048 | 2304 | 2560 => RETURN 2048;
|
||||||
|
WHEN OTHERS => RETURN 4096;
|
||||||
|
END CASE;
|
||||||
|
END FUNCTION;
|
||||||
|
FUNCTION ohres_m(CONSTANT r : natural) RETURN natural IS
|
||||||
|
BEGIN
|
||||||
|
CASE r IS
|
||||||
|
WHEN 1024 | 2048 | 2304 => RETURN 256;
|
||||||
|
WHEN OTHERS => RETURN 512;
|
||||||
|
END CASE;
|
||||||
|
END FUNCTION;
|
||||||
|
|
||||||
|
CONSTANT OHRESH : natural := ohres_h(OHRES);
|
||||||
|
CONSTANT OHRESL : natural := ohres_l(OHRES);
|
||||||
|
CONSTANT OHRESM : natural := ohres_m(OHRES);
|
||||||
|
|
||||||
----------------------------------------------------------
|
----------------------------------------------------------
|
||||||
CONSTANT NB_BURST : natural :=ilog2(N_BURST);
|
CONSTANT NB_BURST : natural :=ilog2(N_BURST);
|
||||||
CONSTANT NB_LA : natural :=ilog2(N_DW/8); -- Low address bits
|
CONSTANT NB_LA : natural :=ilog2(N_DW/8); -- Low address bits
|
||||||
@@ -318,6 +352,7 @@ ARCHITECTURE rtl OF ascal IS
|
|||||||
SIGNAL i_pvs,i_pfl,i_pde,i_pce : std_logic;
|
SIGNAL i_pvs,i_pfl,i_pde,i_pce : std_logic;
|
||||||
SIGNAL i_ppix : type_pix;
|
SIGNAL i_ppix : type_pix;
|
||||||
SIGNAL i_freeze : std_logic;
|
SIGNAL i_freeze : std_logic;
|
||||||
|
SIGNAL i_bob_deint : std_logic;
|
||||||
SIGNAL i_count : unsigned(2 DOWNTO 0);
|
SIGNAL i_count : unsigned(2 DOWNTO 0);
|
||||||
SIGNAL i_hsize,i_hmin,i_hmax,i_hcpt : uint12;
|
SIGNAL i_hsize,i_hmin,i_hmax,i_hcpt : uint12;
|
||||||
SIGNAL i_hrsize,i_vrsize : uint12;
|
SIGNAL i_hrsize,i_vrsize : uint12;
|
||||||
@@ -333,6 +368,7 @@ ARCHITECTURE rtl OF ascal IS
|
|||||||
SIGNAL i_de_delay : natural RANGE 0 TO 31;
|
SIGNAL i_de_delay : natural RANGE 0 TO 31;
|
||||||
SIGNAL i_intercnt : natural RANGE 0 TO 3;
|
SIGNAL i_intercnt : natural RANGE 0 TO 3;
|
||||||
SIGNAL i_inter,i_half,i_flm : std_logic;
|
SIGNAL i_inter,i_half,i_flm : std_logic;
|
||||||
|
SIGNAL i_wfl : std_logic_vector(2 DOWNTO 0);
|
||||||
SIGNAL i_write,i_wreq,i_alt,i_line,i_wline,i_wline_mem : std_logic;
|
SIGNAL i_write,i_wreq,i_alt,i_line,i_wline,i_wline_mem : std_logic;
|
||||||
SIGNAL i_walt,i_walt_mem,i_wreq_mem : std_logic;
|
SIGNAL i_walt,i_walt_mem,i_wreq_mem : std_logic;
|
||||||
SIGNAL i_wdelay : natural RANGE 0 TO 7;
|
SIGNAL i_wdelay : natural RANGE 0 TO 7;
|
||||||
@@ -362,7 +398,7 @@ ARCHITECTURE rtl OF ascal IS
|
|||||||
SIGNAL i_hacc,i_vacc : uint13;
|
SIGNAL i_hacc,i_vacc : uint13;
|
||||||
SIGNAL i_hdown,i_vdown : std_logic;
|
SIGNAL i_hdown,i_vdown : std_logic;
|
||||||
SIGNAL i_divcpt : natural RANGE 0 TO 36;
|
SIGNAL i_divcpt : natural RANGE 0 TO 36;
|
||||||
SIGNAL i_lwad,i_lrad : natural RANGE 0 TO OHRES-1;
|
SIGNAL i_lwad,i_lrad : natural RANGE 0 TO OHRESH-1;
|
||||||
SIGNAL i_lwr,i_bil : std_logic;
|
SIGNAL i_lwr,i_bil : std_logic;
|
||||||
SIGNAL i_ldw,i_ldrm : type_pix;
|
SIGNAL i_ldw,i_ldrm : type_pix;
|
||||||
SIGNAL i_hpixp,i_hpix0,i_hpix1,i_hpix2,i_hpix3,i_hpix4 : type_pix;
|
SIGNAL i_hpixp,i_hpix0,i_hpix1,i_hpix2,i_hpix3,i_hpix4 : type_pix;
|
||||||
@@ -410,6 +446,8 @@ ARCHITECTURE rtl OF ascal IS
|
|||||||
-- Output
|
-- Output
|
||||||
SIGNAL o_run : std_logic;
|
SIGNAL o_run : std_logic;
|
||||||
SIGNAL o_freeze : std_logic;
|
SIGNAL o_freeze : std_logic;
|
||||||
|
SIGNAL o_bob_deint : std_logic;
|
||||||
|
SIGNAL o_iwfl : std_logic_vector(2 DOWNTO 0);
|
||||||
SIGNAL o_mode,o_hmode,o_vmode : unsigned(4 DOWNTO 0);
|
SIGNAL o_mode,o_hmode,o_vmode : unsigned(4 DOWNTO 0);
|
||||||
SIGNAL o_format : unsigned(5 DOWNTO 0);
|
SIGNAL o_format : unsigned(5 DOWNTO 0);
|
||||||
SIGNAL o_fb_pal_dr : unsigned(23 DOWNTO 0);
|
SIGNAL o_fb_pal_dr : unsigned(23 DOWNTO 0);
|
||||||
@@ -456,13 +494,21 @@ ARCHITECTURE rtl OF ascal IS
|
|||||||
SIGNAL o_reset_na : std_logic;
|
SIGNAL o_reset_na : std_logic;
|
||||||
SIGNAL o_dpram : arr_dw(0 TO BLEN*2-1);
|
SIGNAL o_dpram : arr_dw(0 TO BLEN*2-1);
|
||||||
ATTRIBUTE ramstyle OF o_dpram : SIGNAL IS "no_rw_check";
|
ATTRIBUTE ramstyle OF o_dpram : SIGNAL IS "no_rw_check";
|
||||||
SIGNAL o_line0,o_line1,o_line2,o_line3 : arr_pix(0 TO OHRES-1);
|
SIGNAL o_line0,o_line1,o_line2,o_line3 : arr_pix(0 TO OHRESL-1);
|
||||||
|
SIGNAL o_linf0,o_linf1,o_linf2,o_linf3 : arr_pix(0 TO OHRESM-1);
|
||||||
|
|
||||||
ATTRIBUTE ramstyle OF o_line0 : SIGNAL IS "no_rw_check";
|
ATTRIBUTE ramstyle OF o_line0 : SIGNAL IS "no_rw_check";
|
||||||
ATTRIBUTE ramstyle OF o_line1 : SIGNAL IS "no_rw_check";
|
ATTRIBUTE ramstyle OF o_line1 : SIGNAL IS "no_rw_check";
|
||||||
ATTRIBUTE ramstyle OF o_line2 : SIGNAL IS "no_rw_check";
|
ATTRIBUTE ramstyle OF o_line2 : SIGNAL IS "no_rw_check";
|
||||||
ATTRIBUTE ramstyle OF o_line3 : SIGNAL IS "no_rw_check";
|
ATTRIBUTE ramstyle OF o_line3 : SIGNAL IS "no_rw_check";
|
||||||
SIGNAL o_wadl,o_radl0,o_radl1,o_radl2,o_radl3 : natural RANGE 0 TO OHRES-1;
|
ATTRIBUTE ramstyle OF o_linf0 : SIGNAL IS "no_rw_check";
|
||||||
SIGNAL o_ldw,o_ldr0,o_ldr1,o_ldr2,o_ldr3 : type_pix;
|
ATTRIBUTE ramstyle OF o_linf1 : SIGNAL IS "no_rw_check";
|
||||||
|
ATTRIBUTE ramstyle OF o_linf2 : SIGNAL IS "no_rw_check";
|
||||||
|
ATTRIBUTE ramstyle OF o_linf3 : SIGNAL IS "no_rw_check";
|
||||||
|
SIGNAL o_wadl,o_radl0,o_radl1,o_radl2,o_radl3 : natural RANGE 0 TO OHRESH-1;
|
||||||
|
SIGNAL o_ldr0,o_ldr1,o_ldr2,o_ldr3,o_ldw : type_pix;
|
||||||
|
SIGNAL o_ler0,o_ler1,o_ler2,o_ler3 : type_pix;
|
||||||
|
SIGNAL o_lex0,o_lex1,o_lex2,o_lex3 : std_logic;
|
||||||
SIGNAL o_wr : unsigned(3 DOWNTO 0);
|
SIGNAL o_wr : unsigned(3 DOWNTO 0);
|
||||||
SIGNAL o_hcpt,o_vcpt,o_vcpt_pre,o_vcpt_pre2,o_vcpt_pre3,o_vcpt2 : uint12;
|
SIGNAL o_hcpt,o_vcpt,o_vcpt_pre,o_vcpt_pre2,o_vcpt_pre3,o_vcpt2 : uint12;
|
||||||
SIGNAL o_ihsize,o_ihsizem,o_ivsize : uint12;
|
SIGNAL o_ihsize,o_ihsizem,o_ivsize : uint12;
|
||||||
@@ -472,7 +518,7 @@ ARCHITECTURE rtl OF ascal IS
|
|||||||
SIGNAL o_hfrac : arr_frac(0 TO 9);
|
SIGNAL o_hfrac : arr_frac(0 TO 9);
|
||||||
ATTRIBUTE ramstyle OF o_hfrac : SIGNAL IS "logic"; -- avoid blockram shift register
|
ATTRIBUTE ramstyle OF o_hfrac : SIGNAL IS "logic"; -- avoid blockram shift register
|
||||||
|
|
||||||
SIGNAL o_hacc,o_hacc_ini,o_hacc_next,o_vacc,o_vacc_next,o_vacc_ini : natural RANGE 0 TO 4*OHRES-1;
|
SIGNAL o_hacc,o_hacc_ini,o_hacc_next,o_vacc,o_vacc_next,o_vacc_ini : natural RANGE 0 TO 4*OHRESH-1;
|
||||||
SIGNAL o_hsv,o_vsv,o_dev,o_pev,o_end : unsigned(0 TO 11);
|
SIGNAL o_hsv,o_vsv,o_dev,o_pev,o_end : unsigned(0 TO 11);
|
||||||
SIGNAL o_hsp,o_vss : std_logic;
|
SIGNAL o_hsp,o_vss : std_logic;
|
||||||
SIGNAL o_vcarrym,o_prim : boolean;
|
SIGNAL o_vcarrym,o_prim : boolean;
|
||||||
@@ -490,8 +536,9 @@ ARCHITECTURE rtl OF ascal IS
|
|||||||
TYPE arr_uint4 IS ARRAY (natural RANGE <>) OF natural RANGE 0 TO 15;
|
TYPE arr_uint4 IS ARRAY (natural RANGE <>) OF natural RANGE 0 TO 15;
|
||||||
SIGNAL o_off : arr_uint4(0 TO 2);
|
SIGNAL o_off : arr_uint4(0 TO 2);
|
||||||
SIGNAL o_bibu : std_logic :='0';
|
SIGNAL o_bibu : std_logic :='0';
|
||||||
SIGNAL o_dcptv : arr_uint12(1 TO 14);
|
SIGNAL o_dcptv : arr_uint12(13 TO 14);
|
||||||
SIGNAL o_dcpt : uint12;
|
SIGNAL o_dcpt_clr, o_dcpt_inc : std_logic;
|
||||||
|
SIGNAL o_dcptv_clr, o_dcptv_inc : std_logic_vector(1 TO 12);
|
||||||
SIGNAL o_hpixs,o_hpix0,o_hpix1,o_hpix2,o_hpix3 : type_pix;
|
SIGNAL o_hpixs,o_hpix0,o_hpix1,o_hpix2,o_hpix3 : type_pix;
|
||||||
SIGNAL o_hpixq : arr_pixq(2 TO 8);
|
SIGNAL o_hpixq : arr_pixq(2 TO 8);
|
||||||
ATTRIBUTE ramstyle OF o_hpixq : SIGNAL IS "logic"; -- avoid blockram shift register
|
ATTRIBUTE ramstyle OF o_hpixq : SIGNAL IS "logic"; -- avoid blockram shift register
|
||||||
@@ -499,7 +546,6 @@ ARCHITECTURE rtl OF ascal IS
|
|||||||
SIGNAL o_vpix_outer : arr_pix(0 TO 2);
|
SIGNAL o_vpix_outer : arr_pix(0 TO 2);
|
||||||
SIGNAL o_vpix_inner : arr_pix(0 TO 6);
|
SIGNAL o_vpix_inner : arr_pix(0 TO 6);
|
||||||
|
|
||||||
|
|
||||||
SIGNAL o_vpe : std_logic;
|
SIGNAL o_vpe : std_logic;
|
||||||
SIGNAL o_div : arr_div(0 TO 2); --uint12;
|
SIGNAL o_div : arr_div(0 TO 2); --uint12;
|
||||||
SIGNAL o_dir : arr_frac(0 TO 2);
|
SIGNAL o_dir : arr_frac(0 TO 2);
|
||||||
@@ -510,6 +556,7 @@ ARCHITECTURE rtl OF ascal IS
|
|||||||
SIGNAL o_divrun : std_logic;
|
SIGNAL o_divrun : std_logic;
|
||||||
SIGNAL o_hacpt,o_vacpt : unsigned(11 DOWNTO 0);
|
SIGNAL o_hacpt,o_vacpt : unsigned(11 DOWNTO 0);
|
||||||
SIGNAL o_vacptl : unsigned(1 DOWNTO 0);
|
SIGNAL o_vacptl : unsigned(1 DOWNTO 0);
|
||||||
|
signal o_newres : integer range 0 to 3;
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
FUNCTION shift_ishift(shift : unsigned(0 TO 119);
|
FUNCTION shift_ishift(shift : unsigned(0 TO 119);
|
||||||
@@ -1130,6 +1177,7 @@ BEGIN
|
|||||||
i_pushhead<='0';
|
i_pushhead<='0';
|
||||||
i_eol<='0'; -- End Of Line
|
i_eol<='0'; -- End Of Line
|
||||||
i_freeze <=freeze; -- <ASYNC>
|
i_freeze <=freeze; -- <ASYNC>
|
||||||
|
i_bob_deint <= bob_deint;
|
||||||
i_iauto<=iauto; -- <ASYNC>
|
i_iauto<=iauto; -- <ASYNC>
|
||||||
i_wreq<='0';
|
i_wreq<='0';
|
||||||
i_wr<='0';
|
i_wr<='0';
|
||||||
@@ -1190,11 +1238,13 @@ BEGIN
|
|||||||
i_vcpt<=0;
|
i_vcpt<=0;
|
||||||
IF i_inter='1' AND i_flm='0' AND i_half='0' AND INTER THEN
|
IF i_inter='1' AND i_flm='0' AND i_half='0' AND INTER THEN
|
||||||
i_line<='1';
|
i_line<='1';
|
||||||
|
i_wfl(o_ibuf1) <= '0';
|
||||||
i_adrsi<=to_unsigned(N_BURST * i_hburst,32) +
|
i_adrsi<=to_unsigned(N_BURST * i_hburst,32) +
|
||||||
to_unsigned(N_BURST * to_integer(
|
to_unsigned(N_BURST * to_integer(
|
||||||
unsigned'("00") & to_std_logic(HEADER)),32);
|
unsigned'("00") & to_std_logic(HEADER)),32);
|
||||||
ELSE
|
ELSE
|
||||||
i_line<='0';
|
i_line<='0';
|
||||||
|
i_wfl(o_ibuf0) <= '1';
|
||||||
i_adrsi<=to_unsigned(N_BURST * to_integer(
|
i_adrsi<=to_unsigned(N_BURST * to_integer(
|
||||||
unsigned'("00") & to_std_logic(HEADER)),32);
|
unsigned'("00") & to_std_logic(HEADER)),32);
|
||||||
END IF;
|
END IF;
|
||||||
@@ -1204,8 +1254,8 @@ BEGIN
|
|||||||
i_vcpt>=i_vmin AND i_vcpt<=i_vmax);
|
i_vcpt>=i_vmin AND i_vcpt<=i_vmax);
|
||||||
|
|
||||||
-- Detects end of frame for triple buffering.
|
-- Detects end of frame for triple buffering.
|
||||||
i_endframe0<=i_vs AND (NOT i_inter OR i_flm);
|
i_endframe0<=i_vs AND (NOT i_inter OR i_flm OR i_bob_deint);
|
||||||
i_endframe1<=i_vs AND (NOT i_inter OR NOT i_flm);
|
i_endframe1<=i_vs AND (NOT i_inter OR NOT i_flm OR i_bob_deint);
|
||||||
|
|
||||||
i_vss<=to_std_logic(i_vcpt>=i_vmin AND i_vcpt<=i_vmax);
|
i_vss<=to_std_logic(i_vcpt>=i_vmin AND i_vcpt<=i_vmax);
|
||||||
|
|
||||||
@@ -1453,12 +1503,12 @@ BEGIN
|
|||||||
-- Push pixels to downscaling line buffer
|
-- Push pixels to downscaling line buffer
|
||||||
i_lwr<=i_hnp4 AND i_ven5 AND i_pce;
|
i_lwr<=i_hnp4 AND i_ven5 AND i_pce;
|
||||||
IF i_lwr='1' THEN
|
IF i_lwr='1' THEN
|
||||||
i_lwad<=(i_lwad+1) MOD OHRES;
|
i_lwad<=(i_lwad+1) MOD OHRESH;
|
||||||
END IF;
|
END IF;
|
||||||
i_ldw<=i_hpix;
|
i_ldw<=i_hpix;
|
||||||
|
|
||||||
IF i_hnp3='1' AND i_ven4='1' AND i_pce='1' THEN
|
IF i_hnp3='1' AND i_ven4='1' AND i_pce='1' THEN
|
||||||
i_lrad<=(i_lrad+1) MOD OHRES;
|
i_lrad<=(i_lrad+1) MOD OHRESH;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
@@ -1817,7 +1867,7 @@ BEGIN
|
|||||||
VARIABLE shift_v : unsigned(0 TO N_DW+15);
|
VARIABLE shift_v : unsigned(0 TO N_DW+15);
|
||||||
VARIABLE hpix_v : type_pix;
|
VARIABLE hpix_v : type_pix;
|
||||||
VARIABLE hcarry_v,vcarry_v : boolean;
|
VARIABLE hcarry_v,vcarry_v : boolean;
|
||||||
VARIABLE dif_v : natural RANGE 0 TO 8*OHRES-1;
|
VARIABLE dif_v : natural RANGE 0 TO 8*OHRESH-1;
|
||||||
VARIABLE off_v : natural RANGE 0 TO 15;
|
VARIABLE off_v : natural RANGE 0 TO 15;
|
||||||
BEGIN
|
BEGIN
|
||||||
IF o_reset_na='0' THEN
|
IF o_reset_na='0' THEN
|
||||||
@@ -1862,6 +1912,8 @@ BEGIN
|
|||||||
o_isync <= '0';
|
o_isync <= '0';
|
||||||
o_isync2 <= o_isync;
|
o_isync2 <= o_isync;
|
||||||
o_freeze <= freeze;
|
o_freeze <= freeze;
|
||||||
|
o_bob_deint <= bob_deint;
|
||||||
|
o_iwfl <= i_wfl;
|
||||||
o_inter <=i_inter; -- <ASYNC>
|
o_inter <=i_inter; -- <ASYNC>
|
||||||
o_iendframe0<=i_endframe0; -- <ASYNC>
|
o_iendframe0<=i_endframe0; -- <ASYNC>
|
||||||
o_iendframe02<=o_iendframe0;
|
o_iendframe02<=o_iendframe0;
|
||||||
@@ -1890,6 +1942,14 @@ BEGIN
|
|||||||
o_ivsize<=i_vrsize; -- <ASYNC>
|
o_ivsize<=i_vrsize; -- <ASYNC>
|
||||||
o_hdown<=i_hdown; -- <ASYNC>
|
o_hdown<=i_hdown; -- <ASYNC>
|
||||||
o_vdown<=i_vdown; -- <ASYNC>
|
o_vdown<=i_vdown; -- <ASYNC>
|
||||||
|
|
||||||
|
IF (o_newres > 0) then
|
||||||
|
o_newres <= o_newres- 1;
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF (swblack = '1' and o_fb_ena = '0' and (o_ihsize /= i_hrsize or o_ivsize /= i_vrsize)) then
|
||||||
|
o_newres <= 3;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Simultaneous change of input and output framebuffers
|
-- Simultaneous change of input and output framebuffers
|
||||||
@@ -2086,7 +2146,26 @@ BEGIN
|
|||||||
o_read<=o_read_pre AND o_run;
|
o_read<=o_read_pre AND o_run;
|
||||||
o_rline<=o_vacpt(0); -- Even/Odd line for interlaced video
|
o_rline<=o_vacpt(0); -- Even/Odd line for interlaced video
|
||||||
|
|
||||||
|
----
|
||||||
|
-- When bob deinterlacing we read lines from one buffer (the most current) but we read them twice
|
||||||
|
-- (in contrast to weave deinterlacing where we read each 480p line from alternating buffers)
|
||||||
|
-- To counteract the severe vibrating/motion with bob deinterlacing, we need to offset one field
|
||||||
|
-- by a half-line. This is done by only reading the first line of the 'even' frame once
|
||||||
|
|
||||||
|
IF o_inter='1' AND o_bob_deint='1' THEN
|
||||||
|
IF o_iwfl(o_obuf0)='0' THEN
|
||||||
|
IF o_vacpt=0 OR o_rline='1' THEN
|
||||||
o_adrs_pre <= to_integer(o_vacpt) * to_integer(o_stride);
|
o_adrs_pre <= to_integer(o_vacpt) * to_integer(o_stride);
|
||||||
|
ELSE
|
||||||
|
o_adrs_pre <= (to_integer(o_vacpt)-1) * to_integer(o_stride);
|
||||||
|
END IF;
|
||||||
|
ELSE
|
||||||
|
o_adrs_pre <= to_integer(o_vacpt(11 DOWNTO 1) & "0") * to_integer(o_stride);
|
||||||
|
END IF;
|
||||||
|
ELSE
|
||||||
|
o_adrs_pre<=to_integer(o_vacpt) * to_integer(o_stride);
|
||||||
|
END IF;
|
||||||
|
|
||||||
IF o_adrsa='1' THEN
|
IF o_adrsa='1' THEN
|
||||||
IF o_fload=2 THEN
|
IF o_fload=2 THEN
|
||||||
o_adrs<=to_unsigned(o_hbcpt * N_BURST,32);
|
o_adrs<=to_unsigned(o_hbcpt * N_BURST,32);
|
||||||
@@ -2103,6 +2182,9 @@ BEGIN
|
|||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
-- Copy from buffered memory to pixel lines
|
-- Copy from buffered memory to pixel lines
|
||||||
o_sh<='0';
|
o_sh<='0';
|
||||||
|
o_dcpt_clr <= '0';
|
||||||
|
o_dcpt_inc <= '0';
|
||||||
|
|
||||||
CASE o_copy IS
|
CASE o_copy IS
|
||||||
WHEN sWAIT =>
|
WHEN sWAIT =>
|
||||||
o_copyv(0)<='0';
|
o_copyv(0)<='0';
|
||||||
@@ -2121,7 +2203,7 @@ BEGIN
|
|||||||
o_hacc <=o_hacc_ini;
|
o_hacc <=o_hacc_ini;
|
||||||
o_hacc_next<=o_hacc_ini + 2*o_ihsize;
|
o_hacc_next<=o_hacc_ini + 2*o_ihsize;
|
||||||
o_hacpt <=x"000";
|
o_hacpt <=x"000";
|
||||||
o_dcpt<=0;
|
o_dcpt_clr <= '1';
|
||||||
o_dshi<=2;
|
o_dshi<=2;
|
||||||
o_acpt<=0;
|
o_acpt<=0;
|
||||||
o_first<='1';
|
o_first<='1';
|
||||||
@@ -2149,17 +2231,17 @@ BEGIN
|
|||||||
WHEN sCOPY =>
|
WHEN sCOPY =>
|
||||||
-- dshi : Force shift first two or three pixels of each line
|
-- dshi : Force shift first two or three pixels of each line
|
||||||
IF o_dshi=0 THEN
|
IF o_dshi=0 THEN
|
||||||
dif_v:=(o_hacc_next - 2*o_hsize + (8*OHRES)) MOD (8*OHRES);
|
dif_v:=(o_hacc_next - 2*o_hsize + (8*OHRESH)) MOD (8*OHRESH);
|
||||||
IF dif_v>=4*OHRES THEN
|
IF dif_v>=4*OHRESH THEN
|
||||||
o_hacc<=o_hacc_next;
|
o_hacc<=o_hacc_next;
|
||||||
o_hacc_next<=o_hacc_next + 2*o_ihsize;
|
o_hacc_next<=o_hacc_next + 2*o_ihsize;
|
||||||
hcarry_v:=false;
|
hcarry_v:=false;
|
||||||
ELSE
|
ELSE
|
||||||
o_hacc<=dif_v;
|
o_hacc<=dif_v;
|
||||||
o_hacc_next<=(dif_v + 2*o_ihsize + (4*OHRES)) MOD (4*OHRES);
|
o_hacc_next<=(dif_v + 2*o_ihsize + (4*OHRESH)) MOD (4*OHRESH);
|
||||||
hcarry_v:=true;
|
hcarry_v:=true;
|
||||||
END IF;
|
END IF;
|
||||||
o_dcpt<=(o_dcpt+1) MOD 4096;
|
o_dcpt_inc <= '1';
|
||||||
ELSE
|
ELSE
|
||||||
o_dshi<=o_dshi-1;
|
o_dshi<=o_dshi-1;
|
||||||
hcarry_v:=false;
|
hcarry_v:=false;
|
||||||
@@ -2219,6 +2301,9 @@ BEGIN
|
|||||||
hpix_v:=(r=>o_fb_pal_dr(23 DOWNTO 16),g=>o_fb_pal_dr(15 DOWNTO 8),
|
hpix_v:=(r=>o_fb_pal_dr(23 DOWNTO 16),g=>o_fb_pal_dr(15 DOWNTO 8),
|
||||||
b=>o_fb_pal_dr(7 DOWNTO 0));
|
b=>o_fb_pal_dr(7 DOWNTO 0));
|
||||||
END IF;
|
END IF;
|
||||||
|
IF (o_newres > 0) then
|
||||||
|
hpix_v := (others => (others => '0'));
|
||||||
|
END IF;
|
||||||
o_hpix0<=hpix_v;
|
o_hpix0<=hpix_v;
|
||||||
o_hpix1<=o_hpix0;
|
o_hpix1<=o_hpix0;
|
||||||
o_hpix2<=o_hpix1;
|
o_hpix2<=o_hpix1;
|
||||||
@@ -2526,13 +2611,19 @@ BEGIN
|
|||||||
o_hfrac(2 TO 9) <= o_hfrac(1 TO 8);
|
o_hfrac(2 TO 9) <= o_hfrac(1 TO 8);
|
||||||
|
|
||||||
o_copyv(1 TO 14)<=o_copyv(0 TO 13);
|
o_copyv(1 TO 14)<=o_copyv(0 TO 13);
|
||||||
|
o_dcptv_clr(1 TO 12)<=o_dcpt_clr & o_dcptv_clr(1 TO 11);
|
||||||
|
o_dcptv_inc(1 TO 12)<=o_dcpt_inc & o_dcptv_inc(1 TO 11);
|
||||||
|
|
||||||
o_dcptv(1)<=o_dcpt;
|
IF o_dcptv_clr(12)='1' THEN
|
||||||
IF o_dcptv(1)>=o_hsize THEN
|
o_dcptv(13) <= 0;
|
||||||
o_copyv(2)<='0';
|
ELSIF o_dcptv_inc(12)='1' THEN
|
||||||
|
o_dcptv(13) <= (o_dcptv(13) + 1) MOD OHRESH;
|
||||||
|
END IF;
|
||||||
|
o_dcptv(14)<=o_dcptv(13);
|
||||||
|
|
||||||
|
IF o_dcptv(13)>=o_hsize THEN
|
||||||
|
o_copyv(14)<='0';
|
||||||
END IF;
|
END IF;
|
||||||
o_dcptv(2)<=o_dcptv(1) MOD OHRES;
|
|
||||||
o_dcptv(3 TO 14)<=o_dcptv(2 TO 13);
|
|
||||||
|
|
||||||
-- C2
|
-- C2
|
||||||
o_hpixq(2)<=(o_hpix3,o_hpix2,o_hpix1,o_hpix0);
|
o_hpixq(2)<=(o_hpix3,o_hpix2,o_hpix1,o_hpix0);
|
||||||
@@ -2625,17 +2716,39 @@ BEGIN
|
|||||||
OLBUF:PROCESS(o_clk) IS
|
OLBUF:PROCESS(o_clk) IS
|
||||||
BEGIN
|
BEGIN
|
||||||
IF rising_edge(o_clk) THEN
|
IF rising_edge(o_clk) THEN
|
||||||
|
-----------------------------------------------
|
||||||
-- WRITES
|
-- WRITES
|
||||||
IF o_wr(0)='1' THEN o_line0(o_wadl)<=o_ldw; END IF;
|
IF o_wr(0)='1' AND o_wadl < OHRESL THEN o_line0(o_wadl MOD OHRESL)<=o_ldw; END IF;
|
||||||
IF o_wr(1)='1' THEN o_line1(o_wadl)<=o_ldw; END IF;
|
IF o_wr(1)='1' AND o_wadl < OHRESL THEN o_line1(o_wadl MOD OHRESL)<=o_ldw; END IF;
|
||||||
IF o_wr(2)='1' THEN o_line2(o_wadl)<=o_ldw; END IF;
|
IF o_wr(2)='1' AND o_wadl < OHRESL THEN o_line2(o_wadl MOD OHRESL)<=o_ldw; END IF;
|
||||||
IF o_wr(3)='1' THEN o_line3(o_wadl)<=o_ldw; END IF;
|
IF o_wr(3)='1' AND o_wadl < OHRESL THEN o_line3(o_wadl MOD OHRESL)<=o_ldw; END IF;
|
||||||
|
IF OHRES = 2304 OR OHRES = 2560 THEN
|
||||||
|
IF o_wr(0)='1' AND o_wadl >= OHRESL THEN o_linf0(o_wadl MOD OHRESM)<=o_ldw; END IF;
|
||||||
|
IF o_wr(1)='1' AND o_wadl >= OHRESL THEN o_linf1(o_wadl MOD OHRESM)<=o_ldw; END IF;
|
||||||
|
IF o_wr(2)='1' AND o_wadl >= OHRESL THEN o_linf2(o_wadl MOD OHRESM)<=o_ldw; END IF;
|
||||||
|
IF o_wr(3)='1' AND o_wadl >= OHRESL THEN o_linf3(o_wadl MOD OHRESM)<=o_ldw; END IF;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
-- READS
|
-- READS
|
||||||
o_ldr0<=o_line0(o_radl0);
|
o_ldr0<=o_line0(o_radl0 MOD OHRESL);
|
||||||
o_ldr1<=o_line1(o_radl1);
|
o_ldr1<=o_line1(o_radl1 MOD OHRESL);
|
||||||
o_ldr2<=o_line2(o_radl2);
|
o_ldr2<=o_line2(o_radl2 MOD OHRESL);
|
||||||
o_ldr3<=o_line3(o_radl3);
|
o_ldr3<=o_line3(o_radl3 MOD OHRESL);
|
||||||
|
|
||||||
|
IF OHRES = 2304 OR OHRES = 2560 THEN
|
||||||
|
o_ler0<=o_linf0(o_radl0 MOD OHRESM);
|
||||||
|
o_ler1<=o_linf1(o_radl1 MOD OHRESM);
|
||||||
|
o_ler2<=o_linf2(o_radl2 MOD OHRESM);
|
||||||
|
o_ler3<=o_linf3(o_radl3 MOD OHRESM);
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
o_lex0 <= to_std_logic(o_radl0 >= OHRESL);
|
||||||
|
o_lex1 <= to_std_logic(o_radl1 >= OHRESL);
|
||||||
|
o_lex2 <= to_std_logic(o_radl2 >= OHRESL);
|
||||||
|
o_lex3 <= to_std_logic(o_radl3 >= OHRESL);
|
||||||
|
-----------------------------------------------
|
||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
END PROCESS OLBUF;
|
END PROCESS OLBUF;
|
||||||
|
|
||||||
@@ -2721,16 +2834,17 @@ BEGIN
|
|||||||
VSCAL:PROCESS(o_clk) IS
|
VSCAL:PROCESS(o_clk) IS
|
||||||
VARIABLE pixq_v : arr_pix(0 TO 3);
|
VARIABLE pixq_v : arr_pix(0 TO 3);
|
||||||
VARIABLE vlumpix_v : type_pix;
|
VARIABLE vlumpix_v : type_pix;
|
||||||
VARIABLE r1_v, r2_v : natural RANGE 0 TO OHRES-1;
|
VARIABLE r1_v, r2_v : natural RANGE 0 TO OHRESH-1;
|
||||||
VARIABLE fracnn_v : std_logic;
|
VARIABLE fracnn_v : std_logic;
|
||||||
|
VARIABLE o_l0_v, o_l1_v, o_l2_v, o_l3_v : type_pix;
|
||||||
BEGIN
|
BEGIN
|
||||||
IF rising_edge(o_clk) THEN
|
IF rising_edge(o_clk) THEN
|
||||||
IF o_ce='1' THEN
|
IF o_ce='1' THEN
|
||||||
o_v_hmin_adj<=o_hmin + 5;
|
o_v_hmin_adj<=o_hmin + 5;
|
||||||
|
|
||||||
fracnn_v := o_vfrac(o_vfrac'left);
|
fracnn_v := o_vfrac(o_vfrac'left);
|
||||||
r1_v := (o_hcpt - o_v_hmin_adj + OHRES) MOD OHRES;
|
r1_v := (o_hcpt - o_v_hmin_adj + OHRESH) MOD OHRESH;
|
||||||
r2_v := (o_hcpt - o_hmin + OHRES) MOD OHRES;
|
r2_v := (o_hcpt - o_hmin + OHRESH) MOD OHRESH;
|
||||||
|
|
||||||
-- CYCLE 1 -----------------------------------------
|
-- CYCLE 1 -----------------------------------------
|
||||||
-- Read mem
|
-- Read mem
|
||||||
@@ -2757,11 +2871,16 @@ BEGIN
|
|||||||
|
|
||||||
-- CYCLE 2 -----------------------------------------
|
-- CYCLE 2 -----------------------------------------
|
||||||
-- Lines reordering
|
-- Lines reordering
|
||||||
|
IF o_lex0='0' THEN o_l0_v := o_ldr0; ELSE o_l0_v := o_ler0; END IF;
|
||||||
|
IF o_lex1='0' THEN o_l1_v := o_ldr1; ELSE o_l1_v := o_ler1; END IF;
|
||||||
|
IF o_lex2='0' THEN o_l2_v := o_ldr2; ELSE o_l2_v := o_ler2; END IF;
|
||||||
|
IF o_lex3='0' THEN o_l3_v := o_ldr3; ELSE o_l3_v := o_ler3; END IF;
|
||||||
|
|
||||||
CASE o_vacptl IS
|
CASE o_vacptl IS
|
||||||
WHEN "10" => pixq_v:=(o_ldr0,o_ldr1,o_ldr2,o_ldr3);
|
WHEN "10" => pixq_v:=(o_l0_v,o_l1_v,o_l2_v,o_l3_v);
|
||||||
WHEN "11" => pixq_v:=(o_ldr1,o_ldr2,o_ldr3,o_ldr0);
|
WHEN "11" => pixq_v:=(o_l1_v,o_l2_v,o_l3_v,o_l0_v);
|
||||||
WHEN "00" => pixq_v:=(o_ldr2,o_ldr3,o_ldr0,o_ldr1);
|
WHEN "00" => pixq_v:=(o_l2_v,o_l3_v,o_l0_v,o_l1_v);
|
||||||
WHEN OTHERS => pixq_v:=(o_ldr3,o_ldr0,o_ldr1,o_ldr2);
|
WHEN OTHERS => pixq_v:=(o_l3_v,o_l0_v,o_l1_v,o_l2_v);
|
||||||
END CASE;
|
END CASE;
|
||||||
|
|
||||||
IF fracnn_v = '0' THEN
|
IF fracnn_v = '0' THEN
|
||||||
|
|||||||
+1
-26
@@ -2,16 +2,13 @@
|
|||||||
# Build TimeStamp Verilog Module
|
# Build TimeStamp Verilog Module
|
||||||
# Jeff Wiencrot - 8/1/2011
|
# Jeff Wiencrot - 8/1/2011
|
||||||
# Sorgelig - 02/11/2019
|
# Sorgelig - 02/11/2019
|
||||||
# Stan Hodge - 04/22/2024
|
|
||||||
|
|
||||||
proc generateBuildID_Verilog {} {
|
proc generateBuildID_Verilog {} {
|
||||||
|
|
||||||
# Get the timestamp (see: http://www.altera.com/support/examples/tcl/tcl-date-time-stamp.html)
|
# Get the timestamp (see: http://www.altera.com/support/examples/tcl/tcl-date-time-stamp.html)
|
||||||
set buildDate "`define BUILD_DATE \"[clock format [ clock seconds ] -format %y%m%d]\""
|
set buildDate "`define BUILD_DATE \"[clock format [ clock seconds ] -format %y%m%d]\""
|
||||||
|
|
||||||
# Create a Verilog file(s) for output
|
# Create a Verilog file for output
|
||||||
set outputFileName "build_id.v"
|
set outputFileName "build_id.v"
|
||||||
set outputFileNameNum "build_id_num.v"
|
|
||||||
|
|
||||||
set fileData ""
|
set fileData ""
|
||||||
if { [file exists $outputFileName]} {
|
if { [file exists $outputFileName]} {
|
||||||
@@ -20,35 +17,13 @@ proc generateBuildID_Verilog {} {
|
|||||||
close $outputFile
|
close $outputFile
|
||||||
}
|
}
|
||||||
|
|
||||||
set fileData_num ""
|
|
||||||
if { [file exists $outputFileNameNum]} {
|
|
||||||
set outputFile [open $outputFileNameNum "r"]
|
|
||||||
set fileData_num [read $outputFile]
|
|
||||||
close $outputFile
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if {$buildDate ne $fileData} {
|
if {$buildDate ne $fileData} {
|
||||||
set outputFile [open $outputFileName "w"]
|
set outputFile [open $outputFileName "w"]
|
||||||
puts -nonewline $outputFile $buildDate
|
puts -nonewline $outputFile $buildDate
|
||||||
close $outputFile
|
close $outputFile
|
||||||
|
|
||||||
set buildnumbervar 1
|
|
||||||
|
|
||||||
# Send confirmation message to the Messages window
|
# Send confirmation message to the Messages window
|
||||||
post_message "Generated: [pwd]/$outputFileName: $buildDate"
|
post_message "Generated: [pwd]/$outputFileName: $buildDate"
|
||||||
} else {
|
|
||||||
scan $fileData_num "`define BUILD_NUMBER \"%d" buildnumbervar
|
|
||||||
incr buildnumbervar
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set buildnumber "`define BUILD_NUMBER \"[format "%03d" $buildnumbervar]\""
|
|
||||||
set outputFile [open $outputFileNameNum "w"]
|
|
||||||
puts -nonewline $outputFile $buildnumber
|
|
||||||
close $outputFile
|
|
||||||
|
|
||||||
post_message "Generated: [pwd]/$outputFileNameNum: $buildnumber"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build CDF file
|
# Build CDF file
|
||||||
|
|||||||
+11
-5
@@ -27,7 +27,7 @@
|
|||||||
// VDNUM 1..10
|
// VDNUM 1..10
|
||||||
// BLKSZ 0..7: 0 = 128, 1 = 256, 2 = 512(default), .. 7 = 16384
|
// BLKSZ 0..7: 0 = 128, 1 = 256, 2 = 512(default), .. 7 = 16384
|
||||||
//
|
//
|
||||||
module hps_io #(parameter CONF_STR, CONF_STR_BRAM=1, PS2DIV=0, WIDE=0, VDNUM=1, BLKSZ=2, PS2WE=0)
|
module hps_io #(parameter CONF_STR, CONF_STR_BRAM=0, PS2DIV=0, WIDE=0, VDNUM=1, BLKSZ=2, PS2WE=0, STRLEN=$size(CONF_STR)>>3)
|
||||||
(
|
(
|
||||||
input clk_sys,
|
input clk_sys,
|
||||||
inout [48:0] HPS_BUS,
|
inout [48:0] HPS_BUS,
|
||||||
@@ -232,8 +232,7 @@ video_calc video_calc
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////
|
||||||
|
|
||||||
localparam STRLEN = $size(CONF_STR)>>3;
|
localparam MAX_W = $clog2((64 > (STRLEN+2)) ? 64 : (STRLEN+2))-1;
|
||||||
localparam MAX_W = $clog2((32 > (STRLEN+2)) ? 32 : (STRLEN+2))-1;
|
|
||||||
|
|
||||||
wire [7:0] conf_byte;
|
wire [7:0] conf_byte;
|
||||||
generate
|
generate
|
||||||
@@ -1032,8 +1031,15 @@ module confstr_rom #(parameter CONF_STR, STRLEN)
|
|||||||
output reg [7:0] conf_byte
|
output reg [7:0] conf_byte
|
||||||
);
|
);
|
||||||
|
|
||||||
wire [7:0] rom[STRLEN];
|
reg [7:0] rom[STRLEN];
|
||||||
initial for(int i = 0; i < STRLEN; i++) rom[i] = CONF_STR[((STRLEN-i)*8)-1 -:8];
|
|
||||||
|
initial begin
|
||||||
|
if( CONF_STR=="" )
|
||||||
|
$readmemh("cfgstr.hex",rom);
|
||||||
|
else
|
||||||
|
for(int i = 0; i < STRLEN; i++) rom[i] = CONF_STR[((STRLEN-i)*8)-1 -:8];
|
||||||
|
end
|
||||||
|
|
||||||
always @ (posedge clk_sys) conf_byte <= rom[conf_addr];
|
always @ (posedge clk_sys) conf_byte <= rom[conf_addr];
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
@@ -75,7 +75,7 @@ always @(posedge CLK) begin
|
|||||||
END <= 0;
|
END <= 0;
|
||||||
rd <= READ;
|
rd <= READ;
|
||||||
len <= I2C_WLEN;
|
len <= I2C_WLEN;
|
||||||
if(READ) SD <= {2'b10, I2C_ADDR, 1'b1, 1'b1, 8'b11111111, 1'b0, 3'b011, 9'b111111111};
|
if(READ) SD <= {2'b10, I2C_ADDR, 1'b1, 1'b1, 8'b11111111, 1'b1, 3'b011, 9'b111111111};
|
||||||
else SD <= {2'b10, I2C_ADDR, 1'b0, 1'b1, I2C_WDATA1, 1'b1, I2C_WDATA2, 4'b1011};
|
else SD <= {2'b10, I2C_ADDR, 1'b0, 1'b1, I2C_WDATA1, 1'b1, I2C_WDATA2, 4'b1011};
|
||||||
SD_COUNTER <= 0;
|
SD_COUNTER <= 0;
|
||||||
end else begin
|
end else begin
|
||||||
|
|||||||
+10
-3
@@ -8,7 +8,9 @@ module mcp23009
|
|||||||
|
|
||||||
output reg [2:0] btn,
|
output reg [2:0] btn,
|
||||||
input [2:0] led,
|
input [2:0] led,
|
||||||
output reg sd_cd,
|
output reg flg_sd_cd,
|
||||||
|
output reg flg_present,
|
||||||
|
output reg flg_mode,
|
||||||
|
|
||||||
output scl,
|
output scl,
|
||||||
inout sda
|
inout sda
|
||||||
@@ -50,7 +52,9 @@ always@(posedge clk) begin
|
|||||||
idx <= 0;
|
idx <= 0;
|
||||||
btn <= 0;
|
btn <= 0;
|
||||||
rw <= 0;
|
rw <= 0;
|
||||||
sd_cd <= 1;
|
flg_sd_cd <= 1;
|
||||||
|
flg_present <= 0;
|
||||||
|
flg_mode <= 1;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
if(~&init_data[idx]) begin
|
if(~&init_data[idx]) begin
|
||||||
@@ -84,7 +88,10 @@ always@(posedge clk) begin
|
|||||||
state <= 0;
|
state <= 0;
|
||||||
rw <= 0;
|
rw <= 0;
|
||||||
if(!error) begin
|
if(!error) begin
|
||||||
if(rw) {sd_cd, btn} <= {dout[7], dout[5:3]};
|
if(rw) begin
|
||||||
|
{flg_sd_cd, flg_mode, btn} <= {dout[7:3]};
|
||||||
|
flg_present <= 1;
|
||||||
|
end
|
||||||
rw <= ~rw;
|
rw <= ~rw;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+2
-41
@@ -1,44 +1,5 @@
|
|||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_TOOL_NAME "altera_pll_reconfig"
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_TOOL_VERSION "17.0"
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_TOOL_ENV "mwpim"
|
|
||||||
set_global_assignment -library "pll_cfg" -name MISC_FILE [file join $::quartus(qip_path) "pll_cfg.cmp"]
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_TARGETED_DEVICE_FAMILY "Cyclone V"
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_GENERATED_DEVICE_FAMILY "{Cyclone V}"
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_QSYS_MODE "UNKNOWN"
|
|
||||||
set_global_assignment -name SYNTHESIS_ONLY_QIP ON
|
set_global_assignment -name SYNTHESIS_ONLY_QIP ON
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_NAME "cGxsX2hkbWlfY2Zn"
|
set_global_assignment -library "pll_cfg" -name VERILOG_FILE [file join $::quartus(qip_path) "pll_cfg/pll_cfg.v"]
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_DISPLAY_NAME "QWx0ZXJhIFBMTCBSZWNvbmZpZw=="
|
set_global_assignment -library "pll_cfg" -name VERILOG_FILE [file join $::quartus(qip_path) "pll_cfg/pll_cfg_hdmi.v"]
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_REPORT_HIERARCHY "Off"
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_INTERNAL "Off"
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_AUTHOR "QWx0ZXJhIENvcnBvcmF0aW9u"
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_VERSION "MTcuMA=="
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_DESCRIPTION "QWx0ZXJhIFBoYXNlLUxvY2tlZCBMb29wIFJlY29uZmlndXJhdGlvbiBCbG9jayhBTFRFUkFfUExMX1JFQ09ORklHKQ=="
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "RU5BQkxFX0JZVEVFTkFCTEU=::ZmFsc2U=::QWRkIGJ5dGVlbmFibGUgcG9ydA=="
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "QllURUVOQUJMRV9XSURUSA==::NA==::QllURUVOQUJMRV9XSURUSA=="
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "UkVDT05GSUdfQUREUl9XSURUSA==::Ng==::UkVDT05GSUdfQUREUl9XSURUSA=="
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "UkVDT05GSUdfREFUQV9XSURUSA==::MzI=::UkVDT05GSUdfREFUQV9XSURUSA=="
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "cmVjb25mX3dpZHRo::NjQ=::cmVjb25mX3dpZHRo"
|
|
||||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "V0FJVF9GT1JfTE9DSw==::dHJ1ZQ==::V0FJVF9GT1JfTE9DSw=="
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_NAME "YWx0ZXJhX3BsbF9yZWNvbmZpZ190b3A="
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_DISPLAY_NAME "QWx0ZXJhIFBMTCBSZWNvbmZpZw=="
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_REPORT_HIERARCHY "Off"
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_INTERNAL "Off"
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_AUTHOR "QWx0ZXJhIENvcnBvcmF0aW9u"
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_VERSION "MTcuMA=="
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_DESCRIPTION "QWx0ZXJhIFBoYXNlLUxvY2tlZCBMb29wIFJlY29uZmlndXJhdGlvbiBCbG9jayhBTFRFUkFfUExMX1JFQ09ORklHKQ=="
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "ZGV2aWNlX2ZhbWlseQ==::Q3ljbG9uZSBW::ZGV2aWNlX2ZhbWlseQ=="
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "RU5BQkxFX01JRg==::ZmFsc2U=::RW5hYmxlIE1JRiBTdHJlYW1pbmc="
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "RU5BQkxFX0JZVEVFTkFCTEU=::ZmFsc2U=::QWRkIGJ5dGVlbmFibGUgcG9ydA=="
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "QllURUVOQUJMRV9XSURUSA==::NA==::QllURUVOQUJMRV9XSURUSA=="
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "UkVDT05GSUdfQUREUl9XSURUSA==::Ng==::UkVDT05GSUdfQUREUl9XSURUSA=="
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "UkVDT05GSUdfREFUQV9XSURUSA==::MzI=::UkVDT05GSUdfREFUQV9XSURUSA=="
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "cmVjb25mX3dpZHRo::NjQ=::cmVjb25mX3dpZHRo"
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "V0FJVF9GT1JfTE9DSw==::dHJ1ZQ==::V0FJVF9GT1JfTE9DSw=="
|
|
||||||
|
|
||||||
set_global_assignment -library "pll_cfg" -name VERILOG_FILE [file join $::quartus(qip_path) "pll_cfg.v"]
|
|
||||||
set_global_assignment -library "pll_cfg" -name VERILOG_FILE [file join $::quartus(qip_path) "pll_cfg/altera_pll_reconfig_top.v"]
|
set_global_assignment -library "pll_cfg" -name VERILOG_FILE [file join $::quartus(qip_path) "pll_cfg/altera_pll_reconfig_top.v"]
|
||||||
set_global_assignment -library "pll_cfg" -name VERILOG_FILE [file join $::quartus(qip_path) "pll_cfg/altera_pll_reconfig_core.v"]
|
set_global_assignment -library "pll_cfg" -name VERILOG_FILE [file join $::quartus(qip_path) "pll_cfg/altera_pll_reconfig_core.v"]
|
||||||
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_TOOL_NAME "altera_pll_reconfig"
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_TOOL_VERSION "17.0"
|
|
||||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_TOOL_ENV "mwpim"
|
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
module altera_pll_reconfig_core
|
module altera_pll_reconfig_core
|
||||||
#(
|
#(
|
||||||
parameter reconf_width = 64,
|
parameter reconf_width = 64,
|
||||||
parameter device_family = "Stratix V",
|
parameter device_family = "Cyclone V",
|
||||||
// MIF Streaming parameters
|
// MIF Streaming parameters
|
||||||
parameter RECONFIG_ADDR_WIDTH = 6,
|
parameter RECONFIG_ADDR_WIDTH = 6,
|
||||||
parameter RECONFIG_DATA_WIDTH = 32,
|
parameter RECONFIG_DATA_WIDTH = 32,
|
||||||
@@ -1883,7 +1883,7 @@ module fpll_dprio_init (
|
|||||||
endmodule
|
endmodule
|
||||||
module dyn_phase_shift
|
module dyn_phase_shift
|
||||||
#(
|
#(
|
||||||
parameter device_family = "Stratix V"
|
parameter device_family = "Cyclone V"
|
||||||
) (
|
) (
|
||||||
|
|
||||||
input wire clk,
|
input wire clk,
|
||||||
@@ -2112,7 +2112,7 @@ endmodule
|
|||||||
module generic_lcell_comb
|
module generic_lcell_comb
|
||||||
#(
|
#(
|
||||||
//parameter
|
//parameter
|
||||||
parameter family = "Stratix V",
|
parameter family = "Cyclone V",
|
||||||
parameter lut_mask = 64'hAAAAAAAAAAAAAAAA,
|
parameter lut_mask = 64'hAAAAAAAAAAAAAAAA,
|
||||||
parameter dont_touch = "on"
|
parameter dont_touch = "on"
|
||||||
) (
|
) (
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
module altera_pll_reconfig_top
|
module altera_pll_reconfig_top
|
||||||
#(
|
#(
|
||||||
parameter reconf_width = 64,
|
parameter reconf_width = 64,
|
||||||
parameter device_family = "Stratix V",
|
parameter device_family = "Cyclone V",
|
||||||
parameter RECONFIG_ADDR_WIDTH = 6,
|
parameter RECONFIG_ADDR_WIDTH = 6,
|
||||||
parameter RECONFIG_DATA_WIDTH = 32,
|
parameter RECONFIG_DATA_WIDTH = 32,
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
// megafunction wizard: %Altera PLL Reconfig v17.0%
|
||||||
|
// GENERATION: XML
|
||||||
|
// pll_cfg.v
|
||||||
|
|
||||||
|
// Generated using ACDS version 17.0 598
|
||||||
|
|
||||||
|
`timescale 1 ps / 1 ps
|
||||||
|
module pll_cfg #(
|
||||||
|
parameter ENABLE_BYTEENABLE = 0,
|
||||||
|
parameter BYTEENABLE_WIDTH = 4,
|
||||||
|
parameter RECONFIG_ADDR_WIDTH = 6,
|
||||||
|
parameter RECONFIG_DATA_WIDTH = 32,
|
||||||
|
parameter reconf_width = 64,
|
||||||
|
parameter WAIT_FOR_LOCK = 1
|
||||||
|
) (
|
||||||
|
input wire mgmt_clk, // mgmt_clk.clk
|
||||||
|
input wire mgmt_reset, // mgmt_reset.reset
|
||||||
|
output wire mgmt_waitrequest, // mgmt_avalon_slave.waitrequest
|
||||||
|
input wire mgmt_read, // .read
|
||||||
|
input wire mgmt_write, // .write
|
||||||
|
output wire [31:0] mgmt_readdata, // .readdata
|
||||||
|
input wire [5:0] mgmt_address, // .address
|
||||||
|
input wire [31:0] mgmt_writedata, // .writedata
|
||||||
|
output wire [63:0] reconfig_to_pll, // reconfig_to_pll.reconfig_to_pll
|
||||||
|
input wire [63:0] reconfig_from_pll // reconfig_from_pll.reconfig_from_pll
|
||||||
|
);
|
||||||
|
|
||||||
|
altera_pll_reconfig_top #(
|
||||||
|
.device_family ("Cyclone V"),
|
||||||
|
.ENABLE_MIF (0),
|
||||||
|
.MIF_FILE_NAME ("sys/pll_cfg.mif"),
|
||||||
|
.ENABLE_BYTEENABLE (ENABLE_BYTEENABLE),
|
||||||
|
.BYTEENABLE_WIDTH (BYTEENABLE_WIDTH),
|
||||||
|
.RECONFIG_ADDR_WIDTH (RECONFIG_ADDR_WIDTH),
|
||||||
|
.RECONFIG_DATA_WIDTH (RECONFIG_DATA_WIDTH),
|
||||||
|
.reconf_width (reconf_width),
|
||||||
|
.WAIT_FOR_LOCK (WAIT_FOR_LOCK)
|
||||||
|
) pll_cfg_inst (
|
||||||
|
.mgmt_clk (mgmt_clk), // mgmt_clk.clk
|
||||||
|
.mgmt_reset (mgmt_reset), // mgmt_reset.reset
|
||||||
|
.mgmt_waitrequest (mgmt_waitrequest), // mgmt_avalon_slave.waitrequest
|
||||||
|
.mgmt_read (mgmt_read), // .read
|
||||||
|
.mgmt_write (mgmt_write), // .write
|
||||||
|
.mgmt_readdata (mgmt_readdata), // .readdata
|
||||||
|
.mgmt_address (mgmt_address), // .address
|
||||||
|
.mgmt_writedata (mgmt_writedata), // .writedata
|
||||||
|
.reconfig_to_pll (reconfig_to_pll), // reconfig_to_pll.reconfig_to_pll
|
||||||
|
.reconfig_from_pll (reconfig_from_pll), // reconfig_from_pll.reconfig_from_pll
|
||||||
|
.mgmt_byteenable (4'b0000) // (terminated)
|
||||||
|
);
|
||||||
|
|
||||||
|
endmodule
|
||||||
|
// Retrieval info: <?xml version="1.0"?>
|
||||||
|
//<!--
|
||||||
|
// Generated by Altera MegaWizard Launcher Utility version 1.0
|
||||||
|
// ************************************************************
|
||||||
|
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||||
|
// ************************************************************
|
||||||
|
// Copyright (C) 1991-2018 Altera Corporation
|
||||||
|
// Any megafunction design, and related net list (encrypted or decrypted),
|
||||||
|
// support information, device programming or simulation file, and any other
|
||||||
|
// associated documentation or information provided by Altera or a partner
|
||||||
|
// under Altera's Megafunction Partnership Program may be used only to
|
||||||
|
// program PLD devices (but not masked PLD devices) from Altera. Any other
|
||||||
|
// use of such megafunction design, net list, support information, device
|
||||||
|
// programming or simulation file, or any other related documentation or
|
||||||
|
// information is prohibited for any other purpose, including, but not
|
||||||
|
// limited to modification, reverse engineering, de-compiling, or use with
|
||||||
|
// any other silicon devices, unless such use is explicitly licensed under
|
||||||
|
// a separate agreement with Altera or a megafunction partner. Title to
|
||||||
|
// the intellectual property, including patents, copyrights, trademarks,
|
||||||
|
// trade secrets, or maskworks, embodied in any such megafunction design,
|
||||||
|
// net list, support information, device programming or simulation file, or
|
||||||
|
// any other related documentation or information provided by Altera or a
|
||||||
|
// megafunction partner, remains with Altera, the megafunction partner, or
|
||||||
|
// their respective licensors. No other licenses, including any licenses
|
||||||
|
// needed under any third party's intellectual property, are provided herein.
|
||||||
|
//-->
|
||||||
|
// Retrieval info: <instance entity-name="altera_pll_reconfig" version="17.0" >
|
||||||
|
// Retrieval info: <generic name="device_family" value="Cyclone V" />
|
||||||
|
// Retrieval info: <generic name="ENABLE_MIF" value="false" />
|
||||||
|
// Retrieval info: <generic name="MIF_FILE_NAME" value="sys/pll_cfg.mif" />
|
||||||
|
// Retrieval info: <generic name="ENABLE_BYTEENABLE" value="false" />
|
||||||
|
// Retrieval info: </instance>
|
||||||
|
// IPFS_FILES : pll_cfg.vo
|
||||||
|
// RELATED_FILES: pll_cfg.v, altera_pll_reconfig_top.v, altera_pll_reconfig_core.v, altera_std_synchronizer.v
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,2 +1,2 @@
|
|||||||
set_instance_assignment -name PLL_COMPENSATION_MODE DIRECT -to "*pll_hdmi_0002*|altera_pll:altera_pll_i*|*"
|
set_instance_assignment -name PLL_COMPENSATION_MODE DIRECT -to "*pll_hdmi_0002*|altera_pll:altera_pll_i*|*"
|
||||||
#set_instance_assignment -name UNFORCE_MERGE_PLL_OUTPUT_COUNTER ON -to "*pll_hdmi_0002*|altera_pll:altera_pll_i*|*"
|
set_instance_assignment -name UNFORCE_MERGE_PLL_OUTPUT_COUNTER ON -to "*pll_hdmi_0002*|altera_pll:altera_pll_i*|*"
|
||||||
+1
-4
@@ -1,7 +1,4 @@
|
|||||||
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll.13.qip ]
|
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll.13.qip ]
|
||||||
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_hdmi.13.qip ]
|
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_hdmi.13.qip ]
|
||||||
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_audio.13.qip ]
|
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_audio.13.qip ]
|
||||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) pll_cfg.v ]
|
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_cfg.qip ]
|
||||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) pll_cfg/altera_pll_reconfig_core.v ]
|
|
||||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) pll_cfg/altera_pll_reconfig_top.v ]
|
|
||||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) pll_cfg_hdmi.v ]
|
|
||||||
+1
-2
@@ -1,5 +1,4 @@
|
|||||||
set_global_assignment -name QIP_FILE rtl/pll.qip
|
set_global_assignment -name QIP_FILE rtl/pll.qip
|
||||||
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_hdmi.qip ]
|
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_hdmi.qip ]
|
||||||
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_audio.qip ]
|
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_audio.qip ]
|
||||||
#set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_cfg.qip ]
|
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_cfg.qip ]
|
||||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) pll_cfg_hdmi.v ]
|
|
||||||
+4
-4
@@ -58,10 +58,10 @@ localparam DW = WIDE ? 15 : 7;
|
|||||||
localparam SZ = OCTAL ? 8 : 1;
|
localparam SZ = OCTAL ? 8 : 1;
|
||||||
localparam SW = SZ-1;
|
localparam SW = SZ-1;
|
||||||
|
|
||||||
wire [7:0] DATA_TOKEN_CMD25 = 8'hfc;
|
localparam DATA_TOKEN_CMD25 = 8'hfc;
|
||||||
wire [7:0] STOP_TRAN = 8'hfd;
|
localparam STOP_TRAN = 8'hfd;
|
||||||
wire [7:0] DATA_TOKEN = 8'hfe;
|
localparam DATA_TOKEN = 8'hfe;
|
||||||
wire [7:0] WRITE_DATA_RESPONSE = 8'h05;
|
localparam WRITE_DATA_RESPONSE = 8'he5;
|
||||||
|
|
||||||
// number of bytes to wait after a command before sending the reply
|
// number of bytes to wait after a command before sending the reply
|
||||||
localparam NCR = 5+3; // 5 bytes are required (command length)
|
localparam NCR = 5+3; // 5 bytes are required (command length)
|
||||||
|
|||||||
+2
-9
@@ -16,13 +16,6 @@ set_location_assignment PIN_V10 -to ADC_SCK
|
|||||||
set_location_assignment PIN_AC4 -to ADC_SDI
|
set_location_assignment PIN_AC4 -to ADC_SDI
|
||||||
set_location_assignment PIN_AD4 -to ADC_SDO
|
set_location_assignment PIN_AD4 -to ADC_SDO
|
||||||
|
|
||||||
#============================================================
|
|
||||||
# ARDUINO
|
|
||||||
#============================================================
|
|
||||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to ARDUINO_IO[*]
|
|
||||||
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to ARDUINO_IO[*]
|
|
||||||
set_instance_assignment -name CURRENT_STRENGTH_NEW "MAXIMUM CURRENT" -to ARDUINO_IO[*]
|
|
||||||
|
|
||||||
#============================================================
|
#============================================================
|
||||||
# I2C LEDS/BUTTONS
|
# I2C LEDS/BUTTONS
|
||||||
#============================================================
|
#============================================================
|
||||||
@@ -72,8 +65,8 @@ set_location_assignment PIN_AD17 -to SDRAM_A[11]
|
|||||||
set_location_assignment PIN_D12 -to SDRAM_A[12]
|
set_location_assignment PIN_D12 -to SDRAM_A[12]
|
||||||
set_location_assignment PIN_Y17 -to SDRAM_BA[0]
|
set_location_assignment PIN_Y17 -to SDRAM_BA[0]
|
||||||
set_location_assignment PIN_AB25 -to SDRAM_BA[1]
|
set_location_assignment PIN_AB25 -to SDRAM_BA[1]
|
||||||
set_location_assignment PIN_E8 -to SDRAM_DQ[0]
|
set_location_assignment PIN_V12 -to SDRAM_DQ[0]
|
||||||
set_location_assignment PIN_V12 -to SDRAM_DQ[1]
|
set_location_assignment PIN_E8 -to SDRAM_DQ[1]
|
||||||
set_location_assignment PIN_D11 -to SDRAM_DQ[2]
|
set_location_assignment PIN_D11 -to SDRAM_DQ[2]
|
||||||
set_location_assignment PIN_W12 -to SDRAM_DQ[3]
|
set_location_assignment PIN_W12 -to SDRAM_DQ[3]
|
||||||
set_location_assignment PIN_AH13 -to SDRAM_DQ[4]
|
set_location_assignment PIN_AH13 -to SDRAM_DQ[4]
|
||||||
|
|||||||
+5
-1
@@ -25,6 +25,7 @@ set_false_path -from [get_ports {KEY*}]
|
|||||||
set_false_path -from [get_ports {BTN_*}]
|
set_false_path -from [get_ports {BTN_*}]
|
||||||
set_false_path -to [get_ports {LED_*}]
|
set_false_path -to [get_ports {LED_*}]
|
||||||
set_false_path -to [get_ports {VGA_*}]
|
set_false_path -to [get_ports {VGA_*}]
|
||||||
|
set_false_path -from [get_ports {VGA_EN}]
|
||||||
set_false_path -to [get_ports {AUDIO_SPDIF}]
|
set_false_path -to [get_ports {AUDIO_SPDIF}]
|
||||||
set_false_path -to [get_ports {AUDIO_L}]
|
set_false_path -to [get_ports {AUDIO_L}]
|
||||||
set_false_path -to [get_ports {AUDIO_R}]
|
set_false_path -to [get_ports {AUDIO_R}]
|
||||||
@@ -34,6 +35,7 @@ set_false_path -from {cfg[*]}
|
|||||||
set_false_path -from {VSET[*]}
|
set_false_path -from {VSET[*]}
|
||||||
set_false_path -to {wcalc[*] hcalc[*]}
|
set_false_path -to {wcalc[*] hcalc[*]}
|
||||||
set_false_path -to {hdmi_width[*] hdmi_height[*]}
|
set_false_path -to {hdmi_width[*] hdmi_height[*]}
|
||||||
|
set_false_path -to {deb_* btn_en btn_up}
|
||||||
|
|
||||||
set_multicycle_path -to {*_osd|osd_vcnt*} -setup 2
|
set_multicycle_path -to {*_osd|osd_vcnt*} -setup 2
|
||||||
set_multicycle_path -to {*_osd|osd_vcnt*} -hold 1
|
set_multicycle_path -to {*_osd|osd_vcnt*} -hold 1
|
||||||
@@ -58,6 +60,7 @@ set_false_path -from {vol_att[*] scaler_flt[*] led_overtake[*] led_state[*]}
|
|||||||
set_false_path -from {aflt_* acx* acy* areset* arc*}
|
set_false_path -from {aflt_* acx* acy* areset* arc*}
|
||||||
set_false_path -from {arx* ary*}
|
set_false_path -from {arx* ary*}
|
||||||
set_false_path -from {vs_line*}
|
set_false_path -from {vs_line*}
|
||||||
|
set_false_path -from {ColorBurst_Range* PhaseInc* pal_en cvbs yc_en}
|
||||||
|
|
||||||
set_false_path -from {ascal|o_ihsize*}
|
set_false_path -from {ascal|o_ihsize*}
|
||||||
set_false_path -from {ascal|o_ivsize*}
|
set_false_path -from {ascal|o_ivsize*}
|
||||||
@@ -70,4 +73,5 @@ set_false_path -from {ascal|o_htotal* ascal|o_vtotal*}
|
|||||||
set_false_path -from {ascal|o_hsstart* ascal|o_vsstart* ascal|o_hsend* ascal|o_vsend*}
|
set_false_path -from {ascal|o_hsstart* ascal|o_vsstart* ascal|o_hsend* ascal|o_vsend*}
|
||||||
set_false_path -from {ascal|o_hsize* ascal|o_vsize*}
|
set_false_path -from {ascal|o_hsize* ascal|o_vsize*}
|
||||||
|
|
||||||
set_false_path -from {mcp23009|sd_cd}
|
set_false_path -from {mcp23009|flg_*}
|
||||||
|
set_false_path -to {sysmem|fpga_interfaces|clocks_resets|f2h*}
|
||||||
+183
-109
@@ -19,9 +19,6 @@
|
|||||||
//
|
//
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
// Define Config features - For CoCo use of USER I/O
|
|
||||||
//`include "../rtl/config.sv"
|
|
||||||
|
|
||||||
module sys_top
|
module sys_top
|
||||||
(
|
(
|
||||||
/////////// CLOCK //////////
|
/////////// CLOCK //////////
|
||||||
@@ -75,7 +72,7 @@ module sys_top
|
|||||||
output [5:0] VGA_R,
|
output [5:0] VGA_R,
|
||||||
output [5:0] VGA_G,
|
output [5:0] VGA_G,
|
||||||
output [5:0] VGA_B,
|
output [5:0] VGA_B,
|
||||||
inout VGA_HS, // VGA_HS is secondary SD card detect when VGA_EN = 1 (inactive)
|
inout VGA_HS,
|
||||||
output VGA_VS,
|
output VGA_VS,
|
||||||
input VGA_EN, // active low
|
input VGA_EN, // active low
|
||||||
|
|
||||||
@@ -128,27 +125,23 @@ module sys_top
|
|||||||
);
|
);
|
||||||
|
|
||||||
////////////////////// Secondary SD ///////////////////////////////////
|
////////////////////// Secondary SD ///////////////////////////////////
|
||||||
wire SD_CS, SD_CLK, SD_MOSI;
|
wire SD_CS, SD_CLK, SD_MOSI, SD_MISO, SD_CD;
|
||||||
|
|
||||||
`ifndef MISTER_DUAL_SDRAM
|
`ifndef MISTER_DUAL_SDRAM
|
||||||
wire sd_miso = SW[3] | SDIO_DAT[0];
|
wire sd_cd = SDCD_SPDIF & ~SW[2]; // SW[2]=ON workaround for faulty boards without SD card detect pin.
|
||||||
`else
|
assign SD_CD = mcp_en ? mcp_sdcd : sd_cd;
|
||||||
wire sd_miso = 1;
|
assign SD_MISO = SD_CD | (mcp_en ? SD_SPI_MISO : (VGA_EN | SDIO_DAT[0]));
|
||||||
`endif
|
assign SD_SPI_CS = mcp_en ? (mcp_sdcd ? 1'bZ : SD_CS) : (sog & ~cs1 & ~VGA_EN) ? 1'b1 : 1'bZ;
|
||||||
wire SD_MISO = mcp_sdcd ? sd_miso : SD_SPI_MISO;
|
assign SD_SPI_CLK = (~mcp_en | mcp_sdcd) ? 1'bZ : SD_CLK;
|
||||||
|
assign SD_SPI_MOSI = (~mcp_en | mcp_sdcd) ? 1'bZ : SD_MOSI;
|
||||||
`ifndef MISTER_DUAL_SDRAM
|
assign {SDIO_CLK,SDIO_CMD,SDIO_DAT} = av_dis ? 6'bZZZZZZ : (mcp_en | sd_cd) ? {vga_g,vga_r,vga_b} : {SD_CLK,SD_MOSI,SD_CS,3'bZZZ};
|
||||||
assign SDIO_DAT[2:1]= 2'bZZ;
|
|
||||||
assign SDIO_DAT[3] = SW[3] ? 1'bZ : SD_CS;
|
|
||||||
assign SDIO_CLK = SW[3] ? 1'bZ : SD_CLK;
|
|
||||||
assign SDIO_CMD = SW[3] ? 1'bZ : SD_MOSI;
|
|
||||||
assign SD_SPI_CS = mcp_sdcd ? ((~VGA_EN & sog & ~cs1) ? 1'b1 : 1'bZ) : SD_CS;
|
|
||||||
`else
|
`else
|
||||||
|
assign SD_CD = mcp_sdcd;
|
||||||
|
assign SD_MISO = mcp_sdcd | SD_SPI_MISO;
|
||||||
assign SD_SPI_CS = mcp_sdcd ? 1'bZ : SD_CS;
|
assign SD_SPI_CS = mcp_sdcd ? 1'bZ : SD_CS;
|
||||||
`endif
|
|
||||||
|
|
||||||
assign SD_SPI_CLK = mcp_sdcd ? 1'bZ : SD_CLK;
|
assign SD_SPI_CLK = mcp_sdcd ? 1'bZ : SD_CLK;
|
||||||
assign SD_SPI_MOSI = mcp_sdcd ? 1'bZ : SD_MOSI;
|
assign SD_SPI_MOSI = mcp_sdcd ? 1'bZ : SD_MOSI;
|
||||||
|
`endif
|
||||||
|
|
||||||
////////////////////// LEDs/Buttons ///////////////////////////////////
|
////////////////////// LEDs/Buttons ///////////////////////////////////
|
||||||
|
|
||||||
@@ -160,36 +153,59 @@ wire led_d = led_disk[1] ? ~led_disk[0] : ~(led_disk[0] | gp_out[29]);
|
|||||||
wire led_u = ~led_user;
|
wire led_u = ~led_user;
|
||||||
wire led_locked;
|
wire led_locked;
|
||||||
|
|
||||||
`ifndef MISTER_DUAL_SDRAM
|
//LEDs on de10-nano board
|
||||||
assign LED_POWER = (SW[3] | led_p) ? 1'bZ : 1'b0;
|
|
||||||
assign LED_HDD = (SW[3] | led_d) ? 1'bZ : 1'b0;
|
|
||||||
assign LED_USER = (SW[3] | led_u) ? 1'bZ : 1'b0;
|
|
||||||
`endif
|
|
||||||
|
|
||||||
//LEDs on main board
|
|
||||||
assign LED = (led_overtake & led_state) | (~led_overtake & {1'b0,led_locked,1'b0, ~led_p, 1'b0, ~led_d, 1'b0, ~led_u});
|
assign LED = (led_overtake & led_state) | (~led_overtake & {1'b0,led_locked,1'b0, ~led_p, 1'b0, ~led_d, 1'b0, ~led_u});
|
||||||
|
|
||||||
wire btn_r, btn_o, btn_u;
|
|
||||||
`ifdef MISTER_DUAL_SDRAM
|
|
||||||
assign {btn_r,btn_o,btn_u} = SW[3] ? {mcp_btn[1],mcp_btn[2],mcp_btn[0]} : ~{SDRAM2_DQ[9],SDRAM2_DQ[13],SDRAM2_DQ[11]};
|
|
||||||
`else
|
|
||||||
assign {btn_r,btn_o,btn_u} = ~{BTN_RESET,BTN_OSD,BTN_USER} | {mcp_btn[1],mcp_btn[2],mcp_btn[0]};
|
|
||||||
`endif
|
|
||||||
|
|
||||||
wire [2:0] mcp_btn;
|
wire [2:0] mcp_btn;
|
||||||
wire mcp_sdcd;
|
wire mcp_sdcd;
|
||||||
|
wire mcp_en;
|
||||||
|
wire mcp_mode;
|
||||||
mcp23009 mcp23009
|
mcp23009 mcp23009
|
||||||
(
|
(
|
||||||
.clk(FPGA_CLK2_50),
|
.clk(FPGA_CLK2_50),
|
||||||
|
|
||||||
.btn(mcp_btn),
|
.btn(mcp_btn),
|
||||||
.led({led_p, led_d, led_u}),
|
.led({led_p, led_d, led_u}),
|
||||||
.sd_cd(mcp_sdcd),
|
.flg_sd_cd(mcp_sdcd),
|
||||||
|
.flg_present(mcp_en),
|
||||||
|
.flg_mode(mcp_mode),
|
||||||
|
|
||||||
.scl(IO_SCL),
|
.scl(IO_SCL),
|
||||||
.sda(IO_SDA)
|
.sda(IO_SDA)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
wire io_dig = mcp_en ? mcp_mode : SW[3];
|
||||||
|
|
||||||
|
`ifndef MISTER_DUAL_SDRAM
|
||||||
|
wire av_dis = io_dig | VGA_EN;
|
||||||
|
assign LED_POWER = av_dis ? 1'bZ : mcp_en ? de1 : led_p ? 1'bZ : 1'b0;
|
||||||
|
assign LED_HDD = av_dis ? 1'bZ : mcp_en ? (sog & ~cs1) : led_d ? 1'bZ : 1'b0;
|
||||||
|
//assign LED_USER = av_dis ? 1'bZ : mcp_en ? ~vga_tx_clk : led_u ? 1'bZ : 1'b0;
|
||||||
|
assign LED_USER = VGA_TX_CLK;
|
||||||
|
wire BTN_DIS = VGA_EN;
|
||||||
|
`else
|
||||||
|
wire BTN_RESET = 1'b1;
|
||||||
|
wire BTN_OSD = 1'b1;
|
||||||
|
wire BTN_USER = 1'b1;
|
||||||
|
wire BTN_DIS = 1'b1;
|
||||||
|
`endif
|
||||||
|
|
||||||
|
reg BTN_EN = 0;
|
||||||
|
reg [25:0] btn_timeout = 0;
|
||||||
|
initial btn_timeout = 0;
|
||||||
|
always @(posedge FPGA_CLK2_50) begin
|
||||||
|
reg btn_up = 0;
|
||||||
|
reg btn_en = 0;
|
||||||
|
|
||||||
|
btn_up <= BTN_RESET & BTN_OSD & BTN_USER;
|
||||||
|
if(~reset & btn_up & ~&btn_timeout) btn_timeout <= btn_timeout + 1'd1;
|
||||||
|
btn_en <= ~BTN_DIS;
|
||||||
|
BTN_EN <= &btn_timeout & btn_en;
|
||||||
|
end
|
||||||
|
|
||||||
|
wire btn_r = (mcp_en | SW[3]) ? mcp_btn[1] : (BTN_EN & ~BTN_RESET);
|
||||||
|
wire btn_o = (mcp_en | SW[3]) ? mcp_btn[2] : (BTN_EN & ~BTN_OSD );
|
||||||
|
wire btn_u = (mcp_en | SW[3]) ? mcp_btn[0] : (BTN_EN & ~BTN_USER );
|
||||||
|
|
||||||
reg btn_user, btn_osd;
|
reg btn_user, btn_osd;
|
||||||
always @(posedge FPGA_CLK2_50) begin
|
always @(posedge FPGA_CLK2_50) begin
|
||||||
@@ -215,7 +231,7 @@ end
|
|||||||
|
|
||||||
// gp_in[31] = 0 - quick flag that FPGA is initialized (HPS reads 1 when FPGA is not in user mode)
|
// gp_in[31] = 0 - quick flag that FPGA is initialized (HPS reads 1 when FPGA is not in user mode)
|
||||||
// used to avoid lockups while JTAG loading
|
// used to avoid lockups while JTAG loading
|
||||||
wire [31:0] gp_in = {1'b0, btn_user | btn[1], btn_osd | btn[0], SW[3], 8'd0, io_ver, io_ack, io_wide, io_dout | io_dout_sys};
|
wire [31:0] gp_in = {1'b0, btn_user | btn[1], btn_osd | btn[0], io_dig, 8'd0, io_ver, io_ack, io_wide, io_dout | io_dout_sys};
|
||||||
wire [31:0] gp_out;
|
wire [31:0] gp_out;
|
||||||
|
|
||||||
wire [1:0] io_ver = 1; // 0 - obsolete. 1 - optimized HPS I/O. 2,3 - reserved for future.
|
wire [1:0] io_ver = 1; // 0 - obsolete. 1 - optimized HPS I/O. 2,3 - reserved for future.
|
||||||
@@ -270,13 +286,13 @@ cyclonev_hps_interface_mpu_general_purpose h2f_gp
|
|||||||
|
|
||||||
|
|
||||||
reg [15:0] cfg;
|
reg [15:0] cfg;
|
||||||
|
|
||||||
reg cfg_set = 0;
|
reg cfg_set = 0;
|
||||||
wire vga_fb = cfg[12] | vga_force_scaler;
|
|
||||||
|
|
||||||
`ifdef MISTER_DEBUG_NOHDMI
|
`ifdef MISTER_DEBUG_NOHDMI
|
||||||
|
wire vga_fb = 0;
|
||||||
wire direct_video = 1;
|
wire direct_video = 1;
|
||||||
`else
|
`else
|
||||||
|
wire vga_fb = cfg[12] | vga_force_scaler;
|
||||||
wire direct_video = cfg[10];
|
wire direct_video = cfg[10];
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
@@ -284,10 +300,15 @@ wire audio_96k = cfg[6];
|
|||||||
wire csync_en = cfg[3];
|
wire csync_en = cfg[3];
|
||||||
wire io_osd_vga = io_ss1 & ~io_ss2;
|
wire io_osd_vga = io_ss1 & ~io_ss2;
|
||||||
`ifndef MISTER_DUAL_SDRAM
|
`ifndef MISTER_DUAL_SDRAM
|
||||||
|
wire forced_scandoubler = cfg[4];
|
||||||
wire ypbpr_en = cfg[5];
|
wire ypbpr_en = cfg[5];
|
||||||
wire sog = cfg[9];
|
wire sog = cfg[9];
|
||||||
|
`ifdef MISTER_DEBUG_NOHDMI
|
||||||
|
wire vga_scaler = 0;
|
||||||
|
`else
|
||||||
wire vga_scaler = cfg[2] | vga_force_scaler;
|
wire vga_scaler = cfg[2] | vga_force_scaler;
|
||||||
`endif
|
`endif
|
||||||
|
`endif
|
||||||
|
|
||||||
reg cfg_custom_t = 0;
|
reg cfg_custom_t = 0;
|
||||||
reg [5:0] cfg_custom_p1;
|
reg [5:0] cfg_custom_p1;
|
||||||
@@ -312,6 +333,7 @@ reg [11:0] vs_line = 0;
|
|||||||
|
|
||||||
reg scaler_out = 0;
|
reg scaler_out = 0;
|
||||||
reg vrr_mode = 0;
|
reg vrr_mode = 0;
|
||||||
|
wire hdmi_blackout;
|
||||||
|
|
||||||
reg [31:0] aflt_rate = 7056000;
|
reg [31:0] aflt_rate = 7056000;
|
||||||
reg [39:0] acx = 4258969;
|
reg [39:0] acx = 4258969;
|
||||||
@@ -373,6 +395,7 @@ always@(posedge clk_sys) begin
|
|||||||
`ifndef MISTER_DEBUG_NOHDMI
|
`ifndef MISTER_DEBUG_NOHDMI
|
||||||
if(io_din[7:0] == 'h40) io_dout_sys <= fb_crc;
|
if(io_din[7:0] == 'h40) io_dout_sys <= fb_crc;
|
||||||
`endif
|
`endif
|
||||||
|
if(io_din[7:0] == 'h42) io_dout_sys <= {1'b1, frame_cnt};
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
cnt <= cnt + 1'd1;
|
cnt <= cnt + 1'd1;
|
||||||
@@ -479,18 +502,22 @@ always@(posedge clk_sys) begin
|
|||||||
endcase
|
endcase
|
||||||
end
|
end
|
||||||
`endif
|
`endif
|
||||||
`ifndef MISTER_DISABLE_YC
|
|
||||||
if(cmd == 'h41) begin
|
if(cmd == 'h41) begin
|
||||||
case(cnt[3:0])
|
case(cnt[3:0])
|
||||||
|
`ifndef MISTER_DISABLE_YC
|
||||||
0: {pal_en,cvbs,yc_en} <= io_din[2:0];
|
0: {pal_en,cvbs,yc_en} <= io_din[2:0];
|
||||||
|
4: ColorBurst_Range[15:0] <= io_din;
|
||||||
|
5: ColorBurst_Range[16] <= io_din[0];
|
||||||
|
`endif
|
||||||
|
// Subcarrier commands (independent of YC module)
|
||||||
1: PhaseInc[15:0] <= io_din;
|
1: PhaseInc[15:0] <= io_din;
|
||||||
2: PhaseInc[31:16] <= io_din;
|
2: PhaseInc[31:16] <= io_din;
|
||||||
3: PhaseInc[39:32] <= io_din[7:0];
|
3: PhaseInc[39:32] <= io_din[7:0];
|
||||||
4: ColorBurst_Range[15:0] <= io_din;
|
`ifndef MISTER_DUAL_SDRAM
|
||||||
5: ColorBurst_Range[16] <= io_din[0];
|
6: subcarrier <= io_din[0];
|
||||||
|
`endif
|
||||||
endcase
|
endcase
|
||||||
end
|
end
|
||||||
`endif
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -509,6 +536,15 @@ always@(posedge clk_sys) begin
|
|||||||
if(~vs_d2 & vs_d1) vs_wait <= 0;
|
if(~vs_d2 & vs_d1) vs_wait <= 0;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
reg [7:0] frame_cnt;
|
||||||
|
always @(posedge clk_sys) begin
|
||||||
|
reg vs_r, vs_old;
|
||||||
|
|
||||||
|
vs_r <= vs_fix;
|
||||||
|
if(vs_r == vs_fix) vs_old <= vs_r;
|
||||||
|
if(~vs_old & vs_r) frame_cnt <= frame_cnt + 1'd1;
|
||||||
|
end
|
||||||
|
|
||||||
cyclonev_hps_interface_peripheral_uart uart
|
cyclonev_hps_interface_peripheral_uart uart
|
||||||
(
|
(
|
||||||
.ri(0),
|
.ri(0),
|
||||||
@@ -658,6 +694,7 @@ wire vbuf_write;
|
|||||||
wire [23:0] hdmi_data;
|
wire [23:0] hdmi_data;
|
||||||
wire hdmi_vs, hdmi_hs, hdmi_de, hdmi_vbl, hdmi_brd;
|
wire hdmi_vs, hdmi_hs, hdmi_de, hdmi_vbl, hdmi_brd;
|
||||||
wire freeze;
|
wire freeze;
|
||||||
|
wire bob_deint;
|
||||||
|
|
||||||
`ifndef MISTER_DEBUG_NOHDMI
|
`ifndef MISTER_DEBUG_NOHDMI
|
||||||
wire clk_hdmi = hdmi_clk_out;
|
wire clk_hdmi = hdmi_clk_out;
|
||||||
@@ -692,6 +729,7 @@ ascal
|
|||||||
.reset_na (~reset_req),
|
.reset_na (~reset_req),
|
||||||
.run (1),
|
.run (1),
|
||||||
.freeze (freeze),
|
.freeze (freeze),
|
||||||
|
.bob_deint (bob_deint),
|
||||||
|
|
||||||
.i_clk (clk_ihdmi),
|
.i_clk (clk_ihdmi),
|
||||||
.i_ce (ce_hpix),
|
.i_ce (ce_hpix),
|
||||||
@@ -733,6 +771,7 @@ ascal
|
|||||||
.vmax (vmax),
|
.vmax (vmax),
|
||||||
.vrr (vrr_mode),
|
.vrr (vrr_mode),
|
||||||
.vrrmax (HEIGHT + VBP + VS[11:0] + 12'd1),
|
.vrrmax (HEIGHT + VBP + VS[11:0] + 12'd1),
|
||||||
|
.swblack (hdmi_blackout),
|
||||||
|
|
||||||
.mode ({~lowlat,LFB_EN ? LFB_FLT : |scaler_flt,2'b00}),
|
.mode ({~lowlat,LFB_EN ? LFB_FLT : |scaler_flt,2'b00}),
|
||||||
.poly_clk (clk_sys),
|
.poly_clk (clk_sys),
|
||||||
@@ -1068,11 +1107,8 @@ always @(posedge FPGA_CLK1_50) begin
|
|||||||
old_wait <= adj_waitrequest;
|
old_wait <= adj_waitrequest;
|
||||||
if(old_wait & ~adj_waitrequest & gotd) cfg_ready <= 1;
|
if(old_wait & ~adj_waitrequest & gotd) cfg_ready <= 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
`else
|
`else
|
||||||
|
|
||||||
wire cfg_ready = 1;
|
wire cfg_ready = 1;
|
||||||
|
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
assign HDMI_I2C_SCL = hdmi_scl_en ? 1'b0 : 1'bZ;
|
assign HDMI_I2C_SCL = hdmi_scl_en ? 1'b0 : 1'bZ;
|
||||||
@@ -1088,7 +1124,6 @@ cyclonev_hps_interface_peripheral_i2c hdmi_i2c
|
|||||||
);
|
);
|
||||||
|
|
||||||
`ifndef MISTER_DEBUG_NOHDMI
|
`ifndef MISTER_DEBUG_NOHDMI
|
||||||
|
|
||||||
`ifdef MISTER_FB
|
`ifdef MISTER_FB
|
||||||
reg dis_output;
|
reg dis_output;
|
||||||
always @(posedge clk_hdmi) begin
|
always @(posedge clk_hdmi) begin
|
||||||
@@ -1149,10 +1184,10 @@ osd hdmi_osd
|
|||||||
.vs_out(hdmi_vs_osd),
|
.vs_out(hdmi_vs_osd),
|
||||||
.de_out(hdmi_de_osd)
|
.de_out(hdmi_de_osd)
|
||||||
);
|
);
|
||||||
`endif
|
|
||||||
|
|
||||||
wire hdmi_cs_osd;
|
wire hdmi_cs_osd;
|
||||||
csync csync_hdmi(clk_hdmi, hdmi_hs_osd, hdmi_vs_osd, hdmi_cs_osd);
|
csync csync_hdmi(clk_hdmi, hdmi_hs_osd, hdmi_vs_osd, hdmi_cs_osd);
|
||||||
|
`endif
|
||||||
|
|
||||||
reg [23:0] dv_data;
|
reg [23:0] dv_data;
|
||||||
reg dv_hs, dv_vs, dv_de;
|
reg dv_hs, dv_vs, dv_de;
|
||||||
@@ -1263,10 +1298,17 @@ always @(posedge hdmi_tx_clk) begin
|
|||||||
hdmi_dv_vs <= dv_vs;
|
hdmi_dv_vs <= dv_vs;
|
||||||
hdmi_dv_de <= dv_de;
|
hdmi_dv_de <= dv_de;
|
||||||
|
|
||||||
|
`ifndef MISTER_DEBUG_NOHDMI
|
||||||
hs <= (~vga_fb & direct_video) ? hdmi_dv_hs : (direct_video & csync_en) ? hdmi_cs_osd : hdmi_hs_osd;
|
hs <= (~vga_fb & direct_video) ? hdmi_dv_hs : (direct_video & csync_en) ? hdmi_cs_osd : hdmi_hs_osd;
|
||||||
vs <= (~vga_fb & direct_video) ? hdmi_dv_vs : hdmi_vs_osd;
|
vs <= (~vga_fb & direct_video) ? hdmi_dv_vs : hdmi_vs_osd;
|
||||||
de <= (~vga_fb & direct_video) ? hdmi_dv_de : hdmi_de_osd;
|
de <= (~vga_fb & direct_video) ? hdmi_dv_de : hdmi_de_osd;
|
||||||
d <= (~vga_fb & direct_video) ? hdmi_dv_data : hdmi_data_osd;
|
d <= (~vga_fb & direct_video) ? hdmi_dv_data : hdmi_data_osd;
|
||||||
|
`else
|
||||||
|
hs <= hdmi_dv_hs;
|
||||||
|
vs <= hdmi_dv_vs;
|
||||||
|
de <= hdmi_dv_de;
|
||||||
|
d <= hdmi_dv_data;
|
||||||
|
`endif
|
||||||
|
|
||||||
hdmi_out_hs <= hs;
|
hdmi_out_hs <= hs;
|
||||||
hdmi_out_vs <= vs;
|
hdmi_out_vs <= vs;
|
||||||
@@ -1281,6 +1323,46 @@ assign HDMI_TX_D = hdmi_out_d;
|
|||||||
|
|
||||||
///////////////////////// VGA output //////////////////////////////////
|
///////////////////////// VGA output //////////////////////////////////
|
||||||
|
|
||||||
|
`ifndef MISTER_DUAL_SDRAM
|
||||||
|
wire vga_tx_clk;
|
||||||
|
`ifndef MISTER_DEBUG_NOHDMI
|
||||||
|
cyclonev_clkselect vga_clk_sw
|
||||||
|
(
|
||||||
|
.clkselect({1'b1, ~vga_fb & ~vga_scaler}),
|
||||||
|
.inclk({clk_vid, hdmi_clk_out, 2'b00}),
|
||||||
|
.outclk(vga_tx_clk)
|
||||||
|
);
|
||||||
|
`else
|
||||||
|
assign vga_tx_clk = clk_vid;
|
||||||
|
`endif
|
||||||
|
|
||||||
|
wire VGA_TX_CLK;
|
||||||
|
altddio_out
|
||||||
|
#(
|
||||||
|
.extend_oe_disable("OFF"),
|
||||||
|
.intended_device_family("Cyclone V"),
|
||||||
|
.invert_output("OFF"),
|
||||||
|
.lpm_hint("UNUSED"),
|
||||||
|
.lpm_type("altddio_out"),
|
||||||
|
.oe_reg("UNREGISTERED"),
|
||||||
|
.power_up_high("OFF"),
|
||||||
|
.width(1)
|
||||||
|
)
|
||||||
|
vgaclk_ddr
|
||||||
|
(
|
||||||
|
.datain_h(1'b0),
|
||||||
|
.datain_l(1'b1),
|
||||||
|
.outclock(vga_tx_clk),
|
||||||
|
.dataout(VGA_TX_CLK),
|
||||||
|
.aclr(~mcp_en & ~av_dis),
|
||||||
|
.aset(1'b0),
|
||||||
|
.oe(~av_dis & (mcp_en | ~led_u)),
|
||||||
|
.outclocken(1'b1),
|
||||||
|
.sclr(1'b0),
|
||||||
|
.sset(1'b0)
|
||||||
|
);
|
||||||
|
`endif
|
||||||
|
|
||||||
wire [23:0] vga_data_sl;
|
wire [23:0] vga_data_sl;
|
||||||
wire vga_de_sl, vga_ce_sl, vga_vs_sl, vga_hs_sl;
|
wire vga_de_sl, vga_ce_sl, vga_vs_sl, vga_hs_sl;
|
||||||
scanlines #(0) VGA_scanlines
|
scanlines #(0) VGA_scanlines
|
||||||
@@ -1302,7 +1384,7 @@ scanlines #(0) VGA_scanlines
|
|||||||
);
|
);
|
||||||
|
|
||||||
wire [23:0] vga_data_osd;
|
wire [23:0] vga_data_osd;
|
||||||
wire vga_vs_osd, vga_hs_osd;
|
wire vga_vs_osd, vga_hs_osd, vga_de_osd;
|
||||||
osd vga_osd
|
osd vga_osd
|
||||||
(
|
(
|
||||||
.clk_sys(clk_sys),
|
.clk_sys(clk_sys),
|
||||||
@@ -1320,7 +1402,8 @@ osd vga_osd
|
|||||||
|
|
||||||
.dout(vga_data_osd),
|
.dout(vga_data_osd),
|
||||||
.hs_out(vga_hs_osd),
|
.hs_out(vga_hs_osd),
|
||||||
.vs_out(vga_vs_osd)
|
.vs_out(vga_vs_osd),
|
||||||
|
.de_out(vga_de_osd)
|
||||||
);
|
);
|
||||||
|
|
||||||
wire vga_cs_osd;
|
wire vga_cs_osd;
|
||||||
@@ -1331,9 +1414,8 @@ csync csync_vga(clk_vid, vga_hs_osd, vga_vs_osd, vga_cs_osd);
|
|||||||
reg yc_en;
|
reg yc_en;
|
||||||
reg cvbs;
|
reg cvbs;
|
||||||
reg [16:0] ColorBurst_Range;
|
reg [16:0] ColorBurst_Range;
|
||||||
reg [39:0] PhaseInc;
|
|
||||||
wire [23:0] yc_o;
|
wire [23:0] yc_o;
|
||||||
wire yc_hs, yc_vs, yc_cs;
|
wire yc_hs, yc_vs, yc_cs, yc_de;
|
||||||
|
|
||||||
yc_out yc_out
|
yc_out yc_out
|
||||||
(
|
(
|
||||||
@@ -1345,18 +1427,34 @@ csync csync_vga(clk_vid, vga_hs_osd, vga_vs_osd, vga_cs_osd);
|
|||||||
.hsync(vga_hs_osd),
|
.hsync(vga_hs_osd),
|
||||||
.vsync(vga_vs_osd),
|
.vsync(vga_vs_osd),
|
||||||
.csync(vga_cs_osd),
|
.csync(vga_cs_osd),
|
||||||
|
.de(vga_de_osd),
|
||||||
.dout(yc_o),
|
.dout(yc_o),
|
||||||
.din(vga_data_osd),
|
.din(vga_data_osd),
|
||||||
.hsync_o(yc_hs),
|
.hsync_o(yc_hs),
|
||||||
.vsync_o(yc_vs),
|
.vsync_o(yc_vs),
|
||||||
.csync_o(yc_cs)
|
.csync_o(yc_cs),
|
||||||
|
.de_o(yc_de)
|
||||||
);
|
);
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
|
reg [39:0] PhaseInc;
|
||||||
|
|
||||||
`ifndef MISTER_DUAL_SDRAM
|
`ifndef MISTER_DUAL_SDRAM
|
||||||
|
// Subcarrier generation for external encoders (independent of YC module)
|
||||||
|
reg subcarrier;
|
||||||
|
|
||||||
|
reg [39:0] sub_accum;
|
||||||
|
always @(posedge clk_vid) sub_accum <= sub_accum + PhaseInc;
|
||||||
|
|
||||||
|
// 1-bit output for positive/negative of wave, no LUT required. Output 1 if disabled for further logic
|
||||||
|
reg subcarrier_out;
|
||||||
|
always @(posedge clk_vid) subcarrier_out <= ~(subcarrier & csync_en & ~ypbpr_en & ~forced_scandoubler & ~vgas_en) | sub_accum[39];
|
||||||
|
|
||||||
|
|
||||||
wire VGA_DISABLE;
|
wire VGA_DISABLE;
|
||||||
wire [23:0] vgas_o;
|
wire [23:0] vgas_o;
|
||||||
wire vgas_hs, vgas_vs, vgas_cs;
|
wire vgas_hs, vgas_vs, vgas_cs, vgas_de;
|
||||||
|
`ifndef MISTER_DEBUG_NOHDMI
|
||||||
vga_out vga_scaler_out
|
vga_out vga_scaler_out
|
||||||
(
|
(
|
||||||
.clk(clk_hdmi),
|
.clk(clk_hdmi),
|
||||||
@@ -1364,15 +1462,20 @@ csync csync_vga(clk_vid, vga_hs_osd, vga_vs_osd, vga_cs_osd);
|
|||||||
.hsync(hdmi_hs_osd),
|
.hsync(hdmi_hs_osd),
|
||||||
.vsync(hdmi_vs_osd),
|
.vsync(hdmi_vs_osd),
|
||||||
.csync(hdmi_cs_osd),
|
.csync(hdmi_cs_osd),
|
||||||
|
.de(hdmi_de_osd),
|
||||||
.dout(vgas_o),
|
.dout(vgas_o),
|
||||||
.din({24{hdmi_de_osd}} & hdmi_data_osd),
|
.din({24{hdmi_de_osd}} & hdmi_data_osd),
|
||||||
.hsync_o(vgas_hs),
|
.hsync_o(vgas_hs),
|
||||||
.vsync_o(vgas_vs),
|
.vsync_o(vgas_vs),
|
||||||
.csync_o(vgas_cs)
|
.csync_o(vgas_cs),
|
||||||
|
.de_o(vgas_de)
|
||||||
);
|
);
|
||||||
|
`else
|
||||||
|
assign {vgas_o, vgas_hs, vgas_vs, vgas_cs, vgas_de} = 0;
|
||||||
|
`endif
|
||||||
|
|
||||||
wire [23:0] vga_o, vga_o_t;
|
wire [23:0] vga_o, vga_o_t;
|
||||||
wire vga_hs, vga_vs, vga_cs, vga_hs_t, vga_vs_t, vga_cs_t;
|
wire vga_hs, vga_vs, vga_cs, vga_de, vga_hs_t, vga_vs_t, vga_cs_t, vga_de_t;
|
||||||
vga_out vga_out
|
vga_out vga_out
|
||||||
(
|
(
|
||||||
.clk(clk_vid),
|
.clk(clk_vid),
|
||||||
@@ -1380,26 +1483,35 @@ csync csync_vga(clk_vid, vga_hs_osd, vga_vs_osd, vga_cs_osd);
|
|||||||
.hsync(vga_hs_osd),
|
.hsync(vga_hs_osd),
|
||||||
.vsync(vga_vs_osd),
|
.vsync(vga_vs_osd),
|
||||||
.csync(vga_cs_osd),
|
.csync(vga_cs_osd),
|
||||||
|
.de(vga_de_osd),
|
||||||
.dout(vga_o_t),
|
.dout(vga_o_t),
|
||||||
.din(vga_data_osd),
|
.din(vga_data_osd),
|
||||||
.hsync_o(vga_hs_t),
|
.hsync_o(vga_hs_t),
|
||||||
.vsync_o(vga_vs_t),
|
.vsync_o(vga_vs_t),
|
||||||
.csync_o(vga_cs_t)
|
.csync_o(vga_cs_t),
|
||||||
|
.de_o(vga_de_t)
|
||||||
);
|
);
|
||||||
|
|
||||||
`ifndef MISTER_DISABLE_YC
|
`ifndef MISTER_DISABLE_YC
|
||||||
assign {vga_o, vga_hs, vga_vs, vga_cs } = ~yc_en ? {vga_o_t, vga_hs_t, vga_vs_t, vga_cs_t } : {yc_o, yc_hs, yc_vs, yc_cs };
|
assign {vga_o, vga_hs, vga_vs, vga_cs, vga_de } = ~yc_en ? {vga_o_t, vga_hs_t, vga_vs_t, vga_cs_t, vga_de_t } : {yc_o, yc_hs, yc_vs, yc_cs, yc_de };
|
||||||
`else
|
`else
|
||||||
assign {vga_o, vga_hs, vga_vs, vga_cs } = {vga_o_t, vga_hs_t, vga_vs_t, vga_cs_t } ;
|
assign {vga_o, vga_hs, vga_vs, vga_cs, vga_de } = {vga_o_t, vga_hs_t, vga_vs_t, vga_cs_t, vga_de_t } ;
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
wire cs1 = (vga_fb | vga_scaler) ? vgas_cs : vga_cs;
|
wire vgas_en = vga_fb | vga_scaler;
|
||||||
|
|
||||||
assign VGA_VS = (VGA_EN | SW[3]) ? 1'bZ : (((vga_fb | vga_scaler) ? (~vgas_vs ^ VS[12]) : VGA_DISABLE ? 1'd1 : ~vga_vs) | csync_en);
|
wire cs1 = vgas_en ? vgas_cs : vga_cs;
|
||||||
assign VGA_HS = (VGA_EN | SW[3]) ? 1'bZ : ((vga_fb | vga_scaler) ? ((csync_en ? ~vgas_cs : ~vgas_hs) ^ HS[12]) : VGA_DISABLE ? 1'd1 : (csync_en ? ~vga_cs : ~vga_hs));
|
wire de1 = vgas_en ? vgas_de : vga_de;
|
||||||
assign VGA_R = (VGA_EN | SW[3]) ? 6'bZZZZZZ : (vga_fb | vga_scaler) ? vgas_o[23:18] : VGA_DISABLE ? 6'd0 : vga_o[23:18];
|
|
||||||
assign VGA_G = (VGA_EN | SW[3]) ? 6'bZZZZZZ : (vga_fb | vga_scaler) ? vgas_o[15:10] : VGA_DISABLE ? 6'd0 : vga_o[15:10];
|
assign VGA_VS = av_dis ? 1'bZ :(((vgas_en ? (~vgas_vs ^ VS[12]) : VGA_DISABLE ? 1'd1 : ~vga_vs) | csync_en) & subcarrier_out);
|
||||||
assign VGA_B = (VGA_EN | SW[3]) ? 6'bZZZZZZ : (vga_fb | vga_scaler) ? vgas_o[7:2] : VGA_DISABLE ? 6'd0 : vga_o[7:2] ;
|
assign VGA_HS = av_dis ? 1'bZ : (vgas_en ? ((csync_en ? ~vgas_cs : ~vgas_hs) ^ HS[12]) : VGA_DISABLE ? 1'd1 : (csync_en ? ~vga_cs : ~vga_hs));
|
||||||
|
assign VGA_R = av_dis ? 6'bZZZZZZ : vgas_en ? vgas_o[23:18] : VGA_DISABLE ? 6'd0 : vga_o[23:18];
|
||||||
|
assign VGA_G = av_dis ? 6'bZZZZZZ : vgas_en ? vgas_o[15:10] : VGA_DISABLE ? 6'd0 : vga_o[15:10];
|
||||||
|
assign VGA_B = av_dis ? 6'bZZZZZZ : vgas_en ? vgas_o[7:2] : VGA_DISABLE ? 6'd0 : vga_o[7:2] ;
|
||||||
|
|
||||||
|
wire [1:0] vga_r = vgas_en ? vgas_o[17:16] : VGA_DISABLE ? 2'd0 : vga_o[17:16];
|
||||||
|
wire [1:0] vga_g = vgas_en ? vgas_o[9:8] : VGA_DISABLE ? 2'd0 : vga_o[9:8];
|
||||||
|
wire [1:0] vga_b = vgas_en ? vgas_o[1:0] : VGA_DISABLE ? 2'd0 : vga_o[1:0];
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
reg video_sync = 0;
|
reg video_sync = 0;
|
||||||
@@ -1429,14 +1541,14 @@ end
|
|||||||
|
|
||||||
///////////////////////// Audio output ////////////////////////////////
|
///////////////////////// Audio output ////////////////////////////////
|
||||||
|
|
||||||
assign SDCD_SPDIF =(SW[3] & ~spdif) ? 1'b0 : 1'bZ;
|
assign SDCD_SPDIF = (mcp_en & ~spdif) ? 1'b0 : 1'bZ;
|
||||||
|
|
||||||
`ifndef MISTER_DUAL_SDRAM
|
`ifndef MISTER_DUAL_SDRAM
|
||||||
wire analog_l, analog_r;
|
wire analog_l, analog_r;
|
||||||
|
|
||||||
assign AUDIO_SPDIF = SW[3] ? 1'bZ : SW[0] ? HDMI_LRCLK : spdif;
|
assign AUDIO_SPDIF = av_dis ? 1'bZ : (SW[0] | mcp_en) ? HDMI_LRCLK : spdif;
|
||||||
assign AUDIO_R = SW[3] ? 1'bZ : SW[0] ? HDMI_I2S : analog_r;
|
assign AUDIO_R = av_dis ? 1'bZ : (SW[0] | mcp_en) ? HDMI_I2S : analog_r;
|
||||||
assign AUDIO_L = SW[3] ? 1'bZ : SW[0] ? HDMI_SCLK : analog_l;
|
assign AUDIO_L = av_dis ? 1'bZ : (SW[0] | mcp_en) ? HDMI_SCLK : analog_l;
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
assign HDMI_MCLK = clk_audio;
|
assign HDMI_MCLK = clk_audio;
|
||||||
@@ -1529,24 +1641,7 @@ alsa alsa
|
|||||||
`endif
|
`endif
|
||||||
|
|
||||||
//////////////// User I/O (USB 3.0 connector) /////////////////////////
|
//////////////// User I/O (USB 3.0 connector) /////////////////////////
|
||||||
// Modifications for use of the CoCo3 with LA
|
|
||||||
`ifdef Config_Debug
|
|
||||||
//assign USER_IO[0] = !user_out[0] ? 1'b0 : 1'bZ;
|
|
||||||
//assign USER_IO[1] = !user_out[1] ? 1'b0 : 1'bZ;
|
|
||||||
//assign USER_IO[2] = !user_out[2] ? 1'b0 : 1'bZ;
|
|
||||||
//assign USER_IO[3] = !user_out[3] ? 1'b0 : 1'bZ;
|
|
||||||
//assign USER_IO[4] = !user_out[4] ? 1'b0 : 1'bZ;
|
|
||||||
//assign USER_IO[5] = !user_out[5] ? 1'b0 : 1'bZ;
|
|
||||||
//assign USER_IO[6] = !user_out[6] ? 1'b0 : 1'bZ;
|
|
||||||
|
|
||||||
assign USER_IO[0] = user_out[0];
|
|
||||||
assign USER_IO[1] = user_out[1];
|
|
||||||
assign USER_IO[2] = user_out[2];
|
|
||||||
assign USER_IO[3] = user_out[3];
|
|
||||||
assign USER_IO[4] = user_out[4];
|
|
||||||
assign USER_IO[5] = user_out[5];
|
|
||||||
assign USER_IO[6] = user_out[6];
|
|
||||||
`else
|
|
||||||
assign USER_IO[0] = !user_out[0] ? 1'b0 : 1'bZ;
|
assign USER_IO[0] = !user_out[0] ? 1'b0 : 1'bZ;
|
||||||
assign USER_IO[1] = !user_out[1] ? 1'b0 : 1'bZ;
|
assign USER_IO[1] = !user_out[1] ? 1'b0 : 1'bZ;
|
||||||
assign USER_IO[2] = !(SW[1] ? HDMI_I2S : user_out[2]) ? 1'b0 : 1'bZ;
|
assign USER_IO[2] = !(SW[1] ? HDMI_I2S : user_out[2]) ? 1'b0 : 1'bZ;
|
||||||
@@ -1554,7 +1649,6 @@ assign USER_IO[3] = !user_out[3] ? 1'b0 : 1'bZ;
|
|||||||
assign USER_IO[4] = !(SW[1] ? HDMI_SCLK : user_out[4]) ? 1'b0 : 1'bZ;
|
assign USER_IO[4] = !(SW[1] ? HDMI_SCLK : user_out[4]) ? 1'b0 : 1'bZ;
|
||||||
assign USER_IO[5] = !(SW[1] ? HDMI_LRCLK : user_out[5]) ? 1'b0 : 1'bZ;
|
assign USER_IO[5] = !(SW[1] ? HDMI_LRCLK : user_out[5]) ? 1'b0 : 1'bZ;
|
||||||
assign USER_IO[6] = !user_out[6] ? 1'b0 : 1'bZ;
|
assign USER_IO[6] = !user_out[6] ? 1'b0 : 1'bZ;
|
||||||
`endif
|
|
||||||
|
|
||||||
assign user_in[0] = USER_IO[0];
|
assign user_in[0] = USER_IO[0];
|
||||||
assign user_in[1] = USER_IO[1];
|
assign user_in[1] = USER_IO[1];
|
||||||
@@ -1672,6 +1766,8 @@ emu emu
|
|||||||
.HDMI_WIDTH(direct_video ? 12'd0 : hdmi_width),
|
.HDMI_WIDTH(direct_video ? 12'd0 : hdmi_width),
|
||||||
.HDMI_HEIGHT(direct_video ? 12'd0 : hdmi_height),
|
.HDMI_HEIGHT(direct_video ? 12'd0 : hdmi_height),
|
||||||
.HDMI_FREEZE(freeze),
|
.HDMI_FREEZE(freeze),
|
||||||
|
.HDMI_BLACKOUT(hdmi_blackout),
|
||||||
|
.HDMI_BOB_DEINT(bob_deint),
|
||||||
|
|
||||||
.CLK_VIDEO(clk_vid),
|
.CLK_VIDEO(clk_vid),
|
||||||
.CE_PIXEL(ce_pix),
|
.CE_PIXEL(ce_pix),
|
||||||
@@ -1744,7 +1840,7 @@ emu emu
|
|||||||
.SDRAM2_nRAS(SDRAM2_nRAS),
|
.SDRAM2_nRAS(SDRAM2_nRAS),
|
||||||
.SDRAM2_nCAS(SDRAM2_nCAS),
|
.SDRAM2_nCAS(SDRAM2_nCAS),
|
||||||
.SDRAM2_CLK(SDRAM2_CLK),
|
.SDRAM2_CLK(SDRAM2_CLK),
|
||||||
.SDRAM2_EN(SW[3]),
|
.SDRAM2_EN(io_dig),
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
.BUTTONS(btn),
|
.BUTTONS(btn),
|
||||||
@@ -1754,11 +1850,7 @@ emu emu
|
|||||||
.SD_MOSI(SD_MOSI),
|
.SD_MOSI(SD_MOSI),
|
||||||
.SD_MISO(SD_MISO),
|
.SD_MISO(SD_MISO),
|
||||||
.SD_CS(SD_CS),
|
.SD_CS(SD_CS),
|
||||||
`ifdef MISTER_DUAL_SDRAM
|
.SD_CD(SD_CD),
|
||||||
.SD_CD(mcp_sdcd),
|
|
||||||
`else
|
|
||||||
.SD_CD(mcp_sdcd & (SW[0] ? VGA_HS : (SW[3] | SDCD_SPDIF))),
|
|
||||||
`endif
|
|
||||||
|
|
||||||
.UART_CTS(uart_rts),
|
.UART_CTS(uart_rts),
|
||||||
.UART_RTS(uart_cts),
|
.UART_RTS(uart_cts),
|
||||||
@@ -1800,24 +1892,6 @@ always @(posedge clk) begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
/*
|
|
||||||
always @(posedge clk) begin
|
|
||||||
integer pos = 0, neg = 0, cnt = 0;
|
|
||||||
reg s1,s2;
|
|
||||||
|
|
||||||
s1 <= sync_in;
|
|
||||||
s2 <= s1;
|
|
||||||
|
|
||||||
if(~s2 & s1) neg <= cnt;
|
|
||||||
if(s2 & ~s1) pos <= cnt;
|
|
||||||
|
|
||||||
cnt <= cnt + 1;
|
|
||||||
if(s2 != s1) cnt <= 0;
|
|
||||||
|
|
||||||
pol <= pos > neg;
|
|
||||||
end
|
|
||||||
*/
|
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
+6
-3
@@ -7,13 +7,15 @@ module vga_out
|
|||||||
input hsync,
|
input hsync,
|
||||||
input vsync,
|
input vsync,
|
||||||
input csync,
|
input csync,
|
||||||
|
input de,
|
||||||
|
|
||||||
input [23:0] din,
|
input [23:0] din,
|
||||||
output [23:0] dout,
|
output [23:0] dout,
|
||||||
|
|
||||||
output reg hsync_o,
|
output reg hsync_o,
|
||||||
output reg vsync_o,
|
output reg vsync_o,
|
||||||
output reg csync_o
|
output reg csync_o,
|
||||||
|
output reg de_o
|
||||||
);
|
);
|
||||||
|
|
||||||
wire [7:0] red = din[23:16];
|
wire [7:0] red = din[23:16];
|
||||||
@@ -35,8 +37,8 @@ always @(posedge clk) begin
|
|||||||
reg [18:0] y_1b, pb_1b, pr_1b;
|
reg [18:0] y_1b, pb_1b, pr_1b;
|
||||||
reg [18:0] y_2, pb_2, pr_2;
|
reg [18:0] y_2, pb_2, pr_2;
|
||||||
reg [23:0] din1, din2;
|
reg [23:0] din1, din2;
|
||||||
reg hsync2, vsync2, csync2;
|
reg hsync2, vsync2, csync2, de2;
|
||||||
reg hsync1, vsync1, csync1;
|
reg hsync1, vsync1, csync1, de1;
|
||||||
|
|
||||||
y_1r <= {red, 6'd0} + {red, 3'd0} + {red, 2'd0} + red;
|
y_1r <= {red, 6'd0} + {red, 3'd0} + {red, 2'd0} + red;
|
||||||
pb_1r <= 19'd32768 - ({red, 5'd0} + {red, 3'd0} + {red, 1'd0});
|
pb_1r <= 19'd32768 - ({red, 5'd0} + {red, 3'd0} + {red, 1'd0});
|
||||||
@@ -61,6 +63,7 @@ always @(posedge clk) begin
|
|||||||
hsync_o <= hsync2; hsync2 <= hsync1; hsync1 <= hsync;
|
hsync_o <= hsync2; hsync2 <= hsync1; hsync1 <= hsync;
|
||||||
vsync_o <= vsync2; vsync2 <= vsync1; vsync1 <= vsync;
|
vsync_o <= vsync2; vsync2 <= vsync1; vsync1 <= vsync;
|
||||||
csync_o <= csync2; csync2 <= csync1; csync1 <= csync;
|
csync_o <= csync2; csync2 <= csync1; csync1 <= csync;
|
||||||
|
de_o <= de2; de2 <= de1; de1 <= de;
|
||||||
|
|
||||||
rgb <= din2; din2 <= din1; din1 <= din;
|
rgb <= din2; din2 <= din1; din1 <= din;
|
||||||
end
|
end
|
||||||
|
|||||||
+10
-1
@@ -26,6 +26,10 @@ module video_cleaner
|
|||||||
//optional de
|
//optional de
|
||||||
input DE_in,
|
input DE_in,
|
||||||
|
|
||||||
|
//optional interlace support
|
||||||
|
input interlace,
|
||||||
|
input f1,
|
||||||
|
|
||||||
// video output signals
|
// video output signals
|
||||||
output reg [7:0] VGA_R,
|
output reg [7:0] VGA_R,
|
||||||
output reg [7:0] VGA_G,
|
output reg [7:0] VGA_G,
|
||||||
@@ -56,16 +60,21 @@ always @(posedge clk_vid) begin
|
|||||||
HBlank_out <= hbl;
|
HBlank_out <= hbl;
|
||||||
|
|
||||||
VGA_HS <= hs;
|
VGA_HS <= hs;
|
||||||
if(~VGA_HS & hs) VGA_VS <= vs;
|
|
||||||
|
|
||||||
VGA_R <= R;
|
VGA_R <= R;
|
||||||
VGA_G <= G;
|
VGA_G <= G;
|
||||||
VGA_B <= B;
|
VGA_B <= B;
|
||||||
DE_out <= DE_in;
|
DE_out <= DE_in;
|
||||||
|
|
||||||
|
if (interlace & f1) begin
|
||||||
|
VGA_VS <= vs;
|
||||||
|
VBlank_out <= vbl;
|
||||||
|
end else begin
|
||||||
|
if(~VGA_HS & hs) VGA_VS <= vs;
|
||||||
if(HBlank_out & ~hbl) VBlank_out <= vbl;
|
if(HBlank_out & ~hbl) VBlank_out <= vbl;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
|||||||
+21
-10
@@ -170,10 +170,8 @@ reg [11:0] mul_arg1, mul_arg2;
|
|||||||
wire [23:0] mul_res;
|
wire [23:0] mul_res;
|
||||||
sys_umul #(12,12) mul(CLK_VIDEO,mul_start,mul_run, mul_arg1,mul_arg2,mul_res);
|
sys_umul #(12,12) mul(CLK_VIDEO,mul_start,mul_run, mul_arg1,mul_arg2,mul_res);
|
||||||
|
|
||||||
wire [11:0] wideres = mul_res[11:0] + hsize;
|
|
||||||
|
|
||||||
always @(posedge CLK_VIDEO) begin
|
always @(posedge CLK_VIDEO) begin
|
||||||
reg [11:0] oheight,htarget,wres;
|
reg [11:0] oheight,htarget,wres,hinteger,wideres;
|
||||||
reg [12:0] arxf,aryf;
|
reg [12:0] arxf,aryf;
|
||||||
reg [3:0] cnt;
|
reg [3:0] cnt;
|
||||||
reg narrow;
|
reg narrow;
|
||||||
@@ -264,7 +262,8 @@ always @(posedge CLK_VIDEO) begin
|
|||||||
// [3] 1080 / 512 * 512 * 4 / 3 / 512 * 512 -> 1024
|
// [3] 1080 / 512 * 512 * 4 / 3 / 512 * 512 -> 1024
|
||||||
|
|
||||||
7: if(mul_res <= HDMI_WIDTH) begin
|
7: if(mul_res <= HDMI_WIDTH) begin
|
||||||
cnt <= 10;
|
hinteger = mul_res[11:0];
|
||||||
|
cnt <= 12;
|
||||||
end
|
end
|
||||||
|
|
||||||
8: begin
|
8: begin
|
||||||
@@ -286,8 +285,20 @@ always @(posedge CLK_VIDEO) begin
|
|||||||
// [3] 1920 / 512 * 512 -> 1536
|
// [3] 1920 / 512 * 512 -> 1536
|
||||||
|
|
||||||
10: begin
|
10: begin
|
||||||
narrow <= ((htarget - mul_res[11:0]) <= (wideres - htarget)) || (wideres > HDMI_WIDTH);
|
hinteger <= mul_res[11:0];
|
||||||
wres <= mul_res[11:0] == htarget ? mul_res[11:0] : wideres;
|
mul_arg1 <= vsize;
|
||||||
|
mul_arg2 <= div_res[11:0] ? div_res[11:0] : 12'd1;
|
||||||
|
mul_start <= 1;
|
||||||
|
end
|
||||||
|
|
||||||
|
11: begin
|
||||||
|
oheight <= mul_res[11:0];
|
||||||
|
end
|
||||||
|
|
||||||
|
12: begin
|
||||||
|
wideres <= hinteger + hsize;
|
||||||
|
narrow <= ((htarget - hinteger) <= (wideres - htarget)) || (wideres > HDMI_WIDTH);
|
||||||
|
wres <= hinteger == htarget ? hinteger : wideres;
|
||||||
end
|
end
|
||||||
// [1] 1066 - 720 = 346 <= 1440 - 1066 = 374 || 1440 > 1920 -> true
|
// [1] 1066 - 720 = 346 <= 1440 - 1066 = 374 || 1440 > 1920 -> true
|
||||||
// [2] 1280 - 1280 = 0 <= 1920 - 1280 = 640 || 1920 > 1920 -> true
|
// [2] 1280 - 1280 = 0 <= 1920 - 1280 = 640 || 1920 > 1920 -> true
|
||||||
@@ -299,11 +310,11 @@ always @(posedge CLK_VIDEO) begin
|
|||||||
// to target width, meaning it is not optimal for source aspect ratio.
|
// to target width, meaning it is not optimal for source aspect ratio.
|
||||||
// otherwise it is set to narrow width that is optimal.
|
// otherwise it is set to narrow width that is optimal.
|
||||||
|
|
||||||
11: begin
|
13: begin
|
||||||
case(SCALE)
|
case(SCALE)
|
||||||
2: arxf <= {1'b1, mul_res[11:0]};
|
2: arxf <= {1'b1, hinteger};
|
||||||
3: arxf <= {1'b1, (wres > HDMI_WIDTH) ? mul_res[11:0] : wres};
|
3: arxf <= {1'b1, (wres > HDMI_WIDTH) ? hinteger : wres};
|
||||||
4: arxf <= {1'b1, narrow ? mul_res[11:0] : wres};
|
4: arxf <= {1'b1, narrow ? hinteger : wres};
|
||||||
default: arxf <= {1'b1, div_num[11:0]};
|
default: arxf <= {1'b1, div_num[11:0]};
|
||||||
endcase
|
endcase
|
||||||
aryf <= {1'b1, oheight};
|
aryf <= {1'b1, oheight};
|
||||||
|
|||||||
+9
-6
@@ -36,13 +36,15 @@ module yc_out
|
|||||||
input hsync,
|
input hsync,
|
||||||
input vsync,
|
input vsync,
|
||||||
input csync,
|
input csync,
|
||||||
|
input de,
|
||||||
|
|
||||||
input [23:0] din,
|
input [23:0] din,
|
||||||
output [23:0] dout,
|
output [23:0] dout,
|
||||||
|
|
||||||
output reg hsync_o,
|
output reg hsync_o,
|
||||||
output reg vsync_o,
|
output reg vsync_o,
|
||||||
output reg csync_o
|
output reg csync_o,
|
||||||
|
output reg de_o
|
||||||
);
|
);
|
||||||
|
|
||||||
wire [7:0] red = din[23:16];
|
wire [7:0] red = din[23:16];
|
||||||
@@ -61,6 +63,7 @@ typedef struct {
|
|||||||
logic hsync;
|
logic hsync;
|
||||||
logic vsync;
|
logic vsync;
|
||||||
logic csync;
|
logic csync;
|
||||||
|
logic de;
|
||||||
} phase_t;
|
} phase_t;
|
||||||
|
|
||||||
localparam MAX_PHASES = 7'd8;
|
localparam MAX_PHASES = 7'd8;
|
||||||
@@ -211,11 +214,11 @@ always_ff @(posedge clk) begin
|
|||||||
end
|
end
|
||||||
|
|
||||||
// Adjust sync timing correctly
|
// Adjust sync timing correctly
|
||||||
phase[1].hsync <= hsync; phase[1].vsync <= vsync; phase[1].csync <= csync;
|
phase[1].hsync <= hsync; phase[1].vsync <= vsync; phase[1].csync <= csync; phase[1].de <= de;
|
||||||
phase[2].hsync <= phase[1].hsync; phase[2].vsync <= phase[1].vsync; phase[2].csync <= phase[1].csync;
|
phase[2].hsync <= phase[1].hsync; phase[2].vsync <= phase[1].vsync; phase[2].csync <= phase[1].csync; phase[2].de <= phase[1].de;
|
||||||
phase[3].hsync <= phase[2].hsync; phase[3].vsync <= phase[2].vsync; phase[3].csync <= phase[2].csync;
|
phase[3].hsync <= phase[2].hsync; phase[3].vsync <= phase[2].vsync; phase[3].csync <= phase[2].csync; phase[3].de <= phase[2].de;
|
||||||
phase[4].hsync <= phase[3].hsync; phase[4].vsync <= phase[3].vsync; phase[4].csync <= phase[3].csync;
|
phase[4].hsync <= phase[3].hsync; phase[4].vsync <= phase[3].vsync; phase[4].csync <= phase[3].csync; phase[4].de <= phase[3].de;
|
||||||
hsync_o <= phase[4].hsync; vsync_o <= phase[4].vsync; csync_o <= phase[4].csync;
|
hsync_o <= phase[4].hsync; vsync_o <= phase[4].vsync; csync_o <= phase[4].csync; de_o <= phase[4].de;
|
||||||
|
|
||||||
phase[1].y <= phase[0].y; phase[2].y <= phase[1].y; phase[3].y <= phase[2].y; phase[4].y <= phase[3].y; phase[5].y <= phase[4].y;
|
phase[1].y <= phase[0].y; phase[2].y <= phase[1].y; phase[3].y <= phase[2].y; phase[4].y <= phase[3].y; phase[5].y <= phase[4].y;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user