B
(beta-) Frank Nitzsche
Guest
Hello @all,
this code here I copied is a part from my projekt and this part is for a
display like CGA. All ports or signals are only in this part used. The
problem:
p_clk_o, pdta_o, hsync_o : work fine.
vsync_o : give me lots of additional random pulses. This additional pulses
have a same duration like the hsync-period.
I tried it with lower XTAL, but exactly the same is doing.
The code:
.....
Port (
clk_i: in std_logic; --XTAL 40 MHz
rst_n_i: in std_logic; --/Reset von extern
p_clk_o: out std_logic; --Pixelclock = clk_i / 2 = 20 Mhz
hsync_o: out std_logic;
vsync_o: out std_logic;
pdta_o: out std_logic); --Pixeldata, in this posting not shown, but
work fine
end md_vram;
architecture md_vram_arch of md_vram is
constant SPALTEN: integer :=799; --800 (0..799) phys. Spalten (horizontal)
constant ZEILEN: integer :=495; --496 (0..495) phys. Zeilenanzahl.
(vertical)
constant HSYNCPOS: integer :=680; --Position Hsyncpuls
constant HSYNCDELAY: integer :=112; --Duration Hsyncpuls (counts of
p_clk-pulses)
constant VSYNCPOS: integer :=428; --Position Vsyncpuls
constant VSYNCDELAY: integer :=14; --Duration Vsyncpuls (counts of
Hsync-pulses)
signal h_cnt_s: std_logic_vector(9 downto 0);--pro Zeile 640 aus 800 pixel
sichtbar
signal v_cnt_s: std_logic_vector(8 downto 0);--pro Screen 400 aus 496
Zeilen sichtbar
signal p_clk_s: std_logic; --Pixeltakt
signal hsync_s: std_logic;
signal vsync_s: std_logic;
----------------------------------------------------------------------------
---------------
begin
--
Videogenerator--------------------------------------------------------------
------------
-- Pixeltakt p_clk_io= clk_i / 2
Pixeltakt:
process(rst_n_i, clk_i)
begin
if rst_n_i='0' then
p_clk_s<='0';
elsif falling_edge(clk_i) then
p_clk_s <= not p_clk_s;
end if;
end process Pixeltakt;
p_clk_o <= p_clk_s;
-- Spalten zaehlen und Generierung der zykl.
Hsync-Pulse ----------------------------------
Hsync:
process(rst_n_i, p_clk_s)
begin
if rst_n_i='0' then
h_cnt_s <= (others => '0');
elsif falling_edge(p_clk_s) then
if h_cnt_s = SPALTEN then
h_cnt_s <= (others => '0');
else
h_cnt_s <= h_cnt_s + 1;
end if;
end if;
end process hsync;
hsync_s <= '0' when (h_cnt_s > HSYNCPOS and h_cnt_s < (HSYNCPOS +
HSYNCDELAY)) else '1';
hsync_o <= hsync_s;
-- Zeilen zaehlen und Generierung der zykl.
Vsync-Pulse -----------------------------------
Vsync:
process(rst_n_i, hsync_s)
begin
if rst_n_i='0' then
v_cnt_s <= (others => '0');
elsif rising_edge(hsync_s) then
if v_cnt_s = ZEILEN then
v_cnt_s <= (others => '0');
else
v_cnt_s <= v_cnt_s + 1;
end if;
end if;
end process vsync;
vsync_s <= '0' when (v_cnt_s > VSYNCPOS and v_cnt_s < (VSYNCPOS +
VSYNCDELAY)) else '1';
vsync_o <= vsync_s;
....
Has anybody an idea?? Target is a Spartan (because 5V needed)
Thank - Frank
this code here I copied is a part from my projekt and this part is for a
display like CGA. All ports or signals are only in this part used. The
problem:
p_clk_o, pdta_o, hsync_o : work fine.
vsync_o : give me lots of additional random pulses. This additional pulses
have a same duration like the hsync-period.
I tried it with lower XTAL, but exactly the same is doing.
The code:
.....
Port (
clk_i: in std_logic; --XTAL 40 MHz
rst_n_i: in std_logic; --/Reset von extern
p_clk_o: out std_logic; --Pixelclock = clk_i / 2 = 20 Mhz
hsync_o: out std_logic;
vsync_o: out std_logic;
pdta_o: out std_logic); --Pixeldata, in this posting not shown, but
work fine
end md_vram;
architecture md_vram_arch of md_vram is
constant SPALTEN: integer :=799; --800 (0..799) phys. Spalten (horizontal)
constant ZEILEN: integer :=495; --496 (0..495) phys. Zeilenanzahl.
(vertical)
constant HSYNCPOS: integer :=680; --Position Hsyncpuls
constant HSYNCDELAY: integer :=112; --Duration Hsyncpuls (counts of
p_clk-pulses)
constant VSYNCPOS: integer :=428; --Position Vsyncpuls
constant VSYNCDELAY: integer :=14; --Duration Vsyncpuls (counts of
Hsync-pulses)
signal h_cnt_s: std_logic_vector(9 downto 0);--pro Zeile 640 aus 800 pixel
sichtbar
signal v_cnt_s: std_logic_vector(8 downto 0);--pro Screen 400 aus 496
Zeilen sichtbar
signal p_clk_s: std_logic; --Pixeltakt
signal hsync_s: std_logic;
signal vsync_s: std_logic;
----------------------------------------------------------------------------
---------------
begin
--
Videogenerator--------------------------------------------------------------
------------
-- Pixeltakt p_clk_io= clk_i / 2
Pixeltakt:
process(rst_n_i, clk_i)
begin
if rst_n_i='0' then
p_clk_s<='0';
elsif falling_edge(clk_i) then
p_clk_s <= not p_clk_s;
end if;
end process Pixeltakt;
p_clk_o <= p_clk_s;
-- Spalten zaehlen und Generierung der zykl.
Hsync-Pulse ----------------------------------
Hsync:
process(rst_n_i, p_clk_s)
begin
if rst_n_i='0' then
h_cnt_s <= (others => '0');
elsif falling_edge(p_clk_s) then
if h_cnt_s = SPALTEN then
h_cnt_s <= (others => '0');
else
h_cnt_s <= h_cnt_s + 1;
end if;
end if;
end process hsync;
hsync_s <= '0' when (h_cnt_s > HSYNCPOS and h_cnt_s < (HSYNCPOS +
HSYNCDELAY)) else '1';
hsync_o <= hsync_s;
-- Zeilen zaehlen und Generierung der zykl.
Vsync-Pulse -----------------------------------
Vsync:
process(rst_n_i, hsync_s)
begin
if rst_n_i='0' then
v_cnt_s <= (others => '0');
elsif rising_edge(hsync_s) then
if v_cnt_s = ZEILEN then
v_cnt_s <= (others => '0');
else
v_cnt_s <= v_cnt_s + 1;
end if;
end if;
end process vsync;
vsync_s <= '0' when (v_cnt_s > VSYNCPOS and v_cnt_s < (VSYNCPOS +
VSYNCDELAY)) else '1';
vsync_o <= vsync_s;
....
Has anybody an idea?? Target is a Spartan (because 5V needed)
Thank - Frank