Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library IEEE;
- use IEEE.STD_LOGIC_1164.ALL;
- entity Dzielnik_kod is
- Port ( CLK : in STD_LOGIC;
- RST : in STD_LOGIC;
- LED : out STD_LOGIC);
- end Dzielnik_kod;
- architecture Behavioral of Dzielnik_kod is
- constant N : integer := 3;
- signal licznik : INTEGER range 0 to (N-1);
- signal wyjscie : STD_LOGIC;
- begin
- dzielnik: process (CLK, RST) is
- begin
- if RST = '1' then
- licznik <= 0;
- wyjscie <= '0';
- elsif rising_edge(CLK) then
- licznik <= licznik + 1;
- if (N = 2) then -- my
- wyjscie <= not(wyjscie); -- zrobiliśmy
- licznik <= 0; -- to xD
- else
- if (licznik = (N/2)) then
- wyjscie <= '1';
- elsif (licznik = (N - 1)) then
- wyjscie <= '0';
- licznik <= 0;
- end if;
- end if;
- end if;
- end process dzielnik;
- LED <= wyjscie;
- end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement