Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library IEEE;
- use IEEE.STD_LOGIC_1164.ALL;
- entity licznik is
- Port ( clk : in STD_LOGIC;
- res : in STD_LOGIC;
- wyj : out STD_LOGIC_VECTOR (3 downto 0));
- end licznik;
- architecture Behavioral of licznik is
- signal liczenie: STD_LOGIC_VECTOR (3 downto 0) := "1100";
- begin
- process (clk,res)
- begin
- if res = '0' then
- liczenie <= "1100";
- elsif clk'event and clk = '1' then
- liczenie(0) <= (not(liczenie(0)) and not(liczenie(1))) or (liczenie(0) and liczenie(1)) or (liczenie(3) and liczenie(0)) or (liczenie(2) and liczenie(0));
- liczenie(1) <= (not(liczenie(1)) and not(liczenie(2)) and not(liczenie(3))) or (liczenie(3) and not(liczenie(0))) or (liczenie(2) and not(liczenie(0)));
- liczenie(2) <= (not(liczenie(2)) and not(liczenie(3))) or (liczenie(2) and liczenie(3) and liczenie(1)) or (liczenie(2) and liczenie(3) and liczenie(0));
- liczenie(3) <= not((liczenie(3)));
- end if;
- end process;
- wyj <= liczenie;
- end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement