aboutsummaryrefslogtreecommitdiff
path: root/basys3/basys3.srcs/ppu_sprite_transform_tb.vhd
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-02-24 13:20:02 +0100
committerlonkaars <loek@pipeframe.xyz>2023-02-24 13:20:02 +0100
commitf3a47bde9bfaaa716de835c0c1499a685b4ac4f7 (patch)
tree90abe28726ea7484184179129256022472eb2e24 /basys3/basys3.srcs/ppu_sprite_transform_tb.vhd
parent7da7908989686daa2ac9fd2f3f79cad2f03c0828 (diff)
parent14a1c464c27206bff847fd46d3d5594b30f53af9 (diff)
Merge branch 'dev' into ppu-interface
Diffstat (limited to 'basys3/basys3.srcs/ppu_sprite_transform_tb.vhd')
-rw-r--r--basys3/basys3.srcs/ppu_sprite_transform_tb.vhd66
1 files changed, 66 insertions, 0 deletions
diff --git a/basys3/basys3.srcs/ppu_sprite_transform_tb.vhd b/basys3/basys3.srcs/ppu_sprite_transform_tb.vhd
new file mode 100644
index 0000000..516a653
--- /dev/null
+++ b/basys3/basys3.srcs/ppu_sprite_transform_tb.vhd
@@ -0,0 +1,66 @@
+library ieee;
+library unisim;
+library work;
+
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+use unisim.vcomponents.all;
+use work.ppu_consts.all;
+
+entity ppu_sprite_transform_tb is
+end ppu_sprite_transform_tb;
+
+architecture behavioral of ppu_sprite_transform_tb is
+ component ppu_sprite_transform port( -- flip sprites
+ XI : in unsigned(PPU_SPRITE_POS_H_WIDTH-1 downto 0); -- pixel position relative to tile
+ YI : in unsigned(PPU_SPRITE_POS_V_WIDTH-1 downto 0); -- pixel position relative to tile
+ FLIP_H, FLIP_V : in std_logic; -- flip sprite
+ XO : out unsigned(PPU_SPRITE_POS_H_WIDTH-1 downto 0); -- new pixel position relative to tile
+ YO : out unsigned(PPU_SPRITE_POS_V_WIDTH-1 downto 0)); -- new pixel position relative to tile
+ end component;
+
+ signal XI : unsigned(PPU_SPRITE_POS_H_WIDTH-1 downto 0);
+ signal YI : unsigned(PPU_SPRITE_POS_V_WIDTH-1 downto 0);
+ signal FLIP_H, FLIP_V : std_logic := '0';
+ signal XO : unsigned(PPU_SPRITE_POS_H_WIDTH-1 downto 0);
+ signal YO : unsigned(PPU_SPRITE_POS_V_WIDTH-1 downto 0);
+begin
+ uut : component ppu_sprite_transform
+ port map(
+ XI => XI,
+ YI => YI,
+ FLIP_H => FLIP_H,
+ FLIP_V => FLIP_V,
+ XO => XO,
+ YO => YO);
+
+ tb : process
+ begin
+ XI <= to_unsigned(4, PPU_SPRITE_POS_H_WIDTH);
+ YI <= to_unsigned(6, PPU_SPRITE_POS_V_WIDTH);
+ wait for 5 ns;
+
+ XI <= to_unsigned(2, PPU_SPRITE_POS_H_WIDTH);
+ YI <= to_unsigned(14, PPU_SPRITE_POS_V_WIDTH);
+ wait for 5 ns;
+
+ FLIP_H <= '1';
+ wait for 5 ns;
+
+ FLIP_V <= '1';
+ wait for 5 ns;
+
+ XI <= to_unsigned(6, PPU_SPRITE_POS_H_WIDTH);
+ YI <= to_unsigned(8, PPU_SPRITE_POS_V_WIDTH);
+ wait for 5 ns;
+
+ FLIP_H <= '0';
+ wait for 5 ns;
+
+ XI <= to_unsigned(2, PPU_SPRITE_POS_H_WIDTH);
+ YI <= to_unsigned(14, PPU_SPRITE_POS_V_WIDTH);
+ wait for 5 ns;
+
+ wait; -- stop for simulator
+ end process;
+end;