Advertisement
Guest User

Untitled

a guest
Sep 7th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.63 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3. use IEEE.STD_LOGIC_ARITH.ALL;
  4. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  5.  
  6. entity brojilo4_u_d is
  7. port(
  8.         cp, rst, ud: in std_logic;
  9.         broj: out std_logic_vector (3 downto 0)
  10. );
  11. end brojilo4_u_d;
  12.  
  13. architecture Opisni of brojilo4_u_d is
  14.  
  15.     signal temp: std_logic_vector (3 downto 0);
  16.     signal cp_o: std_logic;
  17.  
  18. begin
  19.  
  20. S1: entity djeljitelj_frek port map (cp, cp_o);
  21.  
  22. process(cp_o, rst)
  23. begin
  24.  
  25. if (rst='1') then
  26.     temp<="0000";
  27. elsif (cp_o'event and cp_o='1') then
  28.     if (ud='1') then
  29.         temp<=temp+1;
  30.     else
  31.         temp<=temp-1;
  32.     end if;
  33. end if;
  34.  
  35. end process;
  36.  
  37. broj<=temp;
  38.  
  39. end Opisni;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement