-- VHDL code position: p261_ex8_42_experiment8_3_mway -- Note : This is code file of tennis play -- See Also: example 8_35(top module), 8_36, 8_37, 8_38, 8_39, 8_40, 8_41, 8_42 -- Debug : no debug --------------------------------------------------------------------------------- -- 乒乓球前进方向产生模块 library ieee; use ieee.std_logic_1164.all; entity mway is port ( servea :in std_logic; -- 左选手发球信号 serveb :in std_logic; -- 右选手发球信号 way :out std_logic -- 乒乓球灯前进方向信号 ); end mway; architecture ful of mway is begin process( servea, serveb ) begin if( servea = '1' ) then -- 左选手发球 way <= '1'; -- 方向向右 elsif ( serveb = '1' ) then -- 右选手发球 way <= '0'; -- 方向向左 end if; end process; end architecture ful;