diff options
| author | lonkaars <loek@pipeframe.xyz> | 2022-12-16 10:37:29 +0100 |
|---|---|---|
| committer | lonkaars <loek@pipeframe.xyz> | 2022-12-16 10:37:29 +0100 |
| commit | ec35bd35ead0eaa66c455adfd1f2ab8f13311d99 (patch) | |
| tree | bfe8fecc2a19af7160b88700184df1b5177aae42 /src/pixeldata.vhd | |
| parent | fc35615597a12671489d237685eaa10f47b61951 (diff) | |
WIP bouncing square
Diffstat (limited to 'src/pixeldata.vhd')
| -rw-r--r-- | src/pixeldata.vhd | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/pixeldata.vhd b/src/pixeldata.vhd new file mode 100644 index 0000000..c03fab8 --- /dev/null +++ b/src/pixeldata.vhd @@ -0,0 +1,40 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.std_logic_arith.all; +use ieee.std_logic_unsigned.all; + +entity pixeldata is + port ( + pixel_clk, bounce_clk, reset: in std_logic; + x, y: in std_logic_vector(9 downto 0); + red, green, blue: out std_logic); +end pixeldata; + +architecture Behavioral of pixeldata is + component bounce + port ( + clk, reset: in std_logic; + x, y: out std_logic_vector(9 downto 0)); + end component; + signal sx, sy: std_logic_vector(9 downto 0); +begin + bounce_pos: component bounce + port map ( + reset => reset, + clk => bounce_clk, + x => sx, + y => sy); + process(pixel_clk, sx, sy) + begin + if (x >= sx) and (x < sx + 10) and (y >= sy) and (y < sy + 10) then + red <= '1'; + green <= '1'; + blue <= '1'; + else + red <= '0'; + green <= '0'; + blue <= '1'; + end if; + end process; +end Behavioral; + |