library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity tb_p_ctrl is
-- empty
end tb_p_ctrl;
architecture beh of tb_p_ctrl is
component p_ctrl is
port (rst : in std_logic;
clk : in std_logic;
sp : in signed(7 downto 0);
pos : in signed(7 downto 0);
motor_cw : out std_logic;
motor_ccw : out std_logic);
end component p_ctrl;
signal rst : std_logic;
signal clk : std_logic := '0';
signal sp : signed(7 downto 0);
signal pos : signed(7 downto 0);
signal motor_cw : std_logic;
signal motor_ccw : std_logic;
begin
UUT : entity work.p_ctrl(rtl)
port map (rst => rst,
clk => clk,
sp => sp,
pos => pos,
motor_cw => motor_cw,
motor_ccw => motor_ccw);
-- stimuli
clk <= not clk after 10 ns;
rst <= '1', '0' after 40 ns;
sp <= to_signed(100, 8);
pos <= to_signed(50, 8), to_signed(80, 8) after 150 ns,
to_signed(115, 8) after 300 ns;
end beh;