-- -- VHDL Skeleton Generated from Production Based Synthesis Package (PBS) -- -- Copyright (c) 1991,1992 University of California, Santa Barbara. -- All rights reserved. -- library work; use work.mouse2_pak.all; entity mouse2 is port ( -- *********** port insert begin clock, xc, xd, reset : in BIT; xp : out INTEGER range 0 to 255; it : out INTEGER range 0 to 255 -- *********** port insert end ); end; architecture BEHAVIOR of mouse2 is signal PBS_CURRENT_STATE : INTEGER range 0 to 15; -- *********** architecture_decl insert begin signal x, idle_time : INTEGER range 0 to 255; -- *********** architecture_decl insert end begin -- *********** architecture insert begin xp <= x; it <= idle_time; -- *********** architecture insert end PBS_MACHINE : process variable PBS_TOKEN : INTEGER range 0 to 3; begin -- *********** process_front insert begin wait until clock'event and clock = '1'; PBS_TOKEN := 0; if (reset = '0') then if (xc = '1' and xd = '0') then PBS_TOKEN := A; elsif (xc = '1' and xd = '1') then PBS_TOKEN := B; elsif (xc = '0' and xd = '1') then PBS_TOKEN := C; elsif (xc = '0' and xd = '0') then PBS_TOKEN := D; end if; -- *********** process_front insert end case PBS_CURRENT_STATE is when S1 | S4 => if (PBS_TOKEN = C) then idle_time <= idle_time + 1; -- (from PBS, line 42) end if; when S2 | S7 => if (PBS_TOKEN = B) then idle_time <= idle_time + 1; -- (from PBS, line 42) end if; when S3 => if (PBS_TOKEN = B) then idle_time <= idle_time + 1; -- (from PBS, line 42) elsif (PBS_TOKEN = A) then x <= x - 1; idle_time <= 0; -- (from PBS, line 44) end if; when S5 => if (PBS_TOKEN = D) then x <= x + 1; idle_time <= 0; -- (from PBS, line 43) elsif (PBS_TOKEN = C) then idle_time <= idle_time + 1; -- (from PBS, line 42) end if; when S6 => if (PBS_TOKEN = D) then idle_time <= idle_time + 1; -- (from PBS, line 42) end if; when S8 => if (PBS_TOKEN = A) then idle_time <= idle_time + 1; -- (from PBS, line 42) end if; when others => null; end case; PBS_CURRENT_STATE <= PBS_TRANSITION(PBS_STATE_ASSIGN(PBS_CURRENT_STATE))(PBS_TOKEN); -- *********** process_end insert begin else PBS_CURRENT_STATE <= S0; idle_time <= 0; x <= 0; end if; -- *********** process_end insert end end process; end BEHAVIOR;