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 | |
parent | 0e3f4260f505314361793e71a518d1485f45f882 (diff) |
bouncing ball working without glitches + added sysreset (commented) to vga.vhd
-rw-r--r-- | bouncing-ball/bouncing-ball.xpr | 8 | ||||
-rw-r--r-- | src/pixeldata-ball.vhd | 16 | ||||
-rw-r--r-- | src/vga.vhd | 10 |
3 files changed, 23 insertions, 11 deletions
diff --git a/bouncing-ball/bouncing-ball.xpr b/bouncing-ball/bouncing-ball.xpr index f7808cb..be2d6c1 100644 --- a/bouncing-ball/bouncing-ball.xpr +++ b/bouncing-ball/bouncing-ball.xpr @@ -217,9 +217,7 @@ </Run> <Run Id="ball_rom_synth_1" Type="Ft3:Synth" SrcSet="ball_rom" Part="xc7a35tcpg236-1" ConstrsSet="ball_rom" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="false" WriteIncrSynthDcp="false" Dir="$PRUNDIR/ball_rom_synth_1" IncludeInArchive="true" IsChild="false" AutoIncrementalDir="$PSRCDIR/utils_1/imports/ball_rom_synth_1" AutoRQSDir="$PSRCDIR/utils_1/imports/ball_rom_synth_1"> <Strategy Version="1" Minor="2"> - <StratHandle Name="Vivado Synthesis Defaults" Flow="Vivado Synthesis 2022"> - <Desc>Vivado Synthesis Defaults</Desc> - </StratHandle> + <StratHandle Name="Vivado Synthesis Defaults" Flow="Vivado Synthesis 2022"/> <Step Id="synth_design"/> </Strategy> <GeneratedRun Dir="$PRUNDIR" File="gen_run.xml"/> @@ -247,9 +245,7 @@ </Run> <Run Id="ball_rom_impl_1" Type="Ft2:EntireDesign" Part="xc7a35tcpg236-1" ConstrsSet="ball_rom" Description="Default settings for Implementation." AutoIncrementalCheckpoint="false" WriteIncrSynthDcp="false" SynthRun="ball_rom_synth_1" IncludeInArchive="false" IsChild="false" GenFullBitstream="true" AutoIncrementalDir="$PSRCDIR/utils_1/imports/ball_rom_impl_1" AutoRQSDir="$PSRCDIR/utils_1/imports/ball_rom_impl_1"> <Strategy Version="1" Minor="2"> - <StratHandle Name="Vivado Implementation Defaults" Flow="Vivado Implementation 2022"> - <Desc>Default settings for Implementation.</Desc> - </StratHandle> + <StratHandle Name="Vivado Implementation Defaults" Flow="Vivado Implementation 2022"/> <Step Id="init_design"/> <Step Id="opt_design"/> <Step Id="power_opt_design"/> 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 |