diff --git a/lib/VGA_ctrl/src/vga_frontend.vhd b/lib/VGA_ctrl/src/vga_frontend.vhd index a8a6d15..78eae44 100644 --- a/lib/VGA_ctrl/src/vga_frontend.vhd +++ b/lib/VGA_ctrl/src/vga_frontend.vhd @@ -321,26 +321,19 @@ read_counter: pixel_counter: process(CLK_I) - variable pixel_cntx : natural range 0 to tsvga.ts_h.ncyc_scan-1; - variable pixel_cnty : natural range 0 to tsvga.ts_h.ncyc_scan*(tsvga.ts_v.ncyc_scan-1); + variable pixel_cnt : natural range 0 to MAX_REQUEST_CNT-1; begin if rising_edge(CLK_I) then if pixel_cnt_rst = '1' then - pixel_cntx := 0; - pixel_cnty := tsvga.ts_h.ncyc_scan*(tsvga.ts_v.ncyc_scan-1); + pixel_cnt := 0; elsif request_cnt_en = '1' and SRDY_I = '1' then - if pixel_cntx /= tsvga.ts_h.ncyc_scan-1 then - pixel_cntx := pixel_cntx + 1; + if pixel_cnt /= MAX_REQUEST_CNT-1 then + pixel_cnt := pixel_cnt + 1; else - pixel_cntx := 0; - if pixel_cnty /= 0 then - pixel_cnty := pixel_cnty - tsvga.ts_h.ncyc_scan; - else - pixel_cnty := tsvga.ts_h.ncyc_scan*(tsvga.ts_v.ncyc_scan-1); - end if; - end if; - end if; - ADDR_O <= vga_mem_offset + (to_unsigned(pixel_cntx, 30) & "00") + (to_unsigned(pixel_cnty, 30) & "00"); + pixel_cnt := 0; + end if; + end if; + ADDR_O <= vga_mem_offset + (to_unsigned(pixel_cnt, 30) & "00"); end if; end process; diff --git a/lib/VGA_ctrl/src/vga_frontend64.vhd b/lib/VGA_ctrl/src/vga_frontend64.vhd index dfbeeb8..1e2b564 100644 --- a/lib/VGA_ctrl/src/vga_frontend64.vhd +++ b/lib/VGA_ctrl/src/vga_frontend64.vhd @@ -325,26 +325,19 @@ read_counter: pixel_counter: process(CLK_I) - variable pixel_cntx : natural range 0 to tsvga.ts_h.ncyc_scan/2-1; - variable pixel_cnty : natural range 0 to tsvga.ts_h.ncyc_scan*(tsvga.ts_v.ncyc_scan-1); + variable pixel_cnt : natural range 0 to MAX_REQUEST_CNT/2-1; begin if rising_edge(CLK_I) then if pixel_cnt_rst = '1' then - pixel_cntx := 0; - pixel_cnty := tsvga.ts_h.ncyc_scan*(tsvga.ts_v.ncyc_scan-1); + pixel_cnt := 0; elsif request_cnt_en = '1' and SRDY_I = '1' then - if pixel_cntx /= tsvga.ts_h.ncyc_scan/2-1 then - pixel_cntx := pixel_cntx + 1; + if pixel_cnt /= MAX_REQUEST_CNT/2-1 then + pixel_cnt := pixel_cnt + 1; else - pixel_cntx := 0; - if pixel_cnty /= 0 then - pixel_cnty := pixel_cnty - tsvga.ts_h.ncyc_scan; - else - pixel_cnty := tsvga.ts_h.ncyc_scan*(tsvga.ts_v.ncyc_scan-1); - end if; - end if; - end if; - ADDR_O <= vga_mem_offset + (to_unsigned(pixel_cntx, 29) & "000") + (to_unsigned(pixel_cnty, 30) & "00"); + pixel_cnt := 0; + end if; + end if; + ADDR_O <= vga_mem_offset + (to_unsigned(pixel_cnt, 29) & "000"); end if; end process;