diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-12-20 15:14:27 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-12-20 15:14:27 +0100 |
commit | d383e3742a4d38a3eb5899d9891cd06ba044dcac (patch) | |
tree | 7ee868b11c627039c61df9bf73351e42cf48508b /src | |
parent | 0e3f4260f505314361793e71a518d1485f45f882 (diff) |
bouncing ball working without glitches + added sysreset (commented) to vga.vhd
Diffstat (limited to 'src')
-rw-r--r-- | src/pixeldata-ball.vhd | 16 | ||||
-rw-r--r-- | src/vga.vhd | 10 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/pixeldata-ball.vhd b/src/pixeldata-ball.vhd index 5f17f2d..7d72cce 100644 --- a/src/pixeldata-ball.vhd +++ b/src/pixeldata-ball.vhd @@ -23,8 +23,8 @@ architecture Behavioral of pixeldata is douta: out std_logic_vector(11 downto 0)); end component; signal sx, sy: std_logic_vector(9 downto 0); -- square x and y - signal bitmap_idx: std_logic_vector(6 downto 0); - signal bitmap_out: std_logic_vector(11 downto 0); + signal bitmap_idx: std_logic_vector(6 downto 0); -- address -> rom chip + signal bitmap_out: std_logic_vector(11 downto 0); -- output data <- rom chip begin bounce_pos: component bounce port map ( @@ -40,9 +40,17 @@ begin process(pixel_clk) begin if rising_edge(pixel_clk) then - if (x >= sx) and (x < sx + 10) and (y >= sy) and (y < sy + 10) then + -- send bitmap address to rom chip early + if (x >= 639) and (sx = 0) and (y >= sy) and (y < (sy + 10)) then + -- exception for first display column + bitmap_idx <= std_logic_vector(resize(unsigned(y - sy + 1) * 10, bitmap_idx'length)); + elsif ((x + 1) >= sx) and ((x + 1) < (sx + 10)) and (y >= sy) and (y < (sy + 10)) then + -- regular early (horizontal shift) + bitmap_idx <= std_logic_vector(resize(unsigned(x + 1 - sx) + unsigned(y - sy) * 10, bitmap_idx'length)); + end if; + + if (x >= sx) and (x < (sx + 10)) and (y >= sy) and (y < (sy + 10)) then -- draw ball - bitmap_idx <= std_logic_vector(resize(unsigned(y - sy) + unsigned(y - sy) * 10, bitmap_idx'length)); rgb <= bitmap_out; else -- blue background diff --git a/src/vga.vhd b/src/vga.vhd index 9ba5797..fba1a29 100644 --- a/src/vga.vhd +++ b/src/vga.vhd @@ -26,9 +26,17 @@ architecture Behavioral of vga is constant front_porch_hor: natural := 16; -- horizontal front porch pulse width constant back_porch_hor: natural := 48; -- horizontal back porch pulse width begin - process (clk25) begin + -- if reset = '1' then + -- red <= x"0"; + -- green <= x"0"; + -- blue <= x"0"; + -- hsync <= '0'; + -- vsync <= '0'; + -- hcount <= (others => '0'); + -- vcount <= (others => '0'); + -- elsif rising_edge(clk25) then if rising_edge(clk25) then -- display area if (hcount >= (pulse_hor + back_porch_hor)) and |