Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------------------------------------
- -- Company:
- -- Engineer: Nenad Misic
- --
- -- Create Date: 21:59:15 12/04/2018
- -- Design Name:
- -- Module Name: zadatak3 - Behavioral
- -- Project Name:
- -- Target Devices:
- -- Tool versions:
- -- Description:
- --
- -- Dependencies:
- --
- -- Revision:
- -- Revision 0.01 - File Created
- -- Additional Comments:
- --
- ----------------------------------------------------------------------------------
- library IEEE;
- use IEEE.STD_LOGIC_1164.ALL;
- use IEEE.STD_LOGIC_UNSIGNED.ALL;
- -- Uncomment the following library declaration if using
- -- arithmetic functions with Signed or Unsigned values
- --use IEEE.NUMERIC_STD.ALL;
- -- Uncomment the following library declaration if instantiating
- -- any Xilinx primitives in this code.
- --library UNISIM;
- --use UNISIM.VComponents.all;
- entity zadatak3 is
- Port ( iCLK : in STD_LOGIC;
- inRST : in STD_LOGIC;
- inGO : in STD_LOGIC;
- inSTOP : in STD_LOGIC;
- oSEC : out STD_LOGIC_VECTOR (7 downto 0));
- end zadatak3;
- architecture Behavioral of zadatak3 is
- signal sCNT : STD_LOGIC_VECTOR(24 downto 0);
- signal sTC : STD_LOGIC;
- signal sRES : STD_LOGIC_VECTOR(7 downto 0);
- signal sONOFF : STD_LOGIC;
- begin
- process(iCLK) begin
- if(iCLK'event and iCLK='1') then
- if(inRST = '0') then
- sCNT <= "0000000000000000000000000";
- sTC <= '0';
- else
- if(sONOFF = '0') then
- sCNT <= sCNT + 1;
- if(sCNT = "1011011100011011000000000") then
- sTC <= not(sTC);
- sCNT <= "0000000000000000000000000";
- else
- sTC <= sTC;
- end if;
- end if;
- end if;
- end if;
- end process;
- process(sTC) begin
- if(inRST = '0') then
- sRES <= "00111100";
- else
- if(sONOFF = '0') then
- sRES <= sRES(0) & sRES(7 downto 1);
- else
- sRES <= sRES;
- end if;
- end if;
- end process;
- process(iCLK) begin
- if(iCLK'event and iCLK='1') then
- if(inRST = '0') then
- sONOFF <= '1';
- else
- if(inGO = '0') then
- sONOFF <= '0';
- end if;
- if(inSTOP = '0') then
- sONOFF <= '1';
- end if;
- end if;
- end if;
- end process;
- oSEC <= sRES;
- end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment