-- KK03-30B Windshield Wiper 2			E235 11 1103

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--|||||||||||||||||||||||||||||||||||||||||
entity Wiper is 
	port 
	(
	cw_sw: 	in		std_logic;	--Clockwise switch
	ccw_sw: 	in 	std_logic;	--Counterclockwise switch
	run_sw:	in		std_logic;	--Run switch
	
	cw_out: 	out 	std_logic;	--CW signal to motor driver
	ccw_out: out 	std_logic;	--CCW signal to motor driver
	run_out:	out	std_logic	--Enable signal to motor driver
	); 
end Wiper;

--|||||||||||||||||||||||||||||||||||||||||
architecture behavioral of Wiper is 

signal cwo 	:	std_logic := '1';
signal ccwo	:	std_logic := '0';

--=========================================
begin
	process (cw_sw, ccw_sw, run_sw) is
	begin
		if (run_sw = . . . ) then
			run_out <= . . . ;
			if (cw_sw =. . .  then
				. . .
				. . .
			end if;
			
			if (ccw_sw = . . .) then
				. . .
				. . .
			end if;
			
			cw_out <= cwo;
			ccw_out <= ccwo;
		else
			--If neither cw_sw nor ccw_sw is on when the run 
			--switch is turned off, keep the motor running
			--until one of these switches is on.
			if (cw_sw = . . . or ccw_sw = . . . ) then
				run_out <= . . . ;
			end if;
		end if;	
	end process;
end architecture behavioral;