- added double buffer

- added INT_O on buffer change
Committed on the Free edition of March Hare Software CVSNT Server.
Upgrade to CVS Suite for more features and support:
http://march-hare.com/cvsnt/


git-svn-id: http://moon:8086/svn/vhdl/trunk@641 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
2009-11-08 20:23:11 +00:00
parent c465b190a0
commit fcfe1d1d79
2 changed files with 62 additions and 19 deletions
+2
View File
@@ -40,6 +40,7 @@ ARCHITECTURE behavior OF tb_vga_frontend64 IS
signal RST_O : std_logic := '1';
-- Master
signal INT_O : std_logic;
signal CYC_O : std_logic;
signal STB_O : std_logic;
signal WE_O : std_logic;
@@ -103,6 +104,7 @@ inst_vga_frontend64 : entity work.vga_frontend64
MDAT_O => MDAT_I,
-- JBUS Slave signals
INT_O => INT_O,
CYC_I => CYC_O,
STB_I => STB_O,
WE_I => WE_O,
+60 -19
View File
@@ -51,6 +51,7 @@ entity vga_frontend64 is
MDAT_O : out unsigned(63 downto 0);
-- JBUS Slave signals
INT_O : out STD_LOGIC;
CYC_I : in STD_LOGIC;
STB_I : in STD_LOGIC;
WE_I : in STD_LOGIC;
@@ -123,8 +124,14 @@ architecture Behavioral of vga_frontend64 is
-- Bus master signals
constant MAX_REQUEST_CNT : natural := tsvga.ts_h.ncyc_scan*tsvga.ts_v.ncyc_scan;
signal mem_offset : unsigned(31 downto 0);
signal vga_mem_offset : unsigned(31 downto 0);
signal buf_chg : std_logic;
signal buf_chg_irq_en : std_logic;
signal buf_chg_irq : std_logic;
signal buf_chg_irq_ack : std_logic;
signal vga_mem_off_last : unsigned(31 downto 0);
signal vga_mem_off_curr : unsigned(31 downto 0);
signal vga_mem_off_0 : unsigned(31 downto 0);
signal vga_mem_off_1 : unsigned(31 downto 0);
signal vga_scan_rdy : std_logic;
signal vga_master_en : std_logic;
signal request_cnt_rst : std_logic;
@@ -141,6 +148,20 @@ architecture Behavioral of vga_frontend64 is
begin
INT_O <= buf_chg_irq;
proc_buf_chg_irq:
process(CLK_I)
begin
if rising_edge(CLK_I) then
if RST_I = '1' or buf_chg_irq_ack = '1' then
buf_chg_irq <= '0';
elsif buf_chg = '1' then
buf_chg_irq <= buf_chg_irq_en and vga_master_en;
end if;
end if;
end process;
inst_vga_backend : entity work.vga_backend
GENERIC MAP
(
@@ -327,20 +348,28 @@ read_counter:
pixel_counter:
process(CLK_I)
variable pixel_cnt : natural range 0 to MAX_REQUEST_CNT/2-1;
variable curr : unsigned(31 downto 0);
variable last : unsigned(31 downto 0);
begin
if rising_edge(CLK_I) then
buf_chg <= '0';
if pixel_cnt_rst = '1' then
pixel_cnt := 0;
mem_offset <= vga_mem_offset;
curr := vga_mem_off_0;
last := vga_mem_off_1;
elsif request_cnt_en = '1' and SRDY_I = '1' then
if pixel_cnt /= MAX_REQUEST_CNT/2-1 then
pixel_cnt := pixel_cnt + 1;
else
pixel_cnt := 0;
mem_offset <= vga_mem_offset;
curr := vga_mem_off_last;
last := vga_mem_off_curr;
buf_chg <= '1';
end if;
end if;
ADDR_O <= mem_offset + (to_unsigned(pixel_cnt, 29) & "000");
vga_mem_off_curr <= curr;
vga_mem_off_last <= last;
ADDR_O <= curr + (to_unsigned(pixel_cnt, 29) & "000");
end if;
end process;
@@ -381,7 +410,6 @@ inst_char_gen : entity work.char_gen
char_draw_en => cg_draw
);
SRDY_O <= CYC_I; -- and cg_rdy;
-- SDAT_O <= X"0000000" & "000" & cg_rdy;
MDAT_O <= (others => '-');
scan_rdy <= stat_hready and stat_vready;
cg_en <= stat_scan;
@@ -401,6 +429,7 @@ registers_read:
when "0000" =>
SDAT_O(0) <= cg_rdy;
SDAT_O(1) <= vga_master_en;
SDAT_O(2) <= buf_chg_irq;
-- sys_vga_ascii 4
when "0001" =>
@@ -418,22 +447,26 @@ registers_read:
when "0100" =>
SDAT_O <= to_unsigned(cg_color);
-- sys_vga_moffs 20
-- sys_vga_resx 20
when "0101" =>
SDAT_O <= vga_mem_offset;
-- sys_vga_resx 24
when "0110" =>
SDAT_O(15 downto 0) <= to_unsigned(tsvga.ts_h.ncyc_scan, 16);
-- sys_vga_resy 28
when "0111" =>
-- sys_vga_resy 24
when "0110" =>
SDAT_O(15 downto 0) <= to_unsigned(tsvga.ts_v.ncyc_scan, 16);
-- sys_vga_fps 32
when "1000" =>
-- sys_vga_fps 28
when "0111" =>
SDAT_O(15 downto 0) <= to_unsigned(tsvga.nfps, 16);
-- sys_vga_moffs_curr 32
when "1000" =>
SDAT_O <= vga_mem_off_curr;
-- sys_vga_moffs_last 36
when "1001" =>
SDAT_O <= vga_mem_off_last;
when others => null;
end case;
end if;
@@ -450,10 +483,13 @@ registers_write:
cg_posx_we <= '0';
cg_clr_screen <= '0';
cg_clr_line <= '0';
buf_chg_irq_ack <= '0';
if RST_I = '1' then
cg_din <= (others => '0');
vga_master_en <= '0';
vga_mem_offset <= X"40000000";
buf_chg_irq_en <= '0';
vga_mem_off_0 <= X"40000000";
vga_mem_off_1 <= X"40004000";
cg_color <= (X"FF", X"FF", X"FF", X"FF");
elsif (STB_I and CYC_I and WE_I) = '1' then
case ADDR_I(5 downto 2) is
@@ -461,6 +497,7 @@ registers_write:
-- sys_vga_ctrl 0
when "0000" =>
vga_master_en <= SDAT_I(1);
buf_chg_irq_ack <= SDAT_I(2);
cg_clr_screen <= SDAT_I(4);
cg_clr_line <= SDAT_I(5);
@@ -483,9 +520,13 @@ registers_write:
when "0100" =>
cg_color <= to_color_t(SDAT_I(31 downto 0));
-- sys_vga_moffs 20
when "0101" =>
vga_mem_offset <= SDAT_I(31 downto 2) & "00";
-- sys_vga_moffs0 32
when "1000" =>
vga_mem_off_0 <= SDAT_I(31 downto 2) & "00";
-- sys_vga_moffs1 36
when "1001" =>
vga_mem_off_1 <= SDAT_I(31 downto 2) & "00";
when others => null;
end case;