Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library IEEE;
- use IEEE.STD_LOGIC_1164.ALL;
- entity motorstart is
- port (clock, a, b: in std_logic;
- reset : in std_logic;
- u0, ut : out std_logic);
- end motorstart;
- architecture beh of motorstart is
- signal pre_state : std_logic_vector(2 downto 0) := "000";
- signal next_state: std_logic_vector(2 downto 0);
- begin
- process(pre_state)
- begin
- case pre_state is
- when "000" => next_state <= "001";
- when "001" => next_state <= "010";
- when "010" => next_state <= "011";
- when "011" => next_state <= "100";
- when others => next_state <= "000";
- end case;
- end process;
- process(a, b, pre_state, reset)
- begin
- if pre_state = "000" and a = '1' and b = '0' then
- pre_state <= next_state;
- elsif pre_state /= "000" and pre_state /= "100" and b = '1' and a = '0' then
- pre_state <= next_state;
- elsif a = '0' and b = '0' then
- -- om både a och b är 0 har ingen knapptryking skett.
- else
- pre_state <= "100";
- u0 <= '1';
- end if;
- if reset = '1' then
- pre_state <= "000";
- ut <= '0';
- u0 <= '0';
- end if;
- if pre_state = "011" then
- ut <= '1';
- end if;
- end process;
- --process(pre_state)
- --begin
- --if pre_state = "011" then
- -- ut <= '1';
- --end if;
- --end process;
- end beh;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement