--========================================================== -- Design units : StopWatchBehave (Entity,Architecture) -- -- File name : StopWatchBehave.vhd -- -- Purpose : Behavioral description of a StopWatch -- -- Limitations : none -- -- Library : IEEE -- -- Dependencies : StopPackage,Pulse Generator,StopWatchBehave,StopWatchStruc -- -- Author : Claus-Juergen Thomas, REFT -- -- Simulator : Synopsys V3.1a on SUN SPARCstation 10 -- ----------------------------------------------------------- -- Revision list -- Version Author Date Changes -- -- v 1.0 cjt 18.01.96 new --========================================================= LIBRARY IEEE; USE IEEE.std_logic_1164.all; USE work.ELEMpack.all; ENTITY StopWatchBehave IS PORT(StartStop : IN std_logic; Reset : IN std_logic; Clk : IN std_logic; Tenths_out : OUT integer; Seconds_out: OUT integer; Tens_out : OUT integer); END StopWatchBehave; --============================ARCHITECTURE================== ARCHITECTURE Behavior OF StopWatchBehave IS SIGNAL tenths,seconds,tens,counter:integer:=0; BEGIN main: PROCESS (Clk,Reset) BEGIN IF StartStop = '1' THEN IF StartStop'EVENT THEN Tenths <= 0; END IF; IF Clk'EVENT AND Clk = '1' THEN Tenths <= tenths + 1; IF Tenths = 9 THEN Seconds <= Seconds + 1; Tenths <= 0; IF Seconds = 9 THEN Tens <= Tens + 1; Seconds <= 0; IF Tens = 5 THEN Tens <= 0; END IF; END IF; END IF; END IF; END IF; IF Reset = '0' THEN Tenths <= 0; Seconds <= 0; Tens <= 0; END IF; END PROCESS; Tenths_out <= Tenths; Seconds_out <= Seconds; Tens_out <= Tens; END Behavior;